in reply to (tye)Re: $obj-DESTROY isn't called upon
in thread $obj-DESTROY isn't called upon

>Um, all instances of perl under Unix are instantiated
>using exec(). DESTROY doesn't get called if you script
>goes away because of a successful exec. How perl was
>started doesn't matter.
That is not completely true. If you'd do `exec perl -e 'print "hello world\"'` on your shell, then the shell will be thrown away and be replaced with the perl interpreter. It wont return either...

Sinister greetings.
"With tying hashes you can do everything God and Larry have forbidden" -- Johan Vromans - YAPC::Europe 2001
perldoc -q $_
  • Comment on Re: (tye)Re: $obj-DESTROY isn't called upon

Replies are listed 'Best First'.
(tye)Re2: $obj-DESTROY isn't called upon
by tye (Sage) on Jan 31, 2002 at 17:14 UTC

    But that doesn't change whether DESTROY is called:

    $ perl -e "sub DESTROY{warn'dead'}\$x=bless{};" dead during global destruction. $ exec perl -e "sub DESTROY{warn'dead'}\$x=bless{};" dead during global destruction.

    BTW, in both of the cases above, perl is launched by using exec() [the subroutine from the C run-time library that wraps the kernel hook (or "system call")]. The difference is that the shell's "exec" command avoids the fork() before the exec().

            - tye (but my friends call me "Tye")