Revision history for local::lib
+ - fix new test to use alternate path representations on windows, to
+ handle potential space issues (regression since 1.008012)
+
1.008013 2013-09-11
- fix undef value errors when not installing into a local::lib
use Config;
use local::lib ();
+use lib 't/lib'; use TempDir;
+
# remember the original value of this, in case we are already running inside a
# local::lib
my $orig_llr = $ENV{PERL_LOCAL_LIB_ROOT} || '';
-my $dir1 = tempdir('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), CLEANUP => 1);
-my $dir2 = tempdir('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), CLEANUP => 1);
-my $dir3 = tempdir('test_local_lib-XXXXX', DIR => Cwd::abs_path('t'), CLEANUP => 1);
+my $dir1 = mk_temp_dir('test_local_lib-XXXXX');
+my $dir2 = mk_temp_dir('test_local_lib-XXXXX');
+my $dir3 = mk_temp_dir('test_local_lib-XXXXX');
ok(!(grep { $dir1 eq $_ } @INC), 'new dir is not already in @INC');
ok(!(grep { $dir1 eq $_ } split /\Q$Config{path_sep}\E/, ($ENV{PERL5LIB}||'')), 'new dir is not already in PERL5LIB');
--- /dev/null
+package TempDir;
+use strict;
+use warnings;
+
+use Exporter 'import';
+our @EXPORT = qw(mk_temp_dir);
+
+use local::lib ();
+use Cwd;
+use File::Temp qw(tempdir);
+
+sub mk_temp_dir
+{
+ my $name_template = shift;
+
+ my $path = tempdir($name_template, DIR => Cwd::abs_path('t'), CLEANUP => 1);
+ local::lib->ensure_dir_structure_for($path);
+ # On Win32 the path where the distribution is built usually contains
+ # spaces. This is a problem for some parts of the CPAN toolchain, so
+ # local::lib uses the GetShortPathName trick do get an alternate
+ # representation of the path that doesn't constain spaces.
+ return ($^O eq 'MSWin32')
+ ? Win32::GetShortPathName($path)
+ : $path
+}
+
+1;
use strict;
use warnings;
use Test::More;
-use File::Temp qw(tempdir);
use File::Spec;
-use Cwd;
use Config;
plan tests => 24;
use local::lib ();
-sub mk_temp_dir
-{
- my $name_template = shift;
-
- my $path = tempdir($name_template, DIR => Cwd::abs_path('t'), CLEANUP => 1);
- local::lib->ensure_dir_structure_for($path);
- # On Win32 the path where the distribution is built usually contains
- # spaces. This is a problem for some parts of the CPAN toolchain, so
- # local::lib uses the GetShortPathName trick do get an alternate
- # representation of the path that doesn't constain spaces.
- return ($^O eq 'MSWin32')
- ? Win32::GetShortPathName($path)
- : $path
-}
+use lib 't/lib'; use TempDir;
my $dir1 = mk_temp_dir('test_local_lib-XXXXX');
my $dir2 = mk_temp_dir('test_local_lib-XXXXX');