Re: extending <% | %>
BenRifkah Bergsten-Buret <[email protected]> Fri, 15 Feb 2008 12:37:55 -0800
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
Hans Dieter Pearcey wrote:
> Once we have that, the real difference is between these two:
>
> -----
>
> <%perl>
> my $cached_val = $m->cached_or_do(
> sub { $obj->calc_some_stuff(@args) },
> expires_in => "10m",
> cache_key => "your face",
> );
> </%perl>
>
> # ... somewhere else ...
> <% $cached_val |h %>
>
> -----
>
> <% $obj->calc_some_stuff(@args)
> | cache(expires_in => "10m", cache_key => "your face")
> | h %>
>
>
+1 for being able to send parameters to custom escapes.
However, I'm not sold that using the pipe to chain escapes is really
necessary. I agree that the pipe symbol is great because it already
carries the desired meaning because its used in numerous other
contexts. However, implementing it seems to me to be more trouble than
its worth especially since the comma is already implemented (and used in
the wild) for chaining escapes.
I think that using pipes as the delimiter for chaining escapes may be
another bike shed to paint in the future :)
-- Ben
P.S.: I actually like the first syntax because IMO it allows for more
effective separation of storage and display, but to each his own.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/