summaryrefslogtreecommitdiff
path: root/lib/File
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-04 01:51:47 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-04 01:51:47 +0000
commitb3eb6a9ba72c92b7decf330d8d63b32ba5499629 (patch)
treeb3af31372ba9c68faf41895b58e0baa1f9372d16 /lib/File
parent85b81015bdcfa6e7a9ccddddb0d3face7465f666 (diff)
downloadperl-b3eb6a9ba72c92b7decf330d8d63b32ba5499629.tar.gz
merge changes#1210,1211,1270 from maintbranch
p4raw-link: @1270 on //depot/maint-5.004/perl: 413603941653f55130af336b8e990052b26673a6 p4raw-link: @1211 on //depot/maint-5.004/perl: 247620c138019426962998dd7edc0157874220f0 p4raw-link: @1210 on //depot/maint-5.004/perl: 4522f71f5c16bf8892b1952004accec53aab868e p4raw-id: //depot/perl@1277
Diffstat (limited to 'lib/File')
-rw-r--r--lib/File/Basename.pm30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm
index e21af92682..69bb1fa5fd 100644
--- a/lib/File/Basename.pm
+++ b/lib/File/Basename.pm
@@ -122,11 +122,13 @@ directory name to be F<.>).
=cut
-require 5.002;
+
+## use strict;
+use re 'taint';
+
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(fileparse fileparse_set_fstype basename dirname);
-#use strict;
use vars qw($VERSION $Fileparse_fstype $Fileparse_igncase);
$VERSION = "2.6";
@@ -160,23 +162,23 @@ sub fileparse {
if ($fstype =~ /^VMS/i) {
if ($fullname =~ m#/#) { $fstype = '' } # We're doing Unix emulation
else {
- ($dirpath,$basename) = ($fullname =~ /^(.*[:>\]])?(.*)/t);
+ ($dirpath,$basename) = ($fullname =~ /^(.*[:>\]])?(.*)/);
$dirpath ||= ''; # should always be defined
}
}
if ($fstype =~ /^MS(DOS|Win32)/i) {
- ($dirpath,$basename) = ($fullname =~ /^((?:.*[:\\\/])?)(.*)/t);
+ ($dirpath,$basename) = ($fullname =~ /^((?:.*[:\\\/])?)(.*)/);
$dirpath .= '.\\' unless $dirpath =~ /[\\\/]$/;
}
elsif ($fstype =~ /^MacOS/i) {
- ($dirpath,$basename) = ($fullname =~ /^(.*:)?(.*)/t);
+ ($dirpath,$basename) = ($fullname =~ /^(.*:)?(.*)/);
}
elsif ($fstype =~ /^AmigaOS/i) {
- ($dirpath,$basename) = ($fullname =~ /(.*[:\/])?(.*)/t);
+ ($dirpath,$basename) = ($fullname =~ /(.*[:\/])?(.*)/);
$dirpath = './' unless $dirpath;
}
elsif ($fstype !~ /^VMS/i) { # default to Unix
- ($dirpath,$basename) = ($fullname =~ m#^(.*/)?(.*)#t);
+ ($dirpath,$basename) = ($fullname =~ m#^(.*/)?(.*)#);
if ($^O eq 'VMS' and $fullname =~ m:/[^/]+/000000/?:) {
# dev:[000000] is top of VMS tree, similar to Unix '/'
($basename,$dirpath) = ('',$fullname);
@@ -188,7 +190,7 @@ sub fileparse {
$tail = '';
foreach $suffix (@suffices) {
my $pat = ($igncase ? '(?i)' : '') . "($suffix)\$";
- if ($basename =~ s/$pat//t) {
+ if ($basename =~ s/$pat//) {
$taint .= substr($suffix,0,0);
$tail = $1 . $tail;
}
@@ -226,30 +228,30 @@ sub dirname {
}
if ($fstype =~ /MacOS/i) { return $dirname }
elsif ($fstype =~ /MSDOS/i) {
- $dirname =~ s/([^:])[\\\/]*$/$1/t;
+ $dirname =~ s/([^:])[\\\/]*$/$1/;
unless( length($basename) ) {
($basename,$dirname) = fileparse $dirname;
- $dirname =~ s/([^:])[\\\/]*$/$1/t;
+ $dirname =~ s/([^:])[\\\/]*$/$1/;
}
}
elsif ($fstype =~ /MSWin32/i) {
- $dirname =~ s/([^:])[\\\/]*$/$1/t;
+ $dirname =~ s/([^:])[\\\/]*$/$1/;
unless( length($basename) ) {
($basename,$dirname) = fileparse $dirname;
- $dirname =~ s/([^:])[\\\/]*$/$1/t;
+ $dirname =~ s/([^:])[\\\/]*$/$1/;
}
}
elsif ($fstype =~ /AmigaOS/i) {
if ( $dirname =~ /:$/) { return $dirname }
chop $dirname;
- $dirname =~ s#[^:/]+$##t unless length($basename);
+ $dirname =~ s#[^:/]+$## unless length($basename);
}
else {
$dirname =~ s:(.)/*$:$1:;
unless( length($basename) ) {
local($File::Basename::Fileparse_fstype) = $fstype;
($basename,$dirname) = fileparse $dirname;
- $dirname =~ s:(.)/*$:$1:t;
+ $dirname =~ s:(.)/*$:$1:;
}
}