in reply to Turning a script into a module
If something goes horribly wrong, I usually return undef, then the caller can check whether anything was returned and handle it as it wishes. In some cases I also setup an internal error code and/or error message (ERRNO, ERRMESS), which can be accessed like Package::ERRNO. This then puts the reliance on the caller to handle the errors as they see fit.
Regards having a PrintHandler, passing that as you have seems fine, but if this is just for warnings and errors, I would personally use the return codes. Then again if this is for own use then it probably isn't an issue, if it was for CPAN you might want to consider that others might not want to print anything at all.
--
Barbie | Birmingham Perl Mongers | http://birmingham.pm.org/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Turning a script into a module
by eyepopslikeamosquito (Archbishop) on Jul 17, 2003 at 09:16 UTC |