in reply to Re^4: panic: attempt to copy freed scalar a7b9650 to ad20598
in thread panic: attempt to copy freed scalar a7b9650 to ad20598
Great! That's an unrelated error that you would need to fix no matter which version of Perl you were using.
You're trying to capturing something, but Perl didn't capture it because it didn't think it needed too. It tries to capture the minimum amount of varaibles.
Note that
is the same astry { ... } catch { ... };
try(sub { ... }, catch(sub { ... }));
The error occurs with eval EXPR:
$ perl -wle' sub f { my $x = "abc"; sub { eval q{"[$x]"} } }; print f()->(); ' Variable "$x" is not available at (eval 1) line 1. Use of uninitialized value in print at -e line 1. []
The workaround is to make sure the sub references the lexical variables you will need in the eval EXPR:
$ perl -wle' sub f { my $x = "abc"; sub { $x if 0; eval q{"[$x]"} } }; print f()->(); ' [abc]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: panic: attempt to copy freed scalar a7b9650 to ad20598
by mje (Curate) on Dec 03, 2009 at 20:44 UTC | |
by runrig (Abbot) on Dec 03, 2009 at 20:49 UTC | |
by ikegami (Patriarch) on Dec 03, 2009 at 21:16 UTC | |
by mje (Curate) on Dec 04, 2009 at 15:57 UTC | |
by ikegami (Patriarch) on Dec 03, 2009 at 21:18 UTC |