From: Gurusamy Sarathy Date: Sun, 1 Aug 1999 18:34:41 +0000 (+0000) Subject: fix defined(@foo) encarpments X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=475342a6d5f74335e2bdfa64bd71f39289320205;p=p5sagit%2Fp5-mst-13.2.git fix defined(@foo) encarpments p4raw-id: //depot/perl@3848 --- diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index dd4db03..39a78c9 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -1207,7 +1207,7 @@ sub mark_package { no strict 'refs'; $unused_sub_packages{$package} = 1; - if (defined(@{$package.'::ISA'})) + if (@{$package.'::ISA'}) { foreach my $isa (@{$package.'::ISA'}) { diff --git a/lib/CGI.pm b/lib/CGI.pm index b131926..c0cb5fd 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -355,7 +355,7 @@ sub init { # if we get called more than once, we want to initialize # ourselves from the original query (which may be gone # if it was read from STDIN originally.) - if (defined(@QUERY_PARAM) && !defined($initializer)) { + if (@QUERY_PARAM && !defined($initializer)) { foreach (@QUERY_PARAM) { $self->param('-name'=>$_,'-value'=>$QUERY_PARAM{$_}); } @@ -841,7 +841,7 @@ END_OF_FUNC sub keywords { my($self,@values) = self_or_default(@_); # If values is provided, then we set it. - $self->{'keywords'}=[@values] if defined(@values); + $self->{'keywords'}=[@values] if @values; my(@result) = defined($self->{'keywords'}) ? @{$self->{'keywords'}} : (); @result; } @@ -1906,14 +1906,14 @@ sub _tableize { # rearrange into a pretty table $result = ""; my($row,$column); - unshift(@$colheaders,'') if defined(@$colheaders) && defined(@$rowheaders); - $result .= "" if defined(@{$colheaders}); + unshift(@$colheaders,'') if @$colheaders && @$rowheaders; + $result .= "" if @$colheaders; foreach (@{$colheaders}) { $result .= ""; } for ($row=0;$row<$rows;$row++) { $result .= ""; - $result .= "" if defined(@$rowheaders); + $result .= "" if @$rowheaders; for ($column=0;$column<$columns;$column++) { $result .= "" if defined($elements[$column*$rows + $row]); diff --git a/lib/Dumpvalue.pm b/lib/Dumpvalue.pm index 9c596ff..22a10af 100644 --- a/lib/Dumpvalue.pm +++ b/lib/Dumpvalue.pm @@ -91,7 +91,7 @@ sub stringify { { no strict 'refs'; $_ = &{'overload::StrVal'}($_) if $self->{bareStringify} and ref $_ - and defined %overload:: and defined &{'overload::StrVal'}; + and %overload:: and defined &{'overload::StrVal'}; } if ($tick eq 'auto') { @@ -162,7 +162,7 @@ sub unwrap { my $val = $v; { no strict 'refs'; $val = &{'overload::StrVal'}($v) - if defined %overload:: and defined &{'overload::StrVal'}; + if %overload:: and defined &{'overload::StrVal'}; } ($address) = $val =~ /(0x[0-9a-f]+)\)$/ ; if (!$self->{dumpReused} && defined $address) { @@ -324,12 +324,12 @@ sub dumpglob { print( (' ' x $off) . "\$", &unctrl($key), " = " ); $self->DumpElem($stab, 3+$off); } - if (($key !~ /^_{dumpDBFiles}) and defined @stab) { + if (($key !~ /^_{dumpDBFiles}) and @stab) { print( (' ' x $off) . "\@$key = (\n" ); $self->unwrap(\@stab,3+$off) ; print( (' ' x $off) . ")\n" ); } - if ($key ne "main::" && $key ne "DB::" && defined %stab + if ($key ne "main::" && $key ne "DB::" && %stab && ($self->{dumpPackages} or $key !~ /::$/) && ($key !~ /^_{dumpDBFiles}) && !($package eq "Dumpvalue" and $key eq "stab")) { @@ -361,7 +361,7 @@ sub dumpsub { sub findsubs { my $self = shift; - return undef unless defined %DB::sub; + return undef unless %DB::sub; my ($addr, $name, $loc); while (($name, $loc) = each %DB::sub) { $addr = \&$name; @@ -444,9 +444,9 @@ sub globUsage { # glob ref, name local *stab = *{$_[0]}; my $total = 0; $total += $self->scalarUsage($stab) if defined $stab; - $total += $self->arrayUsage(\@stab, $_[1]) if defined @stab; + $total += $self->arrayUsage(\@stab, $_[1]) if @stab; $total += $self->hashUsage(\%stab, $_[1]) - if defined %stab and $_[1] ne "main::" and $_[1] ne "DB::"; + if %stab and $_[1] ne "main::" and $_[1] ne "DB::"; #and !($package eq "Dumpvalue" and $key eq "stab")); $total; } diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl index fb0bb23..f473c45 100644 --- a/lib/dumpvar.pl +++ b/lib/dumpvar.pl @@ -53,7 +53,7 @@ sub stringify { return $_ . "" if ref \$_ eq 'GLOB'; $_ = &{'overload::StrVal'}($_) if $bareStringify and ref $_ - and defined %overload:: and defined &{'overload::StrVal'}; + and %overload:: and defined &{'overload::StrVal'}; if ($tick eq 'auto') { if (/[\000-\011\013-\037\177]/) { @@ -125,7 +125,7 @@ sub unwrap { if (ref $v) { my $val = $v; $val = &{'overload::StrVal'}($v) - if defined %overload:: and defined &{'overload::StrVal'}; + if %overload:: and defined &{'overload::StrVal'}; ($address) = $val =~ /(0x[0-9a-f]+)\)$/ ; if (!$dumpReused && defined $address) { $address{$address}++ ; @@ -289,12 +289,12 @@ sub dumpglob { print( (' ' x $off) . "\$", &unctrl($key), " = " ); DumpElem $entry, 3+$off; } - if (($key !~ /^_
$_
$rowheaders->[$row]$rowheaders->[$row]" . $elements[$column*$rows + $row] . "