summaryrefslogtreecommitdiffstats
path: root/lib/Text/Handlebars.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-19 03:32:22 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-19 03:32:22 -0500
commit71a5add2e54c2cddf61db1af59c0653c2b763290 (patch)
tree51154ccd7342d0fd730ed1b7885bccea2cd85d38 /lib/Text/Handlebars.pm
parent4f6debfaaabcf04e5f67e9da71eb76abd39a8266 (diff)
downloadtext-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.pm8
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) = @_;