Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: orderly global destruction? blessed references gone? XS ok

by patcat88 (Deacon)
on Jul 26, 2011 at 23:09 UTC ( #916872=note: print w/ replies, xml ) Need Help??


in reply to Re: orderly global destruction? blessed references gone? XS ok
in thread orderly global destruction? blessed references gone? XS ok

END { $global = undef; }

That END block is in main/caller's package, not the $global's package. A PM/Class can't control where its instances stored (lex or global). The programmer of the PM doesn't write where the PM is used. Are you suggesting a package weakref list/hash and an END block in the same package in the that destroys all live instances of that package?


Comment on Re^2: orderly global destruction? blessed references gone? XS ok
Re^3: orderly global destruction? blessed references gone? XS ok
by ikegami (Pope) on Jul 27, 2011 at 00:32 UTC

    That END block is in main/caller's package, not the $global's package

    Yes, assuming you mean "ref($global)" by "$global's package".

    Are you suggesting a package weakref list/hash and an END block in the same package in the that destroys all live instances of that package?

    I was suggesting that if you create a global that's creating a problem, that you cleanup the global you created before it creates the problem.

    What you mention could work, but it could also create new instances of the problem you are trying to avoid.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://916872]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-12-18 07:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (44 votes), past polls