[Bast-commits] r3144 - in trunk/DBIx-Class-DigestColumns: . lib/DBIx/Class t

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Tue Mar 27 19:16:14 GMT 2007


Author: groditi
Date: 2007-03-27 19:16:13 +0100 (Tue, 27 Mar 2007)
New Revision: 3144

Modified:
   trunk/DBIx-Class-DigestColumns/Changes
   trunk/DBIx-Class-DigestColumns/META.yml
   trunk/DBIx-Class-DigestColumns/README
   trunk/DBIx-Class-DigestColumns/lib/DBIx/Class/DigestColumns.pm
   trunk/DBIx-Class-DigestColumns/t/05digest.t
Log:
oops. .006 now

Modified: trunk/DBIx-Class-DigestColumns/Changes
===================================================================
--- trunk/DBIx-Class-DigestColumns/Changes	2007-03-27 17:46:52 UTC (rev 3143)
+++ trunk/DBIx-Class-DigestColumns/Changes	2007-03-27 18:16:13 UTC (rev 3144)
@@ -1,3 +1,6 @@
+0.06000 2007-03-27
+	- POD oops
+	- digest_auto oops
 0.05000 2007-03-27
 	- Local copy of args in ->update unnecessary
 	- Added test for Marc's patch

Modified: trunk/DBIx-Class-DigestColumns/META.yml
===================================================================
--- trunk/DBIx-Class-DigestColumns/META.yml	2007-03-27 17:46:52 UTC (rev 3143)
+++ trunk/DBIx-Class-DigestColumns/META.yml	2007-03-27 18:16:13 UTC (rev 3144)
@@ -1,11 +1,12 @@
 ---
 name: DBIx-Class-DigestColumns
-version: 0.04000
+version: 0.05000
 author:
   - 'Tom Kirkpatrick (tkp) <tkp at cpan.org>'
   - |-
     With contributions from
     Guillermo Roditi (groditi) <groditi at cpan.org>
+    and Marc Mims <marc at questright.com>
 abstract: Automatic digest columns
 license: perl
 resources:
@@ -29,7 +30,7 @@
 provides:
   DBIx::Class::DigestColumns:
     file: lib/DBIx/Class/DigestColumns.pm
-    version: 0.04000
+    version: 0.05000
 generated_by: Module::Build version 0.2805
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.2.html

Modified: trunk/DBIx-Class-DigestColumns/README
===================================================================
--- trunk/DBIx-Class-DigestColumns/README	2007-03-27 17:46:52 UTC (rev 3143)
+++ trunk/DBIx-Class-DigestColumns/README	2007-03-27 18:16:13 UTC (rev 3144)
@@ -6,6 +6,13 @@
 
       __PACKAGE__->load_components(qw/DigestColumns ... Core/);
 
+      #automatically generate a method "check_password" in result class
+      __PACKAGE__->add_columns(
+        'password' => {
+          data_type => 'char',
+          size      => 32,
+          digest_check_method => 'check_password',
+      }
       __PACKAGE__->digestcolumns(
           columns   => [qw/ password /],
           algorithm => 'MD5',
@@ -38,6 +45,18 @@
 
       __PACKAGE__->digest_algorithm('SHA-1');
 
+Options added to add_column
+  digest_check_method => $method_name
+    By using the digest_check_method attribute when you declare a column you
+    can create a check method for that column. The check method accepts a
+    plain text string, performs the correct digest on it and returns a
+    boolean value indicating whether this method matches the
+    currently_stored value.
+
+      $row->password('new_password');
+      $row->check_password('new_password'); #returns true
+      $row->check_password('new_password'); #returns false
+
 METHODS
   digestcolumns
       __PACKAGE__->digestcolumns(
@@ -51,6 +70,10 @@
     Calls "digest_columns", "digest_algorithm", and "digest_encoding" and
     "digest_auto" if the corresponding argument is defined.
 
+  register_column
+    Override the original register_column to handle the creation of check
+    methods.
+
   digest_columns
     Takes a list of columns to be convert to a message digest during insert.
 
@@ -144,6 +167,7 @@
     Tom Kirkpatrick (tkp) <tkp at cpan.org>
 
     With contributions from Guillermo Roditi (groditi) <groditi at cpan.org>
+    and Marc Mims <marc at questright.com>
 
 LICENSE
     You may distribute this code under the same terms as Perl itself.

Modified: trunk/DBIx-Class-DigestColumns/lib/DBIx/Class/DigestColumns.pm
===================================================================
--- trunk/DBIx-Class-DigestColumns/lib/DBIx/Class/DigestColumns.pm	2007-03-27 17:46:52 UTC (rev 3143)
+++ trunk/DBIx-Class-DigestColumns/lib/DBIx/Class/DigestColumns.pm	2007-03-27 18:16:13 UTC (rev 3144)
@@ -20,7 +20,7 @@
 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
 # brain damage and presumably various other packaging systems too
 
-$VERSION = '0.05000';
+$VERSION = '0.06000';
 
 =head1 NAME
 
@@ -83,9 +83,12 @@
 plain text string, performs the correct digest on it and returns a boolean
 value indicating whether this method matches the currently_stored value.
 
+  $row->password('old_password');
+  $row->update;
   $row->password('new_password');
   $row->check_password('new_password'); #returns true
-  $row->check_password('new_password'); #returns false
+  $row->check_password('old_password'); #returns false
+  $row->update;
 
 =head1 METHODS
 
@@ -125,7 +128,8 @@
 	    my $col_value = $self->get_column($column);
 	    #make sure we DTRT if column is dirty
 	    $col_value = $self->_get_digest_string($col_value)
-		if $self->is_column_changed($column);
+		if $self->is_column_changed($column) && $self->digest_auto;
+
 	    return $col_value eq $self->_get_digest_string($value);
 	};
     }

Modified: trunk/DBIx-Class-DigestColumns/t/05digest.t
===================================================================
--- trunk/DBIx-Class-DigestColumns/t/05digest.t	2007-03-27 17:46:52 UTC (rev 3143)
+++ trunk/DBIx-Class-DigestColumns/t/05digest.t	2007-03-27 18:16:13 UTC (rev 3144)
@@ -5,7 +5,7 @@
 
 BEGIN {
     plan eval "require Digest"
-        ? ( tests => 9 )	
+        ? ( tests => 10 )	
         : ( skip_all => 'needs Digest for testing' );
 }
 
@@ -42,6 +42,7 @@
 Class::C3->reinitialize();
 $row->password('testvalue2');
 $row->update;
+ok !$row->check_password('testvalue2');
 is $row->password, 'testvalue2', 'digest_auto off';
 
 1;




More information about the Bast-commits mailing list