Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

path done

  • Loading branch information...
commit bf5f5d33d3699013916ea32fa66edc3f1e7007a1 1 parent 7a98eb0
@FROGGS authored
Showing with 14 additions and 4 deletions.
  1. +1 −1  README.md
  2. +6 −1 lib/File/Spec/Unix.pm
  3. +7 −2 t/01_unix.t
View
2  README.md
@@ -20,7 +20,7 @@ Methods (current state):
no_upwards done
case_tolerant done done done done done done
file_name_is_absolute done
- path
+ path done
join
splitpath
splitdir
View
7 lib/File/Spec/Unix.pm
@@ -76,7 +76,12 @@ class File::Spec::Unix {
}
method path {
-
+ return () unless %*ENV{'PATH'};
+ my @path = %*ENV{'PATH'}.split( ':' );
+ for @path {
+ $_ = '.' if $_ eq ''
+ }
+ return @path
}
method join {
View
9 t/01_unix.t
@@ -3,7 +3,7 @@ use lib 'lib';
use Test;
use File::Spec;
-plan 31;
+plan 32;
if $*OS ~~ any(<MacOS MSWin32 os2 VMS epoc NetWare symbian dos cygwin>) {
skip_rest 'this is not Unix\'ish'
@@ -56,7 +56,12 @@ else {
ok File::Spec.file_name_is_absolute( '/abcd' ), 'file_name_is_absolute: ok "/abcd"';
nok File::Spec.file_name_is_absolute( 'abcd' ), 'file_name_is_absolute: nok "abcd"';
- #path
+ my $path = %*ENV{'PATH'};
+ %*ENV{'PATH'} = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:';
+ @want = </usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games .>;
+ is_deeply File::Spec.path, @want, 'path';
+ %*ENV{'PATH'} = $path;
+
#join
#splitpath
#splitdir
Please sign in to comment.
Something went wrong with that request. Please try again.