Skip to content

Commit

Permalink
Avoid $` $& $' in libraries
Browse files Browse the repository at this point in the history
(this is the same change as commit 2724d50, but as applied)
  • Loading branch information
Chip Salzenberg committed Feb 21, 1997
1 parent 7d0742d commit f02a87d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
18 changes: 9 additions & 9 deletions lib/Getopt/Long.pm
Expand Up @@ -14,7 +14,7 @@ require Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(&GetOptions $REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER);
$VERSION = sprintf("%d.%02d", '$Revision: 2.6 $ ' =~ /(\d+)\.(\d+)/);
$VERSION = sprintf("%d.%02d", '$Revision: 2.6001 $ ' =~ /(\d+)\.(\d+)/);
use vars qw($autoabbrev $getopt_compat $ignorecase $bundling $order
$passthrough $error $debug
$REQUIRE_ORDER $PERMUTE $RETURN_IN_ORDER
Expand Down Expand Up @@ -530,7 +530,7 @@ sub GetOptions {
# than once in differing environments
$error = 0;

print STDERR ('GetOptions $Revision: 2.6 $ ',
print STDERR ('GetOptions $Revision: 2.6001 $ ',
"[GetOpt::Long $Getopt::Long::VERSION] -- ",
"called from package \"$pkg\".\n",
" (@ARGV)\n",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 ####
Expand Down
15 changes: 8 additions & 7 deletions lib/Pod/Text.pm
@@ -1,7 +1,5 @@
package Pod::Text;

# Version 1.02

=head1 NAME
Pod::Text - convert POD data to formatted ASCII text
Expand Down Expand Up @@ -49,6 +47,9 @@ require Exporter;
@ISA = Exporter;
@EXPORT = qw(pod2text);

use vars qw($VERSION);
$VERSION = "1.0201";

$termcap=0;

#$use_format=1;
Expand Down Expand Up @@ -116,18 +117,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;
}
Expand Down Expand Up @@ -409,7 +410,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>";
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/diagnostics.pm
Expand Up @@ -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>";
}
}
Expand Down
6 changes: 3 additions & 3 deletions os2/OS2/REXX/REXX.pm
Expand Up @@ -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;
}

Expand Down

0 comments on commit f02a87d

Please sign in to comment.