ropey has asked for the wisdom of the Perl Monks concerning the following question:
And then simply insert...package Austin::DB::CreditCard; use strict; use warnings; use Austin::DB; use base qw/Austin::DB/; use Austin::SUP::Helpers qw/encrypt/; use Data::Dumper; Austin::DB::CreditCard->table('cc_payment'); Austin::DB::CreditCard->columns(All => qw/trip_id cc_type cc_name cc_n +umber expiry issue_no sec_code/); Austin::DB::CreditCard->autoupdate(0); __PACKAGE__->add_trigger( before_set_cc_number => \&do_encryption); sub do_encryption { my $self = shift; my $encrypted = encrypt('local', $self->cc_number, getlogin()); $self->cc_number($encrypted); } 1;
Austin::DB::CreditCard->insert(\%info);
Please no comments on storing cc info in a DB... at this point we do not have a choice and thats beyond my control
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Class::DBI and Triggers
by rhesa (Vicar) on Nov 14, 2006 at 12:57 UTC |