diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-10-19 03:32:22 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-10-19 03:32:22 -0500 |
commit | 71a5add2e54c2cddf61db1af59c0653c2b763290 (patch) | |
tree | 51154ccd7342d0fd730ed1b7885bccea2cd85d38 /lib/Text/Handlebars.pm | |
parent | 4f6debfaaabcf04e5f67e9da71eb76abd39a8266 (diff) | |
download | text-handlebars-71a5add2e54c2cddf61db1af59c0653c2b763290.tar.gz text-handlebars-71a5add2e54c2cddf61db1af59c0653c2b763290.zip |
move most of find_file into the compiler
Diffstat (limited to 'lib/Text/Handlebars.pm')
-rw-r--r-- | lib/Text/Handlebars.pm | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Text/Handlebars.pm b/lib/Text/Handlebars.pm index 9e3f93c..947a336 100644 --- a/lib/Text/Handlebars.pm +++ b/lib/Text/Handlebars.pm @@ -143,12 +143,12 @@ sub _register_builtin_methods { my ($funcs) = @_; weaken(my $weakself = $self); + $funcs->{'(suffix)'} = sub { + return $weakself->{suffix}; + }; $funcs->{'(find_file)'} = sub { my ($filename) = @_; - return $filename if try { $weakself->find_file($filename); 1 }; - $filename .= $weakself->{suffix}; - return $filename if try { $weakself->find_file($filename); 1 }; - return 0; + return try { $weakself->find_file($filename); 1 }; }; $funcs->{'(make_block_helper)'} = sub { my ($code, $raw_text, $else_raw_text, $hash) = @_; |