From: Robin Barker Date: Tue, 1 Apr 1997 11:11:43 +0000 (+0100) Subject: Eliminate warnings in File::Basename X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d6caab3c51efbf973371684428f83cc5475c01c;p=p5sagit%2Fp5-mst-13.2.git Eliminate warnings in File::Basename ./perl -w t/lib/basename.t gives some warnings. p5p-msgid: 11173.9704011111@tempest.cise.npl.co.uk --- diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index 0442aed..3ceb10e 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 0f8a117..860b337 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:cano.trojae') eq 'arma:' ? '' : '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";