I have a closure with 3 subs in it, something like this:
The script compiles and runs with no warnings or errors, and appears to "do the right thing".use strict; use warnings; { # closure my %foo; sub collect_it { my ($key, $value) = @_; $foo{$key} = $value; } sub print_it { for my $key ( keys %foo ) { print "\$foo{$key} = $foo{$key}\n"; } clear_it(); } sub clear_it { %foo = (); } } # end closure
However, some of my users want a PAR executable. When making the PAR executable (pp -z 9 -c script.pl), I get errors for all of the enclosed lexicals:
...where line "123" is a line in "script.pl" that references %foo.Variable "%foo" will not stay shared at 60oehl line 123.
From my reading I see that this error comes up in Perl when using nested named subs, which isn't the case here.
The only thing I can think of is that PAR is somehow wrapping my whole script, which then triggers the sharing warning message under "-c".
I've tried to reproduce this with a smaller script, but had no luck yet. (The original script is 1000+ lines.) I'm also wondering if the "\$foo{$key}" confuses the compiler into thinking that's a reference?
Any hints?
-QM
--
Quantum Mechanics: The dreams stuff is made of
In reply to PAR: Variable %x will not stay shared by QM
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |