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!