in reply to Re^2: Avoiding INIT
in thread Avoiding INIT

Ah, you don't want to skip it's execution, you want to have the debugger not step through it. I'm rather surprised BEGIN blocks are simply executed rather than stepped through.

Any reason you don't move the contents of your INIT block into your CHECK block?

Replies are listed 'Best First'.
Re^4: Avoiding INIT
by geoffleach (Scribe) on Feb 09, 2010 at 19:03 UTC
    The idea it to postpone processing the command line until the last moment. The INIT block is just one sub call, prefixed, of course with an underscore to suggest that you (the user) really does not want to go there.

    The idea is to eliminate a potential source of confusion. I know that when I was developing tests I was constantly asking myself, "WTF is this?" before remembering that I was looking at the INIT block -- which I had written of course :-(.

      The idea it to postpone processing the command line until the last moment.

      That doesn't answer my question at all.

      Under the fair assumption that yours is the only module that has a CHECK block, the INIT block will be called immediately after the CHECK block. Thus, if the content of the INIT block were to be moved into the CHECK block, it would be executed at exactly the same time as before.

        Ah! Sorry 'bout that. I can't make that assumption. The module in question is Getopt::Auto. Who knows what context it was invokde in?