[siesta-commit] siesta/lib/Siesta/Config List.pm,1.2,1.3 ListUser.pm,1.2,1.3 User.pm,1.2,1.3

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

From: muttley
Subject: [siesta-commit] siesta/lib/Siesta/Config List.pm,1.2,1.3 ListUser.pm,1.2,1.3 User.pm,1.2,1.3
Date: 16:16 on 02 Sep 2002
Update of /cvsroot/siesta/siesta/lib/Siesta/Config
In directory usw-pr-cvs1:/tmp/cvs-serv31085/lib/Siesta/Config

Modified Files:
	List.pm ListUser.pm User.pm 
Log Message:
Huge batch of changes to get config working. 


Index: List.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Config/List.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- List.pm	2 Sep 2002 11:46:47 -0000	1.2
+++ List.pm	2 Sep 2002 15:16:08 -0000	1.3
@@ -1,4 +1,4 @@
-package Siesta::Config::User;
+package Siesta::Config::List;
 
 use strict;
 use vars qw( $DBFILE $ARCHIVE_PATH );
@@ -7,27 +7,52 @@
 use base qw(Siesta::Config Ima::DBI);
 
 
-# override Siesta::Config 
-sub new 
-{
-	my $class = shift;
+=pod
 
-	my $DBI = "dbi:SQLite:".$Siesta::Config::DBFILE;
-	Siesta::Config::User->set_db('Main', $DBI);
-	# set the sql statements 
-	Siesta::Config::User->set_sql('get', <<"SQL", 'Main');
+=head1 NAME
+
+Siesta::Config::List - get per list configuration
+
+=head1 USAGE
+
+my $list_config = new Siesta::Config::List ($list_id);
+
+# Namespace would usually be the name of a plugin
+$list_config->get('Namespace', 'key');
+
+$list_config->set('Namespace', 'key', 'value');
+
+# these will return undef if they fail
+
+=head1 NOTES
+
+These shouldn't really be called. Use the (get|set)_config 
+methods from B<Siesta::List> instead.
+
+=head1 SEE ALSO
+
+L<Siesta::Config>, L<Siesta::List>
+
+=cut 
+
+my $DBI = "dbi:SQLite:".$Siesta::Config::DBFILE;
+
+
+Siesta::Config::List->set_db('Main', $DBI);
+# set the sql statements 
+Siesta::Config::List->set_sql('get', <<"SQL", 'Main');
 		select value 
 		from list_config
 		where id = ? and 
 		namespace = ? and
 		key = ?
 SQL
-	Siesta::Config::User->set_sql('insert', <<"SQL", 'Main');
+Siesta::Config::List->set_sql('insert', <<"SQL", 'Main');
 		insert into list_config
 		(id, namespace, key, value)
 		values (?, ?, ?, ?)
 SQL
-	Siesta::Config::User->set_sql('update', <<"SQL", 'Main');
+Siesta::Config::List->set_sql('update', <<"SQL", 'Main');
 		update list_config 
 		set value = ?
 		where id = ? and 
@@ -35,7 +60,15 @@
 		key = ?
 SQL
 
-	return bless {}, $class;
+# override Siesta::Config 
+sub new 
+{
+	my $class = shift;
+	# note - should this be changed to a list object?
+	my $id    = shift;
+
+	return bless {'id' => $id }, $class;
+
 }
 
 

Index: ListUser.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Config/ListUser.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ListUser.pm	2 Sep 2002 11:46:47 -0000	1.2
+++ ListUser.pm	2 Sep 2002 15:16:08 -0000	1.3
@@ -1,4 +1,4 @@
-package Siesta::Config::User;
+package Siesta::Config::ListUser;
 
 use strict;
 use vars qw( $DBFILE $ARCHIVE_PATH );
@@ -13,7 +13,7 @@
 	my $class = shift;
 
 	my $DBI = "dbi:SQLite:".$Siesta::Config::DBFILE;
-	Siesta::Config::User->set_db('Main', $DBI);
+	Siesta::Config::ListUser->set_db('Main', $DBI);
 	# set the sql statements 
 	Siesta::Config::User->set_sql('get', <<"SQL", 'Main');
 		select value 
@@ -22,12 +22,12 @@
 		namespace = ? and
 		key = ?
 SQL
-	Siesta::Config::User->set_sql('insert', <<"SQL", 'Main');
+	Siesta::Config::ListUser->set_sql('insert', <<"SQL", 'Main');
 		insert into listuser_config
 		(id, namespace, key, value)
 		values (?, ?, ?, ?)
 SQL
-	Siesta::Config::User->set_sql('update', <<"SQL", 'Main');
+	Siesta::Config::ListUser->set_sql('update', <<"SQL", 'Main');
 		update listuser_config 
 		set value = ?
 		where id = ? and 

Index: User.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta/Config/User.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- User.pm	2 Sep 2002 11:46:47 -0000	1.2
+++ User.pm	2 Sep 2002 15:16:08 -0000	1.3
@@ -6,28 +6,51 @@
 require Siesta::Config;
 use base qw(Siesta::Config Ima::DBI);
 
+=pod
 
-# override Siesta::Config 
-sub new 
-{
-	my $class = shift;
+=head1 NAME
 
-	my $DBI = "dbi:SQLite:".$Siesta::Config::DBFILE;
-	Siesta::Config::User->set_db('Main', $DBI);
-	# set the sql statements 
-	Siesta::Config::User->set_sql('get', <<"SQL", 'Main');
+Siesta::Config::User - get per user configuration
+
+=head1 USAGE
+
+my $user_config = new Siesta::Config::User ($user_id);
+
+# Namespace would usually be the name of a plugin
+$user_config->get('Namespace', 'key');
+
+$user_config->set('Namespace', 'key', 'value');
+
+# these will return undef if they fail
+
+=head1 NOTES
+
+These shouldn't really be called. Use the (get|set)_config
+methods from B<Siesta::User> instead.
+
+=head1 SEE ALSO
+
+L<Siesta::Config>, L<Siesta::User>
+
+=cut
+
+
+my $DBI = "dbi:SQLite:".$Siesta::Config::DBFILE;
+Siesta::Config::User->set_db('Main', $DBI);
+# set the sql statements 
+Siesta::Config::User->set_sql('get', <<"SQL", 'Main');
 		select value 
 		from user_config
 		where id = ? and 
 		namespace = ? and
 		key = ?
 SQL
-	Siesta::Config::User->set_sql('insert', <<"SQL", 'Main');
+Siesta::Config::User->set_sql('insert', <<"SQL", 'Main');
 		insert into user_config
 		(id, namespace, key, value)
 		values (?, ?, ?, ?)
 SQL
-	Siesta::Config::User->set_sql('update', <<"SQL", 'Main');
+Siesta::Config::User->set_sql('update', <<"SQL", 'Main');
 		update user_config 
 		set value = ?
 		where id = ? and 
@@ -35,7 +58,15 @@
 		key = ?
 SQL
 
-	return bless {}, $class;
+
+# override Siesta::Config 
+sub new 
+{
+	my $class = shift;
+	my $id    = shift;
+
+
+	return bless { 'id' => $id }, $class;
 }
 
 



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