Subject: | incorrect hash assignment WWW::Bugzilla3 |
Date: | Wed, 3 Oct 2007 16:24:13 +0100 |
To: | bug-www-bugzilla3 [...] rt.cpan.org |
From: | Nicholas Clark <nick [...] ccl4.org> |
I've been looking at lots of CPAN code that uses bless. I happened to spot
this code in WWW::Bugzilla3
sub new($%) {
my ($class, %param) = @_;
%param = { } unless %param;
I belive that this is a bug. {} will create an anonymous hash reference,
which will be assigned as the hash key, with a value of undef. Under warnings
it will generate the error "Reference found where even-sized list expected"
It's not clear to me whether you need that line at all. I guess you meant
%param = () unless %param;
but that is a no-op in that code, so I think that the line should probably be
deleted.
Nicholas Clark