On 7/15/05, Michael Peters <[EMAIL PROTECTED]> wrote:
>   my $error_page = $self->check_rm(...);
>   if( $error_page ) {
>     return $error_page;
>   } else {
>     my $email = $self->dfv->valid('email');
>   }
> 
> Which seems very readable to me.

I don't want to join the debate on whether this is a good idea or not,
but I would rather see the above structure in reverse:

my $valid = $self->check_rm(...) or return $self->dfv->error_page;

You could probably come up with some better names than what is written
above (error_page seems to indicate a hard error, instead of a
validation problem), but that structure seems clearer to me.

What I am interested in when I call check_rm is the validated results
of the operation.  The error page is a secondary convenience, so it
should be treated that way.

This structure also closely resembles what is sometimes used to pass
error messages back after a failed function call (look at DBI for an
example).  If the function call returns a false value, call 'this'
method to see what the error message contains.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to