[prev] [thread] [next] [lurker] [Date index for 2002/08/26]
Update of /cvsroot/siesta/siesta/lib/Siesta In directory usw-pr-cvs1:/tmp/cvs-serv23946/lib/Siesta Modified Files: List.pm User.pm Log Message: refactor into Storage::DBI Index: List.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/List.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- List.pm 26 Aug 2002 21:47:04 -0000 1.19 +++ List.pm 26 Aug 2002 22:50:31 -0000 1.20 @@ -29,13 +29,13 @@ =cut sub new { - my $class = shift; - my $id = shift; + my $class = shift; + my $id = shift; - my %list = $storage->load_list( $id ); - return unless %list; + my %list = $storage->load_list( $id ); + return unless %list; - return bless \%list, $class; + return bless \%list, $class; } =head2 is_member(member) @@ -62,11 +62,10 @@ sub add_member { my $self = shift; my $member = shift; - my $address = ref $member ? $member->id() : $member; + my $address = ref $member ? $member->id : $member; return if $self->is_member($member); - - $storage->add_member_to_list( $self->id, $address ); + return $storage->add_member_to_list( $self->id, $address ); } =head2 ->remove_member( $member ) Index: User.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/User.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- User.pm 21 Aug 2002 09:11:22 -0000 1.4 +++ User.pm 26 Aug 2002 22:50:31 -0000 1.5 @@ -4,25 +4,18 @@ use Class::MethodMaker get_set => [ 'id', 'forename', 'surname' ]; -use Siesta::Storage::Table::Users; - -sub new { - my $class = shift; - my $id = shift; - my $t_lists = Siesta::Storage::Table::Users->new(); - my @results = $t_lists->search(id => $id); - if (!(scalar(@results) == 1)) { - # we need to decide error handling in libs ;-) - return undef; - } +use Siesta::Storage::DBI; +my $storage = Siesta::Storage::DBI->new(); - if (exists($results[0]->{__Changed})) { - delete($results[0]->{__Changed}); - } +sub new { + my $class = shift; + my $id = shift; - return bless $results[0], $class; + my %user = $storage->load_user( $id ); + return unless %user; + return bless \%user, $class; } 1;
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52