in reply to Re^5: 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?

> and the destructor of that would again run later.

? That is how it works!

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

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

Replies are listed 'Best First'.
Re^7: is there a way to ensure some code is the last thing that is run? (SUPEREND)
by morgon (Priest) on Feb 03, 2017 at 15:50 UTC
    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.

      > 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...