From 14a089c51ea6b2fce5bd014173040a53a4fe588c Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Wed, 1 Mar 2000 16:55:47 +0000 Subject: [PATCH] more multiline match cleanups (from Greg Bacon) p4raw-id: //depot/perl@5403 --- lib/AutoLoader.pm | 6 +++--- lib/AutoSplit.pm | 12 ++++++------ lib/CGI/Carp.pm | 4 ++-- lib/File/Spec/Mac.pm | 4 ++-- lib/File/Spec/VMS.pm | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/AutoLoader.pm b/lib/AutoLoader.pm index d62ceb0..8fd7d3b 100644 --- a/lib/AutoLoader.pm +++ b/lib/AutoLoader.pm @@ -36,7 +36,7 @@ AUTOLOAD { my ($pkg,$func) = ($sub =~ /(.*)::([^:]+)$/); $pkg =~ s#::#/#g; if (defined($filename = $INC{"$pkg.pm"})) { - $filename =~ s#^(.*)$pkg\.pm$#$1auto/$pkg/$func.al#; + $filename =~ s#^(.*)$pkg\.pm\z#$1auto/$pkg/$func.al#s; # if the file exists, then make sure that it is a # a fully anchored path (i.e either '/usr/lib/auto/foo/bar.al', @@ -45,9 +45,9 @@ AUTOLOAD { # looked for 'lib/lib/auto/foo/bar.al', given @INC = ('lib'). if (-r $filename) { - unless ($filename =~ m|^/|) { + unless ($filename =~ m|^/|s) { if ($is_dosish) { - unless ($filename =~ m{^([a-z]:)?[\\/]}i) { + unless ($filename =~ m{^([a-z]:)?[\\/]}is) { $filename = "./$filename"; } } diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index 41d5489..ecdb039 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -175,10 +175,10 @@ sub autosplit_lib_modules{ while(defined($_ = shift @modules)){ s#::#/#g; # incase specified as ABC::XYZ s|\\|/|g; # bug in ksh OS/2 - s#^lib/##; # incase specified as lib/*.pm + s#^lib/##s; # incase specified as lib/*.pm if ($Is_VMS && /[:>\]]/) { # may need to convert VMS-style filespecs - my ($dir,$name) = (/(.*])(.*)/); - $dir =~ s/.*lib[\.\]]//; + my ($dir,$name) = (/(.*])(.*)/s); + $dir =~ s/.*lib[\.\]]//s; $dir =~ s#[\.\]]#/#g; $_ = $dir . $name; } @@ -201,7 +201,7 @@ sub autosplit_file { # where to write output files $autodir ||= "lib/auto"; if ($Is_VMS) { - ($autodir = VMS::Filespec::unixpath($autodir)) =~ s|/$||; + ($autodir = VMS::Filespec::unixpath($autodir)) =~ s|/\z||; $filename = VMS::Filespec::unixify($filename); # may have dirs } unless (-d $autodir){ @@ -215,7 +215,7 @@ sub autosplit_file { } # allow just a package name to be used - $filename .= ".pm" unless ($filename =~ m/\.pm$/); + $filename .= ".pm" unless ($filename =~ m/\.pm\z/); open(IN, "<$filename") or die "AutoSplit: Can't open $filename: $!\n"; my($pm_mod_time) = (stat($filename))[9]; @@ -378,7 +378,7 @@ EOT for my $dir (keys %outdirs) { opendir(OUTDIR,$dir); foreach (sort readdir(OUTDIR)){ - next unless /\.al$/; + next unless /\.al\z/; my($file) = "$dir/$_"; $file = lc $file if $Is83 or $Is_VMS; next if $outfiles{$file}; diff --git a/lib/CGI/Carp.pm b/lib/CGI/Carp.pm index 8425fa0..90e9552 100644 --- a/lib/CGI/Carp.pm +++ b/lib/CGI/Carp.pm @@ -223,7 +223,7 @@ sub realdie { CORE::die(@_); } sub id { my $level = shift; my($pack,$file,$line,$sub) = caller($level); - my($id) = $file=~m|([^/]+)$|; + my($id) = $file=~m|([^/]+)\z|; return ($file,$line,$id); } @@ -235,7 +235,7 @@ sub stamp { $id = $file; ($pack,$file) = caller($frame++); } until !$file; - ($id) = $id=~m|([^/]+)$|; + ($id) = $id=~m|([^/]+)\z|; return "[$time] $id: "; } diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm index 22682f9..be9a43c 100644 --- a/lib/File/Spec/Mac.pm +++ b/lib/File/Spec/Mac.pm @@ -150,7 +150,7 @@ sub rootdir { require Mac::Files; my $system = Mac::Files::FindFolder(&Mac::Files::kOnSystemDisk, &Mac::Files::kSystemFolderType); - $system =~ s/:.*\z/:/; + $system =~ s/:.*\z/:/s; return $system; } @@ -228,7 +228,7 @@ sub splitpath { my ($volume,$directory,$file) = ('','',''); if ( $nofile ) { - ( $volume, $directory ) = $path =~ m@((?:[^:]+(?::|\z))?)(.*)@; + ( $volume, $directory ) = $path =~ m@((?:[^:]+(?::|\z))?)(.*)@s; } else { $path =~ diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm index 1a0330a..52519b9 100644 --- a/lib/File/Spec/VMS.pm +++ b/lib/File/Spec/VMS.pm @@ -41,7 +41,7 @@ sub eliminate_macros { my($head,$macro,$tail); # perform m##g in scalar context so it acts as an iterator - while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#g) { + while ($npath =~ m#(.*?)\$\((\S+?)\)(.*)#gs) { if ($self->{$2}) { ($head,$macro,$tail) = ($1,$2,$3); if (ref $self->{$macro}) { @@ -59,7 +59,7 @@ sub eliminate_macros { $npath = "$head$macro$tail"; } } - if ($complex) { $npath =~ s#\cB(.*?)\cB#\${$1}#g; } + if ($complex) { $npath =~ s#\cB(.*?)\cB#\${$1}#gs; } $npath; } @@ -135,7 +135,7 @@ sub canonpath { my($self,$path,$reduce_ricochet) = @_; if ($path =~ m|/|) { # Fake Unix - my $pathify = $path =~ m|/$|; + my $pathify = $path =~ m|/\z|; $path = $self->SUPER::canonpath($path,$reduce_ricochet); if ($pathify) { return vmspath($path); } else { return vmsify($path); } @@ -165,7 +165,7 @@ sub catdir { if (@dirs) { my $path = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs)); my ($spath,$sdir) = ($path,$dir); - $spath =~ s/.dir\z//; $sdir =~ s/.dir\z//; + $spath =~ s/\.dir\z//; $sdir =~ s/\.dir\z//; $sdir = $self->eliminate_macros($sdir) unless $sdir =~ /^[\w\-]+\z/s; $rslt = $self->fixpath($self->eliminate_macros($spath)."/$sdir",1); @@ -197,7 +197,7 @@ sub catfile { if (@files) { my $path = (@files == 1 ? $files[0] : $self->catdir(@files)); my $spath = $path; - $spath =~ s/.dir\z//; + $spath =~ s/\.dir\z//; if ($spath =~ /^[^\)\]\/:>]+\)\z/s && basename($file) eq $file) { $rslt = "$spath$file"; } @@ -349,7 +349,7 @@ Construct a complete filespec using VMS syntax sub catpath { my($self,$dev,$dir,$file) = @_; if ($dev =~ m|^/+([^/]+)|) { $dev =~ "$1:"; } - else { $dev .= ':' unless $dev eq '' or $dev =~ /:$/; } + else { $dev .= ':' unless $dev eq '' or $dev =~ /:\z/; } $dir = vmspath($dir); "$dev$dir$file"; } @@ -377,7 +377,7 @@ sub splitpath { if ( $path =~ m{/} ) { $path =~ m{^ ( (?: /[^/]* )? ) - ( (?: .*/(?:[^/]+.dir)? )? ) + ( (?: .*/(?:[^/]+\.dir)? )? ) (.*) }xs; $volume = $1; -- 2.7.4