[sf-perl] Use of uninitialized value in delete

Bill Moseley moseley at hank.org
Sat Oct 20 17:08:38 PDT 2012

Thans for looking at this.

On Sat, Oct 20, 2012 at 9:32 AM, Kevin Goess <cpan at goess.org> wrote:

> It looks to me like that warning comes if the *key* you're trying to
> delete is an uninitialized value, not the hash slot.

Yes, it does.  But I'm not using a scalar variable as my key:

     delete $c->stash->{foo};

"foo" is not a constant or a sub name in that package.  And even if it was
I still don't see the error.

$ perl -Mstrict -Mwarnings -wle 'sub foo () { return 123 };  print foo; my
%hash; delete $hash{foo}'

$ perl -Mstrict -Mwarnings -wle 'sub foo () { return undef };  print foo;
my %hash; delete $hash{foo}'
Use of uninitialized value in print at -e line 1.

I'll dig into this more.  One odd thing is in the logs I see this warning
in groups of five, which doesn't make much sense at this moment.  I need to
gather more debugging date from the developer that's seeing this.


Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20121020/03ff0739/attachment.html>

More information about the SanFrancisco-pm mailing list