diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-03-12 05:28:25 +0000 |
---|---|---|
committer | Charles Bailey <bailey@genetics.upenn.edu> | 1996-03-12 05:28:25 +0000 |
commit | f0c6ccdf336c558dae0bcc372c05ef27acd07063 (patch) | |
tree | 51eea7348b2429c581eaa16a85c6d1143869dc53 /lib/File | |
parent | 4230ab3ff697b1a31503b40e7b1d6159185de56a (diff) | |
download | perl-f0c6ccdf336c558dae0bcc372c05ef27acd07063.tar.gz |
perl 5.002_01: lib/File/Basename.pm
Use $^O, and add separator to dirname() result under Unix and MSDOS
when returning '.'
Diffstat (limited to 'lib/File')
-rw-r--r-- | lib/File/Basename.pm | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index 596bff4494..daff148a63 100644 --- a/lib/File/Basename.pm +++ b/lib/File/Basename.pm @@ -45,8 +45,7 @@ they assume you are using UNIX emulation and apply the UNIX syntax rules instead, for that function call only. If you haven't called fileparse_set_fstype(), the syntax is chosen -by examining the "osname" entry from the C<Config> package -according to these rules. +by examining the builtin variable C<$^O> according to these rules. =item fileparse @@ -111,8 +110,7 @@ directory name to be F<.>). =cut -require 5.000; -use Config; +require 5.002; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(fileparse fileparse_set_fstype basename dirname); @@ -148,7 +146,7 @@ sub fileparse_set_fstype { # according to the syntax of the OS (code is provided below to handle # VMS, Unix, MSDOS and MacOS; you can pick the one you want using # fileparse_set_fstype(), or you can accept the default, which is -# based on the information in the %Config array). It then compares +# based on the information in the builtin variable $^O). It then compares # each element of @excludelist to $filename, and if that element is a # suffix of $filename, it is removed from $filename and prepended to # $tail. By specifying the elements of @excludelist in the right order, @@ -184,14 +182,14 @@ sub fileparse { } if ($fstype =~ /^MSDOS/i) { ($dirpath,$basename) = ($fullname =~ /(.*\\)?(.*)/); - $dirpath = '.' unless $dirpath; + $dirpath = '.\\' unless $dirpath; } elsif ($fstype =~ /^MAC/i) { ($dirpath,$basename) = ($fullname =~ /(.*:)?(.*)/); } elsif ($fstype !~ /^VMS/i) { # default to Unix ($dirpath,$basename) = ($fullname =~ m#(.*/)?(.*)#); - $dirpath = '.' unless $dirpath; + $dirpath = './' unless $dirpath; } if (@suffices) { @@ -249,6 +247,6 @@ sub dirname { $dirname; } -$Fileparse_fstype = $Config{'osname'}; +$Fileparse_fstype = $^O; 1; |