in reply to Re^6: is there a way to ensure some code is the last thing that is run? (SUPEREND)
in thread is there a way to ensure some code is the last thing that is run?

But it only works because you know up-front that it's the destructor of a particular class that you need to handle.

A true SUPEREND-feature should work without such knowledge and that is I believe not possible.

  • Comment on Re^7: is there a way to ensure some code is the last thing that is run? (SUPEREND)

Replies are listed 'Best First'.
Re^8: is there a way to ensure some code is the last thing that is run? (SUPEREND)
by LanX (Saint) on Feb 03, 2017 at 15:55 UTC
    > A true SUPEREND-feature should work without such knowledge and that is I believe not possible.

    It is, you can introspect all available packages (look into %main:: ) so far in a loop, check if DESTROY exists and install a wrapper.

    Do you need it?

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      Hm, interesting idea.

      But I suppose the code in SUPEREND could dynamically create a new class with a destructor.

      At that time you've already done your introspection, so this destructor would not have been covered I suppose...

      And no, I don't really need it, I would only be interested if it was possible at all in the most general case...

        I don't understand your problems, but check CPAN I'm sure it already exists somewhere.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!