Skip Menu |
 

This queue is for tickets about the HTML-Template-JIT CPAN distribution.

Report information
The Basics
Id: 123380
Status: new
Priority: 0/
Queue: HTML-Template-JIT

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-Fix-compiling-templates-under-Perl-5.26-without-.-in.patch



Subject: [Patch] Runtime template loading broken on Perl 5.26
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
Message-ID: <rt-4.0.18-8059-1508959984-28.0-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1508959984-8059-2"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: binary
Content-Length: 230
Failure only really obvious when you run tests with PERL_USE_UNSAFE_INC=0 in environment.



-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
Subject: 0001-Fix-compiling-templates-under-Perl-5.26-without-.-in.patch
MIME-Version: 1.0
Content-Type: text/x-diff; name="0001-Fix-compiling-templates-under-Perl-5.26-without-.-in.patch"
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline; filename="0001-Fix-compiling-templates-under-Perl-5.26-without-.-in.patch"
Content-Transfer-Encoding: binary
Content-Length: 2003
From 22d99c371166084fcf32b901198ce4e052cf9931 Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentnl@gentoo.org> Date: Thu, 26 Oct 2017 08:26:53 +1300 Subject: Fix compiling templates under Perl 5.26 without '.' in @INC Perl 5.26 changes the default contents of @INC to no longer include ".", which is required for "require q[foo.tpl]" semantics. This brekage is invisible in tests due to a workaround P5P put in place to avoid breaking tests, by setting PERL_USE_UNSAFE_INC=1 in Test::Harness and CPAN installers, which makes '.' re-appear in @INC during installation, while still being silently broken in production. This fix works by relying on the mechanic of require() to *NOT* consult @INC if $path is either an absolute, or a "./" prefixed relative path, by converting it to an absolute path just before requiring it. --- JIT.pm | 2 +- JIT/Compiler.pm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/JIT.pm b/JIT.pm index 9e5a6be..1e2afc8 100644 --- a/JIT.pm +++ b/JIT.pm @@ -63,7 +63,7 @@ sub new { # try to load the module and return package handle if successful my $result; - eval { $result = require $package_path; }; + eval { $result = require File::Spec->rel2abs($package_path); }; if ($result) { $package->clear_params(); # need to clear out params from prior run return $package; diff --git a/JIT/Compiler.pm b/JIT/Compiler.pm index 6ef3e02..bc1e05f 100644 --- a/JIT/Compiler.pm +++ b/JIT/Compiler.pm @@ -9,6 +9,7 @@ our $VERSION = '0.01'; use HTML::Template; use Carp qw(croak confess); use File::Path qw(mkpath rmtree); +use File::Spec; sub compile { my %args = @_; @@ -53,7 +54,7 @@ sub compile { # try to load the module and return package handle if successful my $result; - eval { $result = require $self->{package_path}; }; + eval { $result = require File::Spec->rel2abs($self->{package_path}); }; return 1 if $result; # don't leave failed compiles lying around unless we're debuging -- 2.14.3


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.