[Wellington-pm] How to cure "variable will not stay shared?
srdjan at catalyst.net.nz
Thu Nov 3 16:08:38 PDT 2011
-----BEGIN PGP SIGNED MESSAGE-----
On 04/11/11 08:35, Lesley Longhurst wrote:
> Hi mongers,
> So, I'm looking at some nasty legacy code left behind by Mordac. I
added "use warnings; use diagnostics" and got a pile of these warnings.
>From what I've read so far, it seems that they are caused by a
subroutine being defined inside a subroutine. The diagnostics text
suggests making the inner subroutine anonymous, but I don't think that's
going to work because it's called by name many times.
> Am I likely to make matters worse if I just take the inner sub and move
it outside the outer sub? Most of the variables are defined without "my"
and there is no other sub with the same name.
Not likely. It is being called from outside of the outer sub scope
anyway, but it should not matter, I think that inner subs vars do not
take outer sub scope anyway. Can anyone confirm this?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the Wellington-pm