[jifty-devel] RFC: Improved Template::Declare Wrappers

Shawn M Moore sartak at bestpractical.com
Thu Dec 10 10:55:45 EST 2009


On Thu, Dec 10, 2009 at 10:17:00AM -0500, Shawn M Moore wrote:
> I'll detail my counterproposal.. proposals! in a followup mail.

Okay so I think it's already been decided that we don't need to name
wrappers. Good.

I think we can get away with not allowing subpaths for wrappers.
Presumably you would use such a thing when you want to wrap only a
subset of the templates in the package. But then why not just make a new
package and use mix/alias?

So, if we have nameless wrappers that always apply to '/' (or rather, '.'),
we can have shiny syntax:

    wrapper {
        my ($self, @args) = @_;
        html {
            body {
                inner(@args); # or maybe just "inner;" a la Moose
            }
        }
    };


Another option is to specify wrappers in calls to "mix" and "alias". I
don't know if there's a good use case for this.

    alias 'CRUD' under '/crud', wrapper {
        h1 { "Yay CRUD!" };
        inner;
        p { "Back to your regularly scheduled slog." };
    };

If we do add this, it should be a separate feature. I don't like that
it's kind of action-at-a-distancey.

Shawn


More information about the jifty-devel mailing list