New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
warnings::warn($obj,...) fails when $obj overloads "" #7522
Comments
From kaminsky@math.huji.ac.ilCreated by kaminsky@math.huji.ac.ilWhan using the syntax warnings::warn($obj, $msg) Where $obj is an object with overloaded stringification, the call Thanks, PS: It might be useful to include in the docs of this module that The example: #!/usr/bin/perl sub new { package main; new Foo; ##### End of example ###### The patch, against warnings.pl (but can also be applied to warnings.pm) Inline Patch--- warnings.pl.old 2004-10-05 10:10:42.104221096 +0200
+++ warnings.pl 2004-10-05 10:23:29.910496800 +0200
@@ -708,6 +708,10 @@
${^WARNING_BITS} = $mask ;
}
+{
+
+my %builtin_type = map { $_ => 1 } qw(SCALAR ARRAY HASH CODE REF GLOB LVALUE);
+
sub __chk
{
my $category ;
@@ -717,10 +721,10 @@
if (@_) {
# check the category supplied.
$category = shift ;
- if (ref $category) {
+ if (my $type = ref $category) {
Croaker ("not an object")
- if $category !~ /^([^=]+)=/ ;
- $category = $1 ;
+ if $builtin_type{$type};
+ $category = $type;
$isobj = 1 ;
}
$offset = $Offsets{$category};
@@ -755,6 +759,7 @@
my $callers_bitmask = (caller($i))[9] ;
return ($callers_bitmask, $offset, $i) ;
}
+}
sub enabled
{ Perl Info
|
From @rgskaminsky (via RT) wrote:
Thanks, applied as change #23361 to bleadperl, with a few tweaks.
Notably you forgot "Regexp" in the list above. |
The RT System itself - Status changed from 'new' to 'open' |
@rgs - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#31843 (status was 'resolved')
Searchable as RT31843$
The text was updated successfully, but these errors were encountered: