[prev] [thread] [next] [lurker] [Date index for 2002/09/08]
Update of /cvsroot/siesta/siesta/lib/Siesta In directory usw-pr-cvs1:/tmp/cvs-serv14055 Modified Files: User.pm Log Message: interleave docs and code Index: User.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/User.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- User.pm 8 Sep 2002 14:57:55 -0000 1.13 +++ User.pm 8 Sep 2002 15:00:43 -0000 1.14 @@ -18,15 +18,36 @@ =head1 METHODS -=head2 ->new +=head2 ->new( $user_id ) -takes a user_id and retrieves the information from the database. +takes a user_id and retrieves the information from the database. -=head2 ->new_from_hash +=cut + +sub new { + my $class = shift; + my $id = shift; + + my %user = Siesta->storage->load_user( $id ); + return unless %user; + + return bless \%user, $class; +} + +=head2 ->new_from_hash( %hash ) takes a hash (possible keys are the values of @Siesta::User::fields) and creates a new object. +=cut + +sub new_from_hash { + my $class = shift; + my $hash = shift; + + return bless $hash, $class; +} + =head2 ->id get and set their id (usually their email address) @@ -43,52 +64,41 @@ return all the lists that this user is on. -=head2 ->save - -insert or update this object in the database. - -=head2 ->delete - -delete this object from the database. - -=head2 ->config - -get and set config values for this User. - -=back - =cut -sub new { - my $class = shift; - my $id = shift; - - my %user = Siesta->storage->load_user( $id ); - return unless %user; - - return bless \%user, $class; -} - -sub new_from_hash { - my $class = shift; - my $hash = shift; - - return bless $hash, $class; -} - sub lists { my $self = shift; return Siesta->storage->user_lists($self->id); } +=head2 ->save + +insert or update this object in the database. + +=cut + sub save { my $self = shift; return Siesta->storage->save_user($self); } +=head2 ->delete + +delete this object from the database. + +=cut + sub delete { my $self = shift; return Siesta->storage->delete_user($self) } + +=head2 ->config + +get and set config values for this User. + +=back + +=cut 1;
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52