[Melbourne-pm] Closures and scope warnings

Toby Corkindale toby.corkindale at strategicdata.com.au
Tue Jul 27 20:27:56 PDT 2010


Hmm,
here's something that caught me out.. probably because it's not great 
practice. (But it is a common theme in using DBIx::Class transactions)

my $thing;
sub { my $thing = 'wibble' }->();

There is no warning emitted about the second "my $thing" overriding the 
scope of the former one, even though it is.. (Tested on perl 5.10.1 
only, sorry)

A warning would have been nice; it caught me out today when I did it by 
accident.


More information about the Melbourne-pm mailing list