Skip to content

Instantly share code, notes, and snippets.

@knutov
Created December 30, 2011 21:45
Show Gist options
  • Save knutov/1541615 to your computer and use it in GitHub Desktop.
Save knutov/1541615 to your computer and use it in GitHub Desktop.
Dancer::Template::Ctpp2
sub render($$$) {
my ($self, $template, $tokens) = @_;
# in cases of different extensions we need to check
# samples: template 'index' vs template 'index.txt'
# template 'index' will be autoconverted to template 'index.tmpl' and
# template 'index.txt' to template 'index.txt.htm' without this fix.
# $template =~ s/\.[a-zA-Z0-9]+?$// if !ref($template) and !-f $template;
$template =~ s/\.\w+?$// if !ref($template) and !-f $template;
die "'$template' is not a regular file"
if !ref($template) && (!-f $template);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment