Skip to content

Use methods for HTML/CSS so it's easier to subclass.#693

Closed
davorg wants to merge 1 commit into
plack:masterfrom
davorg:better_html
Closed

Use methods for HTML/CSS so it's easier to subclass.#693
davorg wants to merge 1 commit into
plack:masterfrom
davorg:better_html

Conversation

@davorg

@davorg davorg commented Jun 6, 2023

Copy link
Copy Markdown

I wanted to change the HTML/CSS in a subclass of this class, but using lexical variables makes it too hard. I worked around it, but a change like this would make it easier in the future.

@miyagawa

miyagawa commented Jun 6, 2023

Copy link
Copy Markdown
Member

Do you actually need to subclass for other reasons? Because we can change it to a sub callback then you could supply your custom attributes without creating a subclass.

@davorg

davorg commented Jun 6, 2023

Copy link
Copy Markdown
Author

Well, I'm currently using doing stuff with a subclass (https://github.com/davorg/plack-app-directoryindex) which adds support for index.html to Plack::App::Directory. But I wouldn't need to use that subclass if you merged #654 :-)

@davorg

davorg commented Jun 6, 2023

Copy link
Copy Markdown
Author

Oh wait. Looks like my previous PR has got somewhat corrupted. Let me clean it up and resubmit it.

@miyagawa

miyagawa commented Jun 6, 2023

Copy link
Copy Markdown
Member

Well yeah that's orthogonal :) For Plack app/middleware I generally prefer setting these things via callback attributes rather than requiring to subclass it.

@davorg

davorg commented Jun 6, 2023

Copy link
Copy Markdown
Author

Ok. Do you have a good example of how you've used callback attributes elsewhere? I'll crib off that and submit a new PR.

@davorg

davorg commented Jun 6, 2023

Copy link
Copy Markdown
Author

Replaced by #695

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants