Skip Menu |

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

Report information
The Basics
Id: 83331
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: john.elion [...] verizon.net
Cc:
AdminCc:

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



Subject: On Win32, template on INCLUDE_PATH not found when CWD is on different drive
On Windows, when there is a single, fully-qualified path on INCLUDE_PATH, a template will not be found if the current working directory is on a different drive. REPRO SCENARIO: 1) Save the attached files TEST.PL and TEST.TT to C:\XXX. 2) Set the working directory to C:\XXX 3) Run test.pl, which finds a template on an INCLUDE_PATH set to 'c:\xxx'. It works correctly and the very simple template output prints to the console. 4) Change directory to another drive, i.e., drive D:. (A network drive, USB drive, or even a read-only CD drive will be just fine.) 5) Run C:\XXX\test.pl. WHAT I SAW: test.pl fails, printing the message 'file error - test.tt: not found'. WHAT I EXPECTED TO SEE: test.tt executes successfully as it did when executed from the same drive as specified on the INCLUDE_PATH as in repro step #3. NOTES: A) The documentation claims that even though colon is an include path separator, it understands Windows-syntax paths and a colon followed by a backslash is not interpreted as a path separator. B) Adding DELIMITER=';' to the TT options provided a successful workaround. Despite the workaround, the TT documentation goes to great lengths to describe that Windows paths are understood, so this should work (or else the documentation should be changed.) HOST ENVIRONMENT: Template-Toolkit 2.24 on Perl 5.16.1 ActiveState build 1601 (TemplateToolkit 2.24 was downloaded from CPAN and compiled from source) on Windows (Windows XP SP 2 on 32-bit X86 dual CPU.) ========== c:\xxx\test.pl ============ use strict; use Template; my %ttopts = ( INCLUDE_PATH => "c:\\xxx" ); my $tt = Template->new(\%ttopts) || die "$Template::Error\n"; $tt->process("test.tt", undef) || die $tt->error() . "\n"; ========== c:\xxx\test.tt ============ Hello, world!
Subject: test.pl
use strict; use Template; my %ttopts = ( INCLUDE_PATH => "c:\\xxx" ); my $tt = Template->new(\%ttopts) || die "$Template::Error\n"; $tt->process("test.tt", undef) || die $tt->error() . "\n";
Subject: test.tt
Hello, world!
Subject: [rt.cpan.org #83331]
Date: Mon, 29 Dec 2014 22:41:55 +0000
To: "bug-Template-Toolkit [...] rt.cpan.org" <bug-Template-Toolkit [...] rt.cpan.org>
From: Sune Karlsson <Sune.Karlsson [...] oru.se>
This bug still persists in version 2.26. The fix is incredibly simple. Just replace line 350 in Provider.pm with $dlim = ($^O eq 'MSWin32') ? ':(?![\\\/])' : ':'; -- Sune Karlsson Professor of Statistics Handelshögskolan/Örebro University School of Business Örebro University, SE-70182 Örebro, Sweden Phone +46 19 301257 http://www.oru.se/hh/sune_karlsson http://econpapers.repec.org/RAS/pka1.htm
Ticket migrated to github as https://github.com/abw/Template2/issues/158