in reply to Re: Re: How to return errors from my object oriented subroutine
in thread How to return errors from my object oriented subroutine

I would actually have various tests to determine stuff.
if ($email->is_duplicate) { ... } if ($email->is_profane) { ... } # etc ... package MyEmail; sub is_duplicate { my $self = shift; $self->validate unless $self->is_validated; return $self->{is_duplicate}; } # all the others are the same sub validate { my $self = shift; # set some attributes $self->{is_validated} = 1; }

This way, you can check any of the possible error messages and the first time an error is checked, the file will be validated.

------
We are the carpenters and bricklayers of the Information Age.

The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.