Using lexical variables or explicitly releasing references seems to fix the problem which suggests it's related to destruction order of package variables. Consider:
$perldata = bless {hello => 'world'}, 'superman'; $bar = test($perldata); $baz = test($perldata); my $foo = test($perldata); $baz = undef; sub test { my $o = shift; print "test: $o\n"; my $m = bless {perldata => $o}, 'TQIS::test'; return $m; } sub TQIS::test::DESTROY { my $self = shift; warn $self->{perldata}; }
Prints:
superman=HASH(0x182b3dc) at noname2.pl line 18. test: superman=HASH(0x182b3dc) superman=HASH(0x182b3dc) at noname2.pl line 18. Warning: something's wrong at noname2.pl line 18 during global destruc +tion. test: superman=HASH(0x182b3dc) test: superman=HASH(0x182b3dc)
Note that the "Warning: something's wrong at " text seems to get clobbered depending on things like the specific order if the ... = test lines!
In reply to Re: use Switch wierdness
by GrandFather
in thread use Switch wierdness
by tqisjim
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |