Re: extending <% | %>

Hans Dieter Pearcey <[email protected]> Thu, 31 Jan 2008 05:46:32 -0500
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Wed, Jan 16, 2008 at 11:12:04AM -0500, Hans Dieter Pearcey wrote:
> Attached is a patch that makes | in substitutions more powerful.

The biggest problem is with using '|'.  While I think it's unlikely that anyone
is doing lots of bitwise-or inside <% %>, it's not impossible that someone
would write a regex that matches the pattern I'm using for finding filters; it
is roughly:

  /\| \s* \w+(\(.*\))? \s* $/x

which matches, for example,

  <% $x =~ m(foo|bar(baz)?) %>

I can't think of a really satisfactory way to solve this.  I definitely do not
want to get too heavily into trying to parse Perl, and the only alternative I
can think of is to use a different delimiter for these kinds of filters.

I generated a whole bunch of examples with different delimiters, and I've
attached them, but I don't really like any of them, either, and most of them
wouldn't completely sidestep the problem anyway.

Anyone have better ideas?  I would love to hear them.

hdp.

-------------------------------------------------------------------------
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/

_______________________________________________
Mason-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-devel
filter-examples (text/plain, 2.4 KB)
<% $obj->some_method(@args) ~ cache(expires => "10m") ~ h %>

<% $obj->some_method(@args) & cache(expires => "10m") & h %>

<% $obj->some_method(@args) |~ cache(expires => "10m") |~ h %>

<% $obj->some_method(@args) |~ cache(expires => "10m") | h %>

<% $obj->some_method(@args) ~| cache(expires => "10m") ~| h %>

<% $obj->some_method(@args) ~| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |& cache(expires => "10m") |& h %>

<% $obj->some_method(@args) |& cache(expires => "10m") | h %>

<% $obj->some_method(@args) &| cache(expires => "10m") &| h %>

<% $obj->some_method(@args) &| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |* cache(expires => "10m") |* h %>

<% $obj->some_method(@args) |* cache(expires => "10m") | h %>

<% $obj->some_method(@args) *| cache(expires => "10m") *| h %>

<% $obj->some_method(@args) *| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |- cache(expires => "10m") |- h %>

<% $obj->some_method(@args) |- cache(expires => "10m") | h %>

<% $obj->some_method(@args) -| cache(expires => "10m") -| h %>

<% $obj->some_method(@args) -| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |= cache(expires => "10m") |= h %>

<% $obj->some_method(@args) |= cache(expires => "10m") | h %>

<% $obj->some_method(@args) =| cache(expires => "10m") =| h %>

<% $obj->some_method(@args) =| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |+ cache(expires => "10m") |+ h %>

<% $obj->some_method(@args) |+ cache(expires => "10m") | h %>

<% $obj->some_method(@args) +| cache(expires => "10m") +| h %>

<% $obj->some_method(@args) +| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |> cache(expires => "10m") |> h %>

<% $obj->some_method(@args) |> cache(expires => "10m") | h %>

<% $obj->some_method(@args) >| cache(expires => "10m") >| h %>

<% $obj->some_method(@args) >| cache(expires => "10m") | h %>

<% $obj->some_method(@args) |< cache(expires => "10m") |< h %>

<% $obj->some_method(@args) |< cache(expires => "10m") | h %>

<% $obj->some_method(@args) <| cache(expires => "10m") <| h %>

<% $obj->some_method(@args) <| cache(expires => "10m") | h %>

<% $obj->some_method(@args) >> cache(expires => "10m") >> h %>

<% $obj->some_method(@args) >> cache(expires => "10m") | h %>

<% $obj->some_method(@args) << cache(expires => "10m") << h %>

<% $obj->some_method(@args) << cache(expires => "10m") | h %>