[jifty-devel] RFC: Improved Template::Declare Wrappers
Jesse Vincent
jesse at bestpractical.com
Tue Dec 1 15:16:06 EST 2009
On Tue 1.Dec'09 at 11:48:49 -0800, David E. Wheeler wrote:
> On Dec 1, 2009, at 10:26 AM, Jesse Vincent wrote:
>
> > I've been looking more at your proposal. Given that you want wrappers to
> > mix in and have names, it feels a little weird to force them to be "only
> > one per path level."
>
> So how would you resolve them if there were two on the same path level in the same dispatch class?
I don't have a good answer for that, short of "declaration order" or
some similar insanity. Your argument was pushing me toward "no names"
rather than "multiple per package and level"
>
> I don't care if they have names, frankly. So maybe the syntax could just be:
>
> wrapper '/' => sub { };
I wonder if making it imperative makes sense? wrap instead of wrapper.
wrap '/' => sub { };
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.
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.
> Maybe if there's no path, it could default to the root path as declared:
>
> wrapper sub { };
>
> For a subpath you'd have to be explicit:
>
> wrapper '/politics' => sub { };
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.jifty.org/pipermail/jifty-devel/attachments/20091201/8f410bc3/attachment.pgp
More information about the jifty-devel
mailing list