[Catalyst] Use of uninitialized value in delete

Bill Moseley moseley at hank.org
Sun Oct 28 21:29:27 GMT 2012


On Sat, Oct 27, 2012 at 9:34 PM, Larry Leszczynski <larryl at emailplus.org>wr=
ote:

> Hi Bill -
>
> On Fri, Oct 19, 2012, at 11:37 AM, Bill Moseley wrote:
>
> > Use of uninitialized value in delete
> >
> > with a line number pointing to this line:
> >
> > delete $c->stash->{foo};
> >
> > I didn't think that delete() issued a warning,
>
> Are both $c and $c->stash defined at that point?
>

Those would be different errors in Perl:

$ perl -wle 'my $c; $c->foo'
Can't call method "foo" on an undefined value at -e line 1.


$ perl -wle 'sub Foo::stash { return {} }; $s =3D bless {}, "Foo";  delete
$s->stash->{bar}'


$ perl -wle 'sub Foo::stash { undef }; $s =3D bless {}, "Foo";  delete
$s->stash->{bar}'
Can't use an undefined value as a HASH reference at -e line 1.


-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20121028/a89f4=
d21/attachment.htm


More information about the Catalyst mailing list