in reply to Re: to get the un-forseen errors
in thread to get the un-forseen errors

I am looking for a way to capture the last thrown error in case the perl script aborts due to some error, coz I have to capture and return that error to QTP from where my perl script was invoked.

That error line was just an example. I am handling the errors almost every where, but I just need a way to be sure, if an error that I have not handled occurs, at least I have the right error text being returned.

Thanks,
J

Replies are listed 'Best First'.
Re^3: to get the un-forseen errors
by rovf (Priest) on Feb 18, 2010 at 10:32 UTC
    I am looking for a way to capture the last thrown error in case the perl script aborts due to some error

    If the error is printed by a die statement, you can of course catch the exception using eval (and the message will be stored in $@). In the example you gave, this will likely work (unless some of the intervening functions in the call stack do some nasty countermeasures, of course). If the error is just printed without throwing an exception, there is no way to handle it, unless you are willing to modify the source code which causes the error.

    -- 
    Ronald Fischer <ynnor@mm.st>