Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: How do I report an error back to the user of my object?

by polymorpheus (Novice)
on Jun 05, 2012 at 13:15 UTC ( [id://974466]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I report an error back to the user of my object?
in thread How do I report an error back to the user of my object?

I would highly suggest you do not take an approach like this. Exception based errors (die/eval) are far superior in many respects. If you are not convinced yet, do some research (PBP, Modern Perl). Also look at all the monks! Most have already suggested die() and for good reasons!

Also, in errorstr() I think I see a bug:
$self or return $ERRORSTR; # Class call
I think you meant to do this?
ref $self or return $ERRORSTR; # Class call
But more importantly, use exceptions instead!

Replies are listed 'Best First'.
Re^3: How do I report an error back to the user of my object?
by NetWallah (Canon) on Jun 05, 2012 at 13:47 UTC
    Agreed (and fixed). But I would suggest using Carp which has a "confess" method that can provide a stack trace to point out the callers evil ways.

                 I hope life isn't a big joke, because I don't get it.
                       -SNL

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found