Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow Template::Semantic->call_filter

  • Loading branch information...
commit 6eb4b9f89b6f3638d2ccf4714d76028eeddad2b0 1 parent f25ed4a
@tomill authored
Showing with 11 additions and 1 deletion.
  1. +3 −1 lib/Template/Semantic.pm
  2. +8 −0 t/07_default-filters.t
View
4 lib/Template/Semantic.pm
@@ -36,7 +36,9 @@ sub define_filter {
sub call_filter {
my ($self, $name) = @_;
$name ||= "";
- $self->{filter}{$name} or croak "Filter $name not defined.";
+ my $filter = ref($self) ? $self->{filter}{$name}
+ : Template::Semantic::Filter->can($name);
+ $filter or croak "Filter $name not defined.";
}
sub process {
View
8 t/07_default-filters.t
@@ -107,3 +107,11 @@ BBB&lt;br /&gt;BBB<br />
CCC<br />
</p>
</root>
+
+=== class->call_filter
+--- vars
+'@class' => Template::Semantic->call_filter('sort')
+--- template
+<span class="yyy xxx zzz">foo</span>
+--- expected
+<span class="xxx yyy zzz">foo</span>
Please sign in to comment.
Something went wrong with that request. Please try again.