in reply to (jeffa) Re: style for returning errors from subroutines
in thread style for returning errors from subroutines
However, a problem with this seems to be that if a package is going to share the same error standard, it would need have it's own instance of the error class. So either I have to check in two places to find my error code, OR I would have to pass my main routine's error object explicitly to each subroutine call, eg:
which are both a bit messier than I'd like (although I've supplied a pretty messy example)use Users; use Error; my $error = new Error; ($formatted_users = &format(&Users::get_users($filehandle)) or $error->handle or $Users::error->handle; ====================OR==================== use Users; use Error; my $error = new Error; ($formatted_users = &format(&Users::get_users($file_handle,$error))) or $error->handle;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) 3Re: style for returning errors from subroutines
by jeffa (Bishop) on Jun 15, 2001 at 00:28 UTC |