[siesta-commit] siesta/lib/Siesta/Storage DBI.pm,1.29,1.30

[prev] [thread] [next] [lurker] [Date index for 2002/09/15]

From: clampr
Subject: [siesta-commit] siesta/lib/Siesta/Storage DBI.pm,1.29,1.30
Date: 13:46 on 15 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta/Storage
In directory usw-pr-cvs1:/tmp/cvs-serv1051

Modified Files:
	DBI.pm 
Log Message:
style tweakage


Index: DBI.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Storage/DBI.pm,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- DBI.pm	15 Sep 2002 12:30:09 -0000	1.29
+++ DBI.pm	15 Sep 2002 12:46:07 -0000	1.30
@@ -137,10 +137,9 @@
     my $self = shift;
     my $user = shift;
 
-    $user = ( ref $user ) ? $user->id : $user;
+    $user = UNIVERSAL::can( $user, 'id' ) ? $user->id : $user;
 
-    return $self->_dbh->do(
-        qq{DELETE FROM users WHERE id = '$user'} );
+    return  $self->_dbh->do( qq{DELETE FROM users WHERE id = '$user'} );
 }
 
 sub load_list {
@@ -173,8 +172,7 @@
     my $self = shift;
     my $list = shift;
 
-    # make sure we've got the id 
-    $list = ( ref $list ) ? $list->id : $list;
+    $list = UNIVERSAL::can( $list, 'id' ) ? $list->id : $list;
 
     return $self->_dbh->do(
         qq{DELETE FROM lists WHERE id = '$list'} );
@@ -366,14 +364,14 @@
 # add plugin into the processing queue for a list
 # providing a number will insert at that position.
 # otherwise it will be added at the end. Position 
-# is indexed from 1. Returns 1 on success or undef
-# on failure.
+# is indexed from 1. Returns true on sucess
 sub add_plugin_to_list {
     my ( $self, $list, $plugin, $position ) = @_;
 
     # make sure we've got a list object
     unless ( ref $list ) {
-        $list = Siesta->storage->load_list($list) || return undef;
+        $list = Siesta->storage->load_list($list)
+          or return;
     }
 
     my @plugins = $list->plugins();
@@ -387,7 +385,6 @@
     }
 
     return $self->set_plugins( $list, @plugins );
-
 }
 
 # sets the order of the plugins for a list
@@ -398,10 +395,11 @@
 
     # make sure we've got a list object
     unless ( ref $list ) {
-        $list = Siesta->storage->load_list($list) || return undef;
+        $list = Siesta->storage->load_list($list)
+          or return;
     }
 
-    # get rid of the exisiting list.    
+    # get rid of the exisiting list.
     my $sql = sprintf "DELETE from list_plugins where list_id=%s",
       $self->_dbh->quote( $list->id() );
 



Generated at 13:57 on 01 Jul 2004 by mariachi 0.52