summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-05-15 13:28:26 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-15 13:28:26 +0000
commita1813bef83e5be961acf30502b3938f02b111905 (patch)
tree34f3a433155ba9596cf5d4630a9f36a9437e5d4c
parenta02608dec28d4e964c218e69ee3e39c623232d8d (diff)
downloadperl-a1813bef83e5be961acf30502b3938f02b111905.tar.gz
Upgrade to Switch 2.03.
p4raw-id: //depot/perl@10116
-rw-r--r--lib/Switch.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/Switch.pm b/lib/Switch.pm
index 2a3093c359..910002eb92 100644
--- a/lib/Switch.pm
+++ b/lib/Switch.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw($VERSION);
use Carp;
-$VERSION = '2.02';
+$VERSION = '2.03';
# LOAD FILTERING MODULE...
@@ -24,7 +24,7 @@ sub import
$DB::single = 1;
$fallthrough = grep /\bfallthrough\b/, @_;
$offset = (caller)[2]+1;
- filter_add({}) unless @_>1 && $_[1] ne '__';
+ filter_add({}) unless @_>1 && $_[1] eq 'noimport';
my $pkg = caller;
no strict 'refs';
for ( qw( on_defined on_exists ) )
@@ -182,11 +182,11 @@ sub in
my @numy;
for my $nextx ( @$x )
{
- my $numx = ref($nextx) || (~$nextx&$nextx) eq 0;
+ my $numx = ref($nextx) || defined $nextx && (~$nextx&$nextx) eq 0;
for my $j ( 0..$#$y )
{
my $nexty = $y->[$j];
- push @numy, ref($nexty) || (~$nexty&$nexty) eq 0
+ push @numy, ref($nexty) || defined $nexty && (~$nexty&$nexty) eq 0
if @numy <= $j;
return 1 if $numx && $numy[$j] && $nextx==$nexty
|| $nextx eq $nexty;
@@ -222,12 +222,13 @@ sub switch(;$)
return $s_val->($c_val);
};
}
- elsif ($s_ref eq "" && (~$s_val&$s_val) eq 0) # NUMERIC SCALAR
+ elsif ($s_ref eq "" && defined $s_val && (~$s_val&$s_val) eq 0) # NUMERIC SCALAR
{
$::_S_W_I_T_C_H =
sub { my $c_val = $_[0];
my $c_ref = ref $c_val;
return $s_val == $c_val if $c_ref eq ""
+ && defined $c_val
&& (~$c_val&$c_val) eq 0;
return $s_val eq $c_val if $c_ref eq "";
return in([$s_val],$c_val) if $c_ref eq 'ARRAY';
@@ -454,8 +455,8 @@ Switch - A switch statement for Perl
=head1 VERSION
-This document describes version 2.02 of Switch,
-released April 26, 2001.
+This document describes version 2.03 of Switch,
+released May 15, 2001.
=head1 SYNOPSIS