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

David E. Wheeler david at kineticode.com
Thu Dec 10 12:47:16 EST 2009


On Dec 10, 2009, at 7:17 AM, Shawn M Moore wrote:

> I like the concept of what you're proposing, David.
> 
> In the Jifty world, Jifty::Dispatcher typically provides most of the features
> for which autohandlers are used. I don't Catalyst well enough to know its
> analogue, but surely it must have one (or more).

No, it leaves that sort of thing to the templating systems. Otherwise I likely wouldn't be doing this.

> Only in one place do we actually inject additional HTML. In the global
> /autohandler we add a footer to each page. (In RT this is asymmetrical only
> because calling the header template is how each page specifies its title, tabs,
> etc)

I use them a lot in Bricolage templates for creating the standard HTML header and footer sections for every page on a site or section. Extremely handy for that. I wish I understood them better when we wrote Bricolage itself, as it makes almost no use of autohandlers at all.

> That our real-world use of autohandler is almost entirely controller-level
> rather than view-level suggests that we should come up with a better metaphor
> than autohandler for what we want in TD here. I think this is what Jesse was
> saying here:

Well, no. That RT and Bricolage don't making great use of authohandlers doesn't mean that the concept is flawed. That's not how Mason thinks about them.

> On Thu, Nov 12, 2009 at 01:11:18PM -0500, Jesse Vincent wrote:
>> Hrm. I think I'd be a lot happier separating the "autohandler" concept from
>> a more generic "wrapper" concept.
> 
> Now, skipping down to the latest post.. :)

I agree they should be separated. I was relying on the idea of autohandlers for their dispatch mechanism, but not for inheritance or the other cool stuff they support. My idea is really just wrappers, but allows them in subdirectories and they cascade their execution. That's all I've borrowed from autohandlers, and I wouldn't (and don't) call them autohanders in TD.

> I definitely prefer getting rid of wrapper names; don't see a real need for
> them. For multiple wrappers, declaration order works. Or, for now, defer
> the decision by making it an error to declare more than one. That affords us
> forward-compat.

Agreed.

> On Tue, Dec 01, 2009 at 03:16:06PM -0500, Jesse Vincent wrote:
>> When we're doing template resolution, "/" still means at the root, not "the
>> current package", right?  That would lead me to want to use relative
>> pathing syntax here.  '.' or './' or _something_, since '/' means something
>> fairly specific already.
> 
> Ew. This makes me want to get rid of specifying paths for wrappers entirely.

I think we can throw exceptions for those kinds of path specs. After all, one doesn't execute wrappers from within templates. They're handled by TD automatically. So it makes no sense to declare them in any directory other than where they should be.

> On Tue, Dec 01, 2009 at 03:16:06PM -0500, Jesse Vincent wrote:
>> Really, when we start specifying paths and subpaths, for these wrappers
>> to wrap, I start reaching for a path based dispatcher with globbing
>> and/or regexes, ala Path::Dispatcher or Jifty::Dispatcher, but I know
>> that's not the hammer you're looking for. Maybe we really do just want
>> one wrapper per package scope.
> 
> Yeah, agreed.
> 
> I'll detail my counterproposal.. proposals! in a followup mail.

Will do.

David



More information about the jifty-devel mailing list