|
Posted by H. Wade Minter on February 23, 2005, 5:04 pm
Please log in for more thread options
I'm working on my first couple of CPAN modules - they seem to be useful and
functional, good times.
I'm reporting errors to the users by, when a problem is found that would
impact execution of the module, setting $@ and returning undef. The POD
tells the user to check the return code for success, and look in $@ for more
details on errors.
It's working, but I have a sneaking suspicion that it may not be the "right"
way to do things. Is the way I'm doing it considered Perl-friendly? If not,
what's the canonical way to report an error and have a way for the user to
get details?
Thanks,
Wade
|
|
Posted by Terrence Brannon on February 23, 2005, 8:19 pm
Please log in for more thread options
> I'm working on my first couple of CPAN modules - they seem to be useful and
> functional, good times.
>
> I'm reporting errors to the users by, when a problem is found that would
> impact execution of the module, setting $@ and returning undef.
Do you distinguish between errors and exceptions? ie.e, recoverable vs
non-recoverable problems. perldoc perlvar and see "Error Indicators"
for details.
> The POD tells the user to check the return code for success, and
> look in $@ for more details on errors.
you are using the exception-handling mechanism in my eyes.
> It's working, but I have a sneaking suspicion that it may not be the "right"
> way to do things. Is the way I'm doing it considered Perl-friendly? If not,
> what's the canonical way to report an error and have a way for the user to
> get details?
I'm sure you've used various CPAN modules. Just make sure that your
way of doing things plays wells with the farm of modules that you are
using. For example, HTML::Mason, Alzabo, etc. all use Exception::Class
for error reporting because Dave Rolsky is behind those products and
he wrote Class::Exception.
Some usage cases would really help us give feedback. You might also
join module-authors@perl.org (http://lists.perl.org for subscibe
info) and/or www.perlmonks.org and as kquestions there.
--
Carter's Compass: I know I'm on the right track when,
by deleting something, I'm adding functionality.
|
| Similar Threads | Posted | | Program errors after module updates | October 21, 2004, 9:15 am |
| CPAN Errors Installing Tk Module | November 26, 2004, 9:56 pm |
| unix perl module install errors | November 11, 2004, 3:36 pm |
| Strange errors | August 9, 2004, 7:17 pm |
| How do I trap DBI errors? | May 16, 2006, 5:49 am |
| Sybperl errors on Solaris 2.9 | March 2, 2005, 8:52 am |
| Trying to compile MP3::Info gives errors | December 12, 2005, 11:17 am |
| Net::Google 502 Bad gateway errors | May 17, 2006, 2:15 am |
| Send::Mail nothing happens and no errors | January 25, 2007, 10:09 am |
| Errors when Installing Modules | June 23, 2008, 6:09 pm |
|