Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Catching errors.

by RichardK (Priest)
on Apr 02, 2013 at 13:39 UTC ( #1026689=note: print w/ replies, xml ) Need Help??


in reply to Catching errors.

Where are you trying to catch these errors? In your application or in the OS?

If your application is throwing 'missing perl function errors' then that suggests that you are not testing your code sufficiently. I think you should investigate test driven development, unit tests and other automated tools to help you improve your code quality.

Are you really compiling code on user machines? This is always going to be difficult, managing the dependencies is non trivial -- but more testing will help.


Comment on Re: Catching errors.
Re^2: Catching errors.
by Steve_BZ (Hermit) on Apr 02, 2013 at 14:12 UTC

    I am trying to catch the errors within the perl application using a number of standard routines like this one:

    $sth=$dbh->prepare($sql_string) or die_db(...) sub die_db{ # # Send emails. # my $message=shift; my $line_number=shift; print STDOUT $line_number, "\n", $message; my $from = hostname().'@i-mageonline.com'; my $msg = "There has been an error at line $line_number. \nThe err +or message is '$message'. "; my $sender = send_email("DB Error at line $line_number", $msg, $fr +om); my $result = $sender->MailMsg({ msg => $sender->{msg}, }) or die "$Mail::Sender::Error\n"; die "DB Error" . DBI->errstr; }

    Update

    If your application is throwing 'missing perl function errors' then that suggests that you are not testing your code sufficiently.

    This is mostly caused by uninitialised objects, like this:

    $self->{"calendar_".$n} = Wx::Calendar->new(.....); . . . $self->{calendar_9}->GetValue();
    Because $self->{calendar_9} is not created (undefined), GetValue does not exist.

    Are you really compiling code on user machines?

    By 'compile time', I mean starting the perl interpreter, and the interpreter checks (compiles) all the dependencies and says that such-and-such a module has a syntax error and the code does not even execute.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026689]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2014-07-31 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (250 votes), past polls