Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^2: Catching errors.

by Steve_BZ (Chaplain)
on Apr 02, 2013 at 14:12 UTC ( #1026697=note: print w/replies, xml ) Need Help??

in reply to Re: Catching errors.
in thread Catching errors.

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().''; 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; }


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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026697]
[Discipulus]: attach discours with a cute girl?
[1nickt]: "Profit before sanity" -- motto for a modern world.
[Discipulus]: "Profit before Everything" is already the current motto
[1nickt]: Discipulus Unfortunately on most US domestic flights you are far more likely to be squished between two other dudes. They've also removed the cushions from the seats and now provide mesh webbing, so as to be able to reduce the size of the seats by a fur
[1nickt]: ... a further 1cm and pack in one more row. You literally get numb at the base of your spine after two ro three hours. Even my 15 yr old experienced it, so it's not just an old man thing.
[Discipulus]: buy a private plane 1nickt
[Discipulus]: everything is possible in america, no? ;=)
[Discipulus]: ok I quit fast, Christmas Show at primary school..
[1nickt]: Disci+ I am seriously thinking about driving 9000km instead. Enjoy your kids' show!

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-12-18 12:34 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (485 votes). Check out past polls.