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

Stop removing entries from %INC to load code #177

Open
toddr opened this issue Oct 5, 2018 · 3 comments
Open

Stop removing entries from %INC to load code #177

toddr opened this issue Oct 5, 2018 · 3 comments
Labels

Comments

@toddr
Copy link
Collaborator

toddr commented Oct 5, 2018

We rejected #79 and took #80 because #79 is a behavior change. We still think it might be worth doing but it should be addressed as its own issue.

@toddr
Copy link
Collaborator Author

toddr commented Oct 5, 2018

@xsawyerx ^^

@xsawyerx
Copy link
Contributor

xsawyerx commented Oct 6, 2018

I don't have a preference here. As noted in one of the aforementioned tickets, the entirety of the work was done by @kentfredric.

@toddr
Copy link
Collaborator Author

toddr commented Oct 6, 2018

The fix in question would be something like this:

diff --git a/lib/Template/Provider.pm b/lib/Template/Provider.pm
index 6ecb2453..3a75a29b 100644
--- a/lib/Template/Provider.pm
+++ b/lib/Template/Provider.pm
@@ -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;

@toddr toddr added the Bug label Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants