[prev] [thread] [next] [lurker] [Date index for 2002/08/26]
Update of /cvsroot/siesta/siesta/lib/Siesta In directory usw-pr-cvs1:/tmp/cvs-serv23666/lib/Siesta Modified Files: List.pm Log Message: add_member hackup Index: List.pm =================================================================== RCS file: /cvsroot/siesta/siesta/lib/Siesta/List.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- List.pm 25 Aug 2002 15:07:58 -0000 1.17 +++ List.pm 26 Aug 2002 16:42:54 -0000 1.18 @@ -63,25 +63,29 @@ return scalar(@results); } -=head2 add_member(member) +=head2 ->add_member( $member ) -Adds a member to a list - This is not currently working +Adds a member to a list =cut sub add_member { - my $self = shift; - my ($member) = @_; - + my $self = shift; + my $member = shift; + my $address = ref $member ? $member->id() : $member; - if ($self->is_member($member) == 0) { + return if $self->is_member($member); - } else { - return 0; - } + # this is hacky, but I'm too lazy to learn Class::DBI today -- richardc + my $table = Siesta::Storage::Table::List_Users->new(); + my $id = $self->id; + $table->dbh->do(qq{INSERT INTO list_users (list_id, user_id) + VALUES ('$id', '$address')}) + or die $table->dbh->errstr; + return 1; } -=head2 remove_member(member) +=head2 ->remove_member( $member ) Removes a member from a list.
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52