[Jifty-commit] r1469 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jul 3 23:13:28 EDT 2006


Author: clkao
Date: Mon Jul  3 23:13:25 2006
New Revision: 1469

Modified:
   jifty/trunk/lib/Jifty/Record.pm

Log:
misc cleanup.


Modified: jifty/trunk/lib/Jifty/Record.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Record.pm	(original)
+++ jifty/trunk/lib/Jifty/Record.pm	Mon Jul  3 23:13:25 2006
@@ -62,9 +62,10 @@
     }
 
     foreach my $key ( keys %attribs ) {
+        my $attr = $attribs{$key};
         my $method = "validate_$key";
-        next unless $self->can($method);
-        my ( $val, $msg ) = $self->$method( $attribs{$key} );
+        my $func = $self->can($method) or next;
+        my ( $val, $msg ) = $func->($self, $attr);
         unless ($val) {
             $self->log->error("There was a validation error for $key");
             return ( $val, $msg );
@@ -72,7 +73,7 @@
 
         # remove blank values. We'd rather have nulls
         if ( exists $attribs{$key}
-            and ( not defined $attribs{$key} or (not ref $attribs{$key} and $attribs{$key} eq "" )) )
+            and ( not defined $attr or (not ref $attr and $attr eq "" )) )
         {
             delete $attribs{$key};
         }


More information about the Jifty-commit mailing list