Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
(With all the caveats of local and symboltable hacking, of course.)
The main problem I see with this approach is that it doesn't behave the way we would expect a true lexical sub too. For example, I would expect the following to work:
Of course that won't work with the local trick since you can't have a lexical closure over a locally modified symbol table (as far as I know.) But it would work fine if you used my $bar = sub { print "42\n" }. I suppose a source filter to convert my sub bar { } to my $bar = sub { } would do the trick, but then you'd have to scan the rest of the block to change bar to $bar->(). Sounds like a real PITA. In reply to Re^2: Isn't Perl5 ready for C<my sub>?
by friedo
|
|