Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative path handling in templates on Perl 5.26+ with 'do' #79

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/Template/Provider.pm
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,9 @@ sub _compiled_filename {

sub _load_compiled {
my ($self, $file) = @_;
my $compiled;

# load compiled template via require(); we zap any
# %INC entry to ensure it is reloaded (we don't
# want 1 returned by require() to say it's in memory)
delete $INC{ $file };
eval { $compiled = require $file; };
my $fpath = File::Spec->rel2abs($file);
my $compiled = do $fpath;
return $@
? $self->error("compiled template $compiled: $@")
: $compiled;
Expand Down