diff options
author | kaminsky@math.huji.ac.il <kaminsky@math.huji.ac.il> | 2004-10-05 09:52:07 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-10-12 16:07:54 +0000 |
commit | 9df0f64f445f30276560fec596914dd510e244e9 (patch) | |
tree | bb752d66ed9c7c2d70119b6f6b14bdd45a39a139 /lib/warnings.pm | |
parent | d2b2597412218806baa0430cf97cc8334ac3ec71 (diff) | |
download | perl-9df0f64f445f30276560fec596914dd510e244e9.tar.gz |
[perl #31843] warnings::warn($obj,...) fails when $obj overloads ""
From: kaminsky@math.huji.ac.il (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.0.11-31843-97358.2.89612012687236@perl.org>
(with tweaks)
p4raw-id: //depot/perl@23361
Diffstat (limited to 'lib/warnings.pm')
-rw-r--r-- | lib/warnings.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/warnings.pm b/lib/warnings.pm index 656b7ac491..32f020eb94 100644 --- a/lib/warnings.pm +++ b/lib/warnings.pm @@ -402,6 +402,8 @@ sub unimport ${^WARNING_BITS} = $mask ; } +my %builtin_type; @builtin_type{qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE Regexp)} = (); + sub __chk { my $category ; @@ -411,10 +413,10 @@ sub __chk if (@_) { # check the category supplied. $category = shift ; - if (ref $category) { - Croaker ("not an object") - if $category !~ /^([^=]+)=/ ; - $category = $1 ; + if (my $type = ref $category) { + Croaker("not an object") + if exists $builtin_type{$type}; + $category = $type; $isobj = 1 ; } $offset = $Offsets{$category}; |