gvbals has asked for the wisdom of the Perl Monks concerning the following question:

We have a set of perl scripts. We don't have any exception handling. Sometime the scripts terminates unexpectedly. How to find out the reason for the same/

Replies are listed 'Best First'.
Re: Perl Script Terminates unexpectedly
by Athanasius (Archbishop) on Jun 30, 2015 at 07:50 UTC

    Hello gvbals, and welcome to the Monastery!

    I take it that you want a quick-and-easy way to find where a given script is terminating. Try adding this to the head of the script:

    use Carp; END { confess "Script terminated"; }

    The call to Carp::confess will generate a stack trace, which should help you to locate the source of the termination. And the END block will be run even if the script encounters an exit statement.

    See Carp and perlmod.

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Re: Perl Scripts Terminates unexpectedly
by BrowserUk (Patriarch) on Jun 30, 2015 at 06:27 UTC
    Sometime the scripts terminates unexpectedly.

    How do you know they terminate unexpectedly?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
    I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!