CC: | Stephan Struckmann <struckma [...] uni-greifswald.de> |
Subject: | A small bug in Attribute::Signature |
Date: | Fri, 11 Jan 2008 15:13:01 +0100 |
To: | bug-Attribute-Signature [...] rt.cpan.org |
From: | Stephan Struckmann <struckma [...] uni-greifswald.de> |
Dear James,
unfortunately I have found a bug in your great Attribute::Signature perl
module from CPAN (Version 1.02, downloaded January, 11th 2008). In line 68
in Signature.pm you write:
} elsif ((blessed($_[$i]) || string($_[$i])) && $_[$i]->isa( $data->[$i]) )
{
which should be
} elsif ((blessed($_[$i]) || Attribute::Signature->string($_[$i])) &&
$_[$i]->isa( $data->[$i]) ) {
because the sub "string" expects the class name as its first attribute. In
the current version, perl reports:
Can't call method "isa" on unblessed reference at
/usr/lib/perl5/site_perl/5.8.8/Attribute/Signature.pm line 60.
if signature for some sub contains HASH or ARRAY. The following code
demonstrates the error:
------------------------------
use Attribute::Signature;
sub somesub : with(HASH) {
# .. do something ..
}
somesub({2=>3}) ;
-----------------------------
This produces the error message above, because the code fails checking, if
it is blessed or a string (so maybe a class name): Calling string without
prepending Attribute::Signature-> causes first parameter is missing (and
thus misinterpreted as class name "Attribute::Signature"), so the checked
second parameter is will be undef, which is not a ref and thus a string in
the sense, string recognizes strings.
I hope, you understood my explanation and maybe fix the error. Thank you
very much,
Greetings from Germany,
Stephan Struckmann
--------------------------------------
Institut für Mathematik und Informatik
E.-M.-A.-Universität Greifswald
Message body not shown because it is not plain text.