jonswar/perl-HTML-Mason — pull request #1 by rjbs (2013-09-25 00:01:06+00:00)
Title: escape each part of substitution, not their concatenation

It's easier to think about what the compiled code will do, rather
than look at the diff alone.

Given this substitution:

```perl
<% x(), y(), z() | escape %>
```

The current code does this:

```perl
$m->print( escape_func( join( q{}, x(), y(), z() ) ) )
```

After this patch, it does this:

```perl
$m->print( map {; escape_func($_) } ( x(), y(), z() ) );
```

These are both just slightly simplified.

This change is important because it allows substitutions and escapes
to interact based on type. For example, I wrote an escape that
looks something like this:

```perl
sub escape_html {
my $input = shift;
return $input->as_html if blessed $input and $input->isa('HTML::Hunk');
return escape_entities($input);
}
```

Then everything is html-escaped unless it explicitly declaring that
it is HTML. It means less type-accounting throughout the whole
application, because the type can always be inspected.