perl and eventhandlers

hi there,

I'm wondering if perl does know any events. for example if the script dies with some message because of an error in my script syntax - Is there an error-event I can handle with some subfunction.

Years ago as I have "programmed" visual basic, there was a function that was very nice, it was called "on error" - what meant if some error occours call the function I've defined.

Is something available in perl that is similar to VB's onError event handler? This would be very useful, because I'm writing some cronjobs, that should report any error occouring during the process to me (not every sub was developed by me, in fact of that some erros could appear while processing different data. for example some of my fellow-programmers could have forgotten to chomp some strings).

It would be great if anyone could help me out, because I have not found anything on perl.com or the other perl developing related sites I know.

best regards,

sebastian mohrenstecher
executive secretary
net::allies

www.net-allies.de
[email protected]

Comments

  • Hi,

    Regarding this point...

    : Years ago as I have "programmed" visual basic, there was a function
    : that was very nice, it was called "on error" - what meant if some
    : error occours call the function I've defined.
    You can put the entire script in an eval statement and get its return value find if it executed successfully.

    e.g.

    $retval = eval(qq{
    #Script here
    });
    if (!$retval) {
    #Error has occurred.
    }

    Try playing around with something like that - I may be a little wrong on something there. There is probably a special variable for getting the error.

    Hope this helps...

    Joanthan

    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion