Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^4: Throw from within a DESTROY block

by ribasushi (Monk)
on Sep 07, 2011 at 02:42 UTC ( #924504=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Throw from within a DESTROY block
in thread Throw from within a DESTROY block

Sigh. Given how I explicitly ask "how do I cheat perl here", a non-incendiary answer would be
I am not sure you can do this,
not
<THOUGHTCRIME>perl is not designed to do that, turn around ang go back where you came from!</THOUGHTCRIME>

Thanks for the reply annyway


Comment on Re^4: Throw from within a DESTROY block
Re^5: Throw from within a DESTROY block
by ikegami (Pope) on Sep 07, 2011 at 02:47 UTC

    And one way to cheat is to move the die out of DESTROY, and say, into delete. Do you want cheats, or do you want to be told Perl doesn't do that?

    When I gave you the former, you said it's stupid. When I gave you the latter, you said I'm being inflammatory.

      The inflamatory remark was to an earlier version of the reply you seem to have edited out (something to the effect of "this is not perl")
        yes, I know to what remark you are referring. (It's already been put back, btw)
      When the business logic is tied to "at time of object destruction", there is no practical way to put the code into "delete". See tye's reply for a very good round-up of the DESTROY-based "guard pattern"
        I don't see it. See I nothing practical in tye's reply, just how it should behave.

        Oh, I thought you were saying you could use guard logic to fix your program.

        I was confused because what you are saying is a complete non-sequitor. I didn't say you should always move code out of destructors. I'm well aware of the value of a destructor (and of tye's solution).

        You ask for cheats to solve your particular case, but every time I provide one, you say it won't work in all circumstances. I'll say it again even though you said it was incendiary to say so, but that's not how Perl works.

        If a particular solution doesn't work for your, say why, but don't say it can never work.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (16)
As of 2014-07-28 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (200 votes), past polls