[siesta-commit] siesta/lib Siesta.pm,1.12,1.13

[prev] [thread] [next] [lurker] [Date index for 2002/08/28]

From: clampr
Subject: [siesta-commit] siesta/lib Siesta.pm,1.12,1.13
Date: 11:06 on 28 Aug 2002
Update of /cvsroot/siesta/siesta/lib
In directory usw-pr-cvs1:/tmp/cvs-serv15649/lib

Modified Files:
	Siesta.pm 
Log Message:
bigass ->connect ->storage refactor

Index: Siesta.pm
===================================================================
RCS file: /cvsroot/siesta/siesta/lib/Siesta.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Siesta.pm	23 Aug 2002 17:58:32 -0000	1.12
+++ Siesta.pm	28 Aug 2002 10:06:43 -0000	1.13
@@ -1,17 +1,29 @@
 # $Id$
 package Siesta;
 use strict;
-require Exporter;
-use base 'Exporter';
-use vars qw/@EXPORT_OK $VERSION/;
-@EXPORT_OK = qw( process );
+use vars qw/$VERSION/;
 $VERSION = 1.0; # baby!
 
 use constant debug => 0;
 use Siesta::Message;
 use Siesta::List;
 
+=item ->process( mail => $message, action => $action, list => $list )
+
+class method to process a mail
+
+action may be C<post>, C<sub>, or C<unsub>
+defaults to C<post>
+
+mail must be either an anonymous array or a filehandle to read the
+message body from
+
+list must be the identifier of a mailing list
+
+=cut
+
 sub process {
+    my $class = shift;
     my %args = @_;
     my $action = $args{action} || 'post';
     my $mail = Siesta::Message->new( $args{mail} );
@@ -33,4 +45,35 @@
     }
 }
 
+=item ->connect( $backend, @args )
+
+Class method to connect to a Siesa::Storage::* instance
+
+=cut
+
+my $storage;
+sub connect {
+    my $self = shift;
+    my $class = shift;
+    return unless $class;
+
+    $class = "Siesta::Storage::$class";
+    print "$class\n" if debug;
+    eval "require $class";
+    die $@ if $@;
+    $storage = $class->new(@_);
+}
+
+=item ->storage
+
+the most recently connected stroage object
+(this is a bit icky)
+
+=cut
+
+sub storage {
+    $storage;
+}
+
 1;
+



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