DBIx::SearchBuilder::Record

DBIx::SearchBuilder::Record is a Perl superclass for records loaded by SearchBuilder.
Download

DBIx::SearchBuilder::Record Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Jesse Vincent
  • Publisher web site:
  • http://search.cpan.org/~jesse/

DBIx::SearchBuilder::Record Tags


DBIx::SearchBuilder::Record Description

DBIx::SearchBuilder::Record is a Perl superclass for records loaded by SearchBuilder. DBIx::SearchBuilder::Record is a Perl superclass for records loaded by SearchBuilder.SYNOPSIS package MyRecord; use base qw/DBIx::SearchBuilder::Record/; sub _Init { my $self = shift; my $DBIxHandle = shift; # A DBIx::SearchBuilder::Handle::foo object for your database $self->_Handle($DBIxHandle); $self->Table("Users"); } # Tell Record what the primary keys are sub _PrimaryKeys { return ; } # Preferred and most efficient way to specify fields attributes in a derived # class, used by the autoloader to construct Attrib and SetAttrib methods. # read: calling $Object->Foo will return the value of this record's Foo column # write: calling $Object->SetFoo with a single value will set Foo's value in # both the loaded object and the database sub _ClassAccessible { { Tofu => { 'read' => 1, 'write' => 1 }, Maz => { 'auto' => 1, }, Roo => { 'read' => 1, 'auto' => 1, 'public' => 1, }, }; } # A subroutine to check a user's password without returning the current value # For security purposes, we didn't expose the Password method above sub IsPassword { my $self = shift; my $try = shift; # note two __s in __Value. Subclasses may muck with _Value, but # they should never touch __Value if ( $try eq $self->__Value('Password') ) { return (1); } else { return (undef); } } # Override DBIx::SearchBuilder::Create to do some checking on create sub Create { my $self = shift; my %fields = ( UserId => undef, Password => 'default', #Set a default password @_ ); # Make sure a userid is specified unless ( $fields{'UserId'} ) { die "No userid specified."; } # Get DBIx::SearchBuilder::Record->Create to do the real work return ( $self->SUPER::Create( UserId => $fields{'UserId'}, Password => $fields{'Password'}, Created => time ) ); } Requirements: · Perl


DBIx::SearchBuilder::Record Related Software