Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: if(my) scope

by ikegami (Pope)
on Apr 16, 2009 at 13:51 UTC ( #757986=note: print w/replies, xml ) Need Help??


in reply to Re: if(my) scope
in thread if(my) scope

f the reference count of $h goes to zero, it is automatically freed by perl,

But why does it go to zero where it does.

package H; sub DESTROY { print "DESTROY\n"; } sub new { my $class = shift; bless {}, $class; } { print \$h, "\n"; if(my $h = H->new()) { print \$h, "\n"; } print \$h, "\n"; # <- This references the package var # and would cause a strict error. # Object is no longer accessible. print "why now?\n"; } # <- The object is only destroyed here.
SCALAR(0x1829aac) REF(0x1829abc) SCALAR(0x1829aac) why now? DESTROY

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://757986]
help
Chatterbox?
[Corion]: Discipulus: I think Module::Corelist ( or corelist ) can tell you that
[Corion]: Meh - Module::CoreList
[choroba]: Just use List::Util 1.29
[choroba]: Be kind to people using old Perl with newer version of the module
[Corion]: But why not simply specify 'List::Util' => 1.29 in your prerequisites? People might install a more recent version of the module into their Perl
[Corion]: (what choroba said)
[Discipulus]: ah! simpler and cleaner
[Discipulus]: thanks! use List::Util 1.29 qw(pairmap ... just works!
Discipulus is preparing another of his CUFP..

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2017-05-25 09:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?