Re: Carp and croak instead of warn and die
Rick Measham <rick-6wk1kIbWGY9Wo+R/V/U2/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.pdfapi2 |
|---|---|
| Message-ID | <[email protected]> |
Jeffrey Ratcliffe wrote:
> It would be useful if carp and croak were used in all modules instead
> of warn and die, thus also displaying the line number of the calling
> program, as well as that of the library function.
Mr. Shawn H. Corey wrote:
> eval { foobar };
> if( $@ ){
> # error trapped
> }
Whilst that will work, I agree with Jeffrey. All modules should be using
croak and carp for most almost all errors. That way, you know exactly
what caused the error without wrapping every line in an eval wrapper.
Cheers!
Rick Measham