summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Barker <rmb1@cise.npl.co.uk>1997-04-01 12:11:43 +0100
committerChip Salzenberg <chip@atlantic.net>1997-04-01 12:01:35 +1200
commit2d6caab3c51efbf973371684428f83cc5475c01c (patch)
treefc734f0ba2817d71cef4d35c373022c77ff14b1b
parenteea074c3ea78f67828c62a0ffb638a436fab370e (diff)
downloadperl-2d6caab3c51efbf973371684428f83cc5475c01c.tar.gz
Eliminate warnings in File::Basename
./perl -w t/lib/basename.t gives some warnings. p5p-msgid: 11173.9704011111@tempest.cise.npl.co.uk
-rw-r--r--lib/File/Basename.pm2
-rwxr-xr-xt/lib/basename.t1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm
index 0442aed8c5..3ceb10e6c1 100644
--- a/lib/File/Basename.pm
+++ b/lib/File/Basename.pm
@@ -163,7 +163,7 @@ sub fileparse {
}
}
if ($fstype =~ /^MSDOS/i) {
- ($dirpath,$basename) = ($fullname =~ /^(.*[:\\\/])?(.*)/);
+ ($dirpath,$basename) = ($fullname =~ /^((?:.*[:\\\/])?)(.*)/);
$dirpath .= '.\\' unless $dirpath =~ /[\\\/]$/;
}
elsif ($fstype =~ /^MacOS/i) {
diff --git a/t/lib/basename.t b/t/lib/basename.t
index 0f8a117e4c..860b3379b4 100755
--- a/t/lib/basename.t
+++ b/t/lib/basename.t
@@ -51,6 +51,7 @@ print +(dirname('arma:[virumque]cano.trojae') eq 'arma:[virumque]' ?
print +(dirname('arma:<virumque>cano.trojae') eq 'arma:<virumque>' ?
'' : 'not '),"ok 12\n";
print +(dirname('arma:virumque.cano') eq 'arma:' ? '' : 'not '),"ok 13\n";
+$ENV{DEFAULT} = '' unless exists $ENV{DEFAULT};
print +(dirname('virumque.cano') eq $ENV{DEFAULT} ? '' : 'not '),"ok 14\n";
print +(dirname('arma/') eq '.' ? '' : 'not '),"ok 15\n";