Re: [Catalyst] Use of uninitialized value in delete

2013-01-28 Thread Bill Moseley
On Mon, Oct 29, 2012 at 3:45 AM, Will Crawford
wrote:

> On 19 October 2012 18:37, Bill Moseley  wrote:
> > delete $c->stash->{foo};
>
> Is there a function / method called "foo" anywhere in scope?
>

I've ignored this for a while, but still seeing in the app's logs.

No, there's no function foo defined.

Another thing that is odd is I have a $SIG{__WARN__} handler and all other
warning are caught by that but not the "Use of uninitialized value in
delete".

This machine is running 5.10.1 -- maybe it's related to that version of
Perl.

-- 
Bill Moseley
mose...@hank.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Use of uninitialized value in delete

2012-10-29 Thread Will Crawford
On 19 October 2012 18:37, Bill Moseley  wrote:
> delete $c->stash->{foo};

Is there a function / method called "foo" anywhere in scope?

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Use of uninitialized value in delete

2012-10-28 Thread Lars Balker
On Fri, Oct 19, 2012 at 7:37 PM, Bill Moseley  wrote:
> In server logs I'm seeing this warnings:
>
> Use of uninitialized value in delete
>
>
> with a line number pointing to this line:
>
> delete $c->stash->{foo};

Is that the literal error-message and code?

% perl -e 'use strict; use warnings; my %foo; my $bar; delete $foo{$bar}'
Use of uninitialized value $bar in delete at -e line 1.
% perl -e 'use strict; use warnings; my %foo; delete $foo{undef()}'
Use of uninitialized value in delete at -e line 1.
% perl -e 'use strict; use warnings; my %foo; sub foo { undef } delete
$foo{foo()}'
Use of uninitialized value in delete at -e line 1.

(perl 5.16.0)

As for stash, it's just a Moose-attribute returning a hashref.
-- 
Lars Balker  Consult::Perl

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Use of uninitialized value in delete

2012-10-28 Thread Bill Moseley
On Sat, Oct 27, 2012 at 9:34 PM, Larry Leszczynski wrote:

> 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 = bless {}, "Foo";  delete
$s->stash->{bar}'


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


-- 
Bill Moseley
mose...@hank.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Use of uninitialized value in delete

2012-10-27 Thread Larry Leszczynski
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?


Larry

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Use of uninitialized value in delete

2012-10-19 Thread Bill Moseley
Sorry for the duplicate if you are on the SF Perl list.


In server logs I'm seeing this warnings:

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, and I can't seem to make it
happen:
 $ perl -Mwarnings -Mstrict -Wle 'use warnings; use strict; my $x = {};
delete $x->{a}'

Is there something special about $c->stash that might trigger this in Perl?
Anyone else spot these in the logs.


This is on Perl 5.14.2 / Catalyst 5.90016 / mod_perl 2.0.7

-- 
Bill Moseley
mose...@hank.org
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/