From: Craig A. Berry Date: Thu, 11 Apr 2002 13:47:21 +0000 (-0500) Subject: free CheckTree from the tyranny of the forward slash X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=026a9d8a2e74ab543e0da0fdfcc025431d79ff07;p=p5sagit%2Fp5-mst-13.2.git free CheckTree from the tyranny of the forward slash From: "Craig A. Berry" Message-Id: p4raw-id: //depot/perl@15866 --- diff --git a/lib/File/CheckTree.pm b/lib/File/CheckTree.pm index 3da9f20..7884ca7 100644 --- a/lib/File/CheckTree.pm +++ b/lib/File/CheckTree.pm @@ -1,8 +1,9 @@ package File::CheckTree; use 5.006; -use Exporter; use Cwd; +use Exporter; +use File::Spec; use warnings; use strict; @@ -107,7 +108,8 @@ sub validate { my $this = $test; # expand relative $file to full pathname if preceded by cd directive - $file = $cwd . '/' . $file if $cwd && $file !~ m|^/|; + $file = File::Spec->catfile($cwd, $file) + if $cwd && !File::Spec->file_name_is_absolute($file); # put filename in after the test operator $this =~ s/(-\w\b)/$1 "\$file"/g; diff --git a/lib/File/CheckTree.t b/lib/File/CheckTree.t index ae5a311..0257f4e 100755 --- a/lib/File/CheckTree.t +++ b/lib/File/CheckTree.t @@ -116,7 +116,7 @@ chdir(File::Spec->updir) or die "cannot change to parent of t/ directory: $!"; # cd directive followed by relative paths, followed by full paths { my ($num_warnings, @warnings, $path_to_libFile, $path_to_dist); - $path_to_libFile = File::Spec->rel2abs('lib/File'); + $path_to_libFile = File::Spec->rel2abs(File::Spec->catdir('lib','File')); $path_to_dist = File::Spec->rel2abs(File::Spec->curdir); local $SIG{__WARN__} = sub { push @warnings, "@_" };