[Dbix-class] Re: Re: A better Digest / Encoding / Encryption Component

Guillermo Roditi groditi at gmail.com
Wed Jan 30 16:58:51 GMT 2008


> We store passwords encrypted in a tables field. We use the MySQL aes_encrypt an aes_decrypt functions to store and retrieve information from that column. The problem is, that DBIx::Class does not implement this kind of attaching a sql function to a field. At least it does not supply a way to have different sql functions called for storage and retrieval.

You CAN do this. Please see Cookbook:

http://search.cpan.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Manual/Cookbook.pod#Using_database_functions_or_stored_procedures

also:

$row->password(\"FUNCTION('${password}')");

or override set_column to do this bit for you.

sub set_column{
   my($self,$column, $value) = @_;
   if($column eq 'password' && defined $value ){
       $value = \'FUNCTION( "'.$value.'")';
   }
   $self->next::method($column, $value);
}

--Guillermo Roditi (groditi)



More information about the DBIx-Class mailing list