Fixed up uses of catdir being used to return a file path
Nigel Metheringham [Thu, 1 Mar 2012 11:18:13 +0000 (11:18 +0000)]
catdir and catfile are different - using them interchangeably may
work on most platforms, but one day you will encounter VMS
and get horribly confused!

lib/Catalyst/ScriptRunner.pm
t/aggregate/unit_utils_home.t
t/psgi_file_testapp.t
t/psgi_file_testapp_engine_psgi_compat.t

index 32031ed..caf16dc 100644 (file)
@@ -35,7 +35,7 @@ sub subclass_with_traits {
 sub run {
     my ($self, $appclass, $scriptclass) = @_;
 
-    if (grep { -f File::Spec->catdir($FindBin::Bin, '..', $_) } Catalyst::Utils::dist_indicator_file_list()) {
+    if (grep { -f File::Spec->catfile($FindBin::Bin, '..', $_) } Catalyst::Utils::dist_indicator_file_list()) {
         lib->import(File::Spec->catdir($FindBin::Bin, '..', 'lib'));
     }
 
index 7e499ee..4a11c08 100644 (file)
@@ -15,7 +15,7 @@ my $cwd = cwd();
 foreach my $inc ('', 'lib', 'blib'){
     my $d = tempdir(CLEANUP => 1);
     chdir($d);
-    local $INC{'MyApp.pm'} = File::Spec->catdir($d, $inc, 'MyApp.pm');
+    local $INC{'MyApp.pm'} = File::Spec->catfile($d, $inc, 'MyApp.pm');
     ok !Catalyst::Utils::home('MyApp'), "No files found inc $inc";
     open(my $fh, '>', "Makefile.PL");
     close($fh);
@@ -24,7 +24,7 @@ foreach my $inc ('', 'lib', 'blib'){
 
 {
     my $d = tempdir(CLEANUP => 1);
-    local $INC{'MyApp.pm'} = File::Spec->catdir($d, 'MyApp.pm');
+    local $INC{'MyApp.pm'} = File::Spec->catfile($d, 'MyApp.pm');
     ok !Catalyst::Utils::home('MyApp'), 'No files found';
     mkdir File::Spec->catdir($d, 'MyApp');
     is Catalyst::Utils::home('MyApp'), dir($d, 'MyApp')->absolute->cleanup;
index ea06d55..14e25fb 100644 (file)
@@ -14,7 +14,7 @@ BEGIN {
     $temp = tempdir( CLEANUP => 1 );
 
     $ENV{CATALYST_HOME} = $temp;
-    open(my $psgi, '>', File::Spec->catdir($temp, 'testapp.psgi')) or die;
+    open(my $psgi, '>', File::Spec->catfile($temp, 'testapp.psgi')) or die;
     print $psgi q{
         use strict;
         use TestApp;
index 72eec23..1f5b4d9 100644 (file)
@@ -14,7 +14,7 @@ BEGIN {
     $temp = tempdir( CLEANUP => 1 );
 
     $ENV{CATALYST_HOME} = $temp;
-    open(my $psgi, '>', File::Spec->catdir($temp, 'testapp.psgi')) or die;
+    open(my $psgi, '>', File::Spec->catfile($temp, 'testapp.psgi')) or die;
     print $psgi q{
         use strict;
         use TestApp;