[prev] [thread] [next] [lurker] [Date index for 2002/09/05]
Update of /cvsroot/siesta/siesta/lib/Siesta In directory usw-pr-cvs1:/tmp/cvs-serv13617/lib/Siesta Modified Files: List.pm Storage.pm User.pm Log Message: Consilidate the fields of User and List by making them constants in the respective modules. Add save and delete methods. Index: List.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/List.pm,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- List.pm 3 Sep 2002 22:32:04 -0000 1.24 +++ List.pm 5 Sep 2002 12:34:57 -0000 1.25 @@ -3,7 +3,15 @@ package Siesta::List; use strict; -use Class::MethodMaker get_set => [ qw( id owner post_address return_path created ) ]; + +use vars qw(@fields); + +BEGIN { + @fields = qw(id post_address return_path owner created ); +} + + +use Class::MethodMaker get_set => \@fields; use Siesta; use Siesta::User; Index: Storage.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/Storage.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Storage.pm 28 Aug 2002 10:06:29 -0000 1.6 +++ Storage.pm 5 Sep 2002 12:34:58 -0000 1.7 @@ -8,8 +8,14 @@ } -sub load_user { die "virtual" } -sub load_list { die "virtual" } +sub load_user { die "virtual" } +sub save_user { die "virtual" } +sub delete_user { die "virtual" } + +sub load_list { die "virtual" } +sub save_list { die "virtual" } +sub delete_list { die "virtual" } + sub member_of_list { die "virtual" } sub add_member_to_list { die "virtual" } sub remove_member_from_list { die "virtual" } @@ -23,9 +29,25 @@ return a hash with a user in it, or nothing +=item ->save_user( $user_object ) + +inserts or updates the user in the database + +=item ->delete_user( $user_object ) + +removes the user from the database + =item ->load_list( $id ) return a hash with a list in it, or nothing + +=item ->save_list ( $list_object ) + +inserts or saves the list in the database + +=item ->delete_list ( $list_object ) + +removes the list from the database =item ->member_of_list( $list, $user ) Index: User.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/User.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- User.pm 3 Sep 2002 22:33:54 -0000 1.8 +++ User.pm 5 Sep 2002 12:34:58 -0000 1.9 @@ -1,10 +1,15 @@ package Siesta::User; use strict; use Siesta::Config::User; +use vars qw(@fields); # fuck the users, fuck them up their stupid asses +BEGIN { + @fields = qw(id forename surname password bouncing lastbounce created); +} + use Class::MethodMaker - get_set => [ 'id', 'forename', 'surname' ]; + get_set => \@fields; use Siesta; @@ -27,16 +32,12 @@ get and set their surname -=head2 ->(get|set)_config +=head2 ->config get and set config values for this User. =back -=head1 SEE ALSO - -L<Siesta::Config::User> - =cut sub new { @@ -46,29 +47,14 @@ my %user = Siesta->storage->load_user( $id ); return unless %user; - my $user_config = new Siesta::Config::User($id); - $user{config} = $user_config; - return bless \%user, $class; } +sub new_from_hash { + my $class = shift; + my $hash = shift; -sub get_config -{ - my ($self, $namespace, $key) = @_; - - return $self->{config}->get($namespace, $key); - -} - -sub set_config -{ - my ($self, $namespace, $key, $value) = @_; - - return $self->{config}->set($namespace, $key, $value); - + return bless $hash, $class; } - - 1;
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52