in reply to Is possible to force the execution of a END block at runtime, without need to start global destruction?

Surely you can put whatever actions you need done at END time into a subroutine and call that subroutine manually whenever you like (in addition to from within an END block)

I'm not sure what you mean by "and to do things right I need to call END". If this thought occurs to you, it's a sign of design error on your part and you need to rethink your design IMHO

  • Comment on Re: Is possible to force the execution of a END block at runtime, without need to start global destruction?

Replies are listed 'Best First'.
Re: Re: Is possible to force the execution of a END block at runtime, without need to start global destruction?
by gmpassos (Priest) on May 21, 2004 at 04:37 UTC
    We can't call END, since BEGIN, CHECK, INIT & END are not subroutine, are speciall blocks. We can declare them as subroutine just as a style, but in Perl the sub will doesn't exists in the symbol table, it will be in a speciall list inside Perl, that is called on destruction.

    What I wan't is to call this END blocks at runtime, END blocks defined by other modules, users, etc...

    Graciliano M. P.
    "Creativity is the expression of the liberty".

      sub end { # Put here what you'd normally put in END {...} } END {end}

      Abigail

        I think the problem is the modules that already have END block. If the modules are a part of a different distribution, either bundled with Perl or from CPAN, do you really want to change all those? The trick is to call END transparently.
        Thanks for your reply, but as I said, I need to can call the code declared in END blocks, since this END blocks in the enverioment that I'm developing will be created by other users and modules, so, I can't control the way that they declare this END blocks, specially for modules that are already there.

        Graciliano M. P.
        "Creativity is the expression of the liberty".