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

David E. Wheeler david at kineticode.com
Thu Nov 12 14:23:08 EST 2009

On Nov 12, 2009, at 10:11 AM, Jesse Vincent wrote:

> Hrm. I think I'd be a lot happier separating the "autohandler" concept from
> a more generic "wrapper" concept.

Well, I'm inspired by autohandlers, but these are really just wrappers. The only thing I've borrowed is resolving wrappers in subdirectories of the path and executing them all.

> In my ideal world, I'd be able to use different wrappers for different
> templates at the same "level" - in apps with dispatchers, sometimes the
> package and desired wrappers don't match up exactly 1 to 1.

I'm not proposing wrappers at the package level, but at the path level.

> I'd love to be able to say:
> wrap template 'foo' with 'my_gorgeous_page_layout' => sub {
> };

Hrm. I was trying to get away from individual templates having to identify what wrappers they use. You can already do this with the current wrapper implementation (though it's still bolted on, we can make it a bit neater).

> I can totally see a good argument for a package level default wrapper.
> Maybe somethign like:
> default wrapper 'my_ugly_wrapper';
> ( multiple default wrappers would be an error. )

Yeah, that's how TT wrappers work. And the only difference in what I'm suggesting, aside from syntax, is that you can have multiple wrappers execute as long as they're in different path levels. SO if you execute the template `/foo/bar`, then a wrapper in / would execute, as would a wrapper in /foo (if either or both exist, of course).



More information about the jifty-devel mailing list