princepawn has asked for the wisdom of the Perl Monks concerning the following question:
Please critique this sub and tell me if you would do it differently.
sub ok { my $self = shift; my $email = shift or confess "where's the email?!"; my $err_ref = shift or confess "where's the err_ref?!"; if ( $self->{email}{$email} ) { $$err_ref = "duplicate"; return } if ( profane ($email, 'definite')) { $$err_ref = 'profanite/definite'; return } if ( $self->{blacklist}->optout($email) ) { $$err_ref = 'optout'; return } $self->{email}{$email}++; return 1; }
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
|
|---|