Re: Mason 2.0 thoughts

Hans Dieter Pearcey <[email protected]> Sun, 13 May 2007 11:16:12 -0400
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Sat, May 12, 2007 at 11:39:15PM -0500, Dave Rolsky wrote:
> >     <% Cache (... cache flags ...) { %>
> >     ...
> >     [a component or part of a component]
> >     ...
> >     <% } %>
> 
> If only we had a syntax for this ...
> 
>   <&| Cache, ... cache flags ... &>
> 
>   [some component content]
> 
>   </&>

Maybe a new block type and some flags.

<%cache key="0xdeadbeef" expires_in="5 min">
[content]
</%cache>

I think that using flags for (basically) arbitrary data would end up being a
huge nightmare, though, unlike the <%args validate=PV> example given on the
wiki.

Is there a reason that something like this wouldn't work?

% cache {
[content]
% } (key => "0xdeadbeef", expires_in => '5 min');

  sub HTML::Mason::Commands::cache (&@) {
    my ($code, %arg) = @_;
    # do some stuff with either $code->() or looking at the cache
    $m->out($result);
  }

I'm really asking two things:

* do we need special syntax, or is a sub call sufficient?
* is there an advantage to <% %> that I'm not seeing?

hdp.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/