diff options
author | Ilya Zakharevich <ilya@math.ohio-state.edu> | 1997-02-20 21:07:30 -0500 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-02-22 04:41:00 +1200 |
commit | 2724d5068a405436d3f2cd00aeb8f7b460b24fec (patch) | |
tree | fe9647d0667cdcaf1e489e91490949883e066aac | |
parent | 7d0742d84411135caaa356cb76d4e5f4fdbeb13a (diff) | |
download | perl-2724d5068a405436d3f2cd00aeb8f7b460b24fec.tar.gz |
Avoid $` $& $' in libraries
Subject: Pessimal $` $& $' in libraries
Corrected:
lib/diagnostics.pm
lib/Getopt/Long.pm
lib/Pod/Text.pm
os2/OS2/REXX/REXX.pm
$' $` $& eliminated from all the known *.pm.
Btw, by this I proudly introduce usage of $+ in standard perl modules ;-).
p5p-msgid: <199702210207.VAA03560@monk.mps.ohio-state.edu>
-rw-r--r-- | lib/Getopt/Long.pm | 14 | ||||
-rw-r--r-- | lib/Pod/Text.pm | 10 | ||||
-rw-r--r-- | lib/diagnostics.pm | 2 | ||||
-rw-r--r-- | os2/OS2/REXX/REXX.pm | 6 |
4 files changed, 16 insertions, 16 deletions
diff --git a/lib/Getopt/Long.pm b/lib/Getopt/Long.pm index f2b37e917f..fa6d5bfb11 100644 --- a/lib/Getopt/Long.pm +++ b/lib/Getopt/Long.pm @@ -566,7 +566,7 @@ sub GetOptions { my $opt = shift (@optionlist); # Strip leading prefix so people can specify "--foo=i" if they like. - $opt = $' if $opt =~ /^($genprefix)+/; + $opt = $+ if $opt =~ /^($genprefix)+(.*)/s; if ( $opt eq '<>' ) { if ( (defined $userlinkage) @@ -854,19 +854,19 @@ sub GetOptions { sub find_option { - return 0 unless $opt =~ /^$genprefix/; + return 0 unless $opt =~ /^($genprefix)(.*)/s; - $opt = $'; - my ($starter) = $&; + $opt = $+; + my ($starter) = $1; my $optarg = undef; # value supplied with --opt=value my $rest = undef; # remainder from unbundling # If it is a long option, it may include the value. if (($starter eq "--" || $getopt_compat) - && $opt =~ /^([^=]+)=/ ) { + && $opt =~ /^([^=]+)=(.*)/s ) { $opt = $1; - $optarg = $'; + $optarg = $2; print STDERR ("=> option \"", $opt, "\", optarg = \"$optarg\"\n") if $debug; } @@ -992,7 +992,7 @@ sub find_option { # Get key if this is a "name=value" pair for a hash option. $key = undef; if ($hash && defined $arg) { - ($key, $arg) = ($arg =~ /=/o) ? ($`, $') : ($arg, 1); + ($key, $arg) = ($arg =~ /(.*?)=(.*)/s) ? ($1, $2) : ($arg, 1); } #### Check if the argument is valid for this option #### diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm index 9d6636a82f..c62e51542d 100644 --- a/lib/Pod/Text.pm +++ b/lib/Pod/Text.pm @@ -116,18 +116,18 @@ POD_DIRECTIVE: while (<IN>) { next; } - if (/^=for\s+(\S+)\s*/s) { + if (/^=for\s+(\S+)\s*(.*)/s) { if ($1 eq "text") { - print STDOUT $',""; + print STDOUT $2,""; } else { # ignore unknown for } next; } - elsif (/^=begin\s+(\S+)\s*/s) { + elsif (/^=begin\s+(\S+)\s*(.*)/s) { $begun = $1; if ($1 eq "text") { - print STDOUT $'.""; + print STDOUT $2.""; } next; } @@ -409,7 +409,7 @@ sub clear_noremap { defined $HTML_Escapes{$3} ? do { $HTML_Escapes{$3} } : do { - warn "Unknown escape: $& in $_"; + warn "Unknown escape: E<$1> in $_"; "E<$1>"; } } diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index bbae58e12b..0aa5b54195 100644 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -500,7 +500,7 @@ sub unescape { exists $HTML_Escapes{$1} ? do { $HTML_Escapes{$1} } : do { - warn "Unknown escape: $& in $_"; + warn "Unknown escape: E<$1> in $_"; "E<$1>"; } } diff --git a/os2/OS2/REXX/REXX.pm b/os2/OS2/REXX/REXX.pm index 78e0cf917d..114e1592c4 100644 --- a/os2/OS2/REXX/REXX.pm +++ b/os2/OS2/REXX/REXX.pm @@ -107,21 +107,21 @@ sub dropall sub TIESCALAR { my ($obj, $name) = @_; - $name =~ s/^[\w!?]+/\U$&\E/; + $name =~ s/^([\w!?]+)/\U$1\E/; return bless \$name, OS2::REXX::_SCALAR; } sub TIEARRAY { my ($obj, $name) = @_; - $name =~ s/^[\w!?]+/\U$&\E/; + $name =~ s/^([\w!?]+)/\U$1\E/; return bless [$name, 0], OS2::REXX::_ARRAY; } sub TIEHASH { my ($obj, $name) = @_; - $name =~ s/^[\w!?]+/\U$&\E/; + $name =~ s/^([\w!?]+)/\U$1\E/; return bless {Stem => $name}, OS2::REXX::_HASH; } |