--- trunk/soap.cgi 2005/05/17 21:37:06 38 +++ trunk/soap.cgi 2005/05/17 22:23:40 39 @@ -4,12 +4,18 @@ soap.cgi - CGI SOAP interface to notice sender +=head1 DESCRIPTION + +Provide example SOAP service using CGI script. + +Available methods are in C package, see L. + =cut use strict; use Nos; -my $nos = new Nos( +my $nos = new Nos::SOAP( dsn => 'dbi:Pg:dbname=notices', user => 'dpavlin', passwd => '', @@ -20,81 +26,4 @@ ->dispatch_to('Nos::SOAP') ->handle; -package Nos::SOAP; - -=head1 SOAP methods - -This methods are thin wrappers to provide SOAP calls. - -Usually, you want to use named variables in your SOAP calls if at all -possible. - -However, if you have broken SOAP library (like PHP SOAP class from PEAR) -you will want to use positional arguments (in same order as documented for -methods below). - -=head2 NewList - - $message_id = NewList( - list => 'My list', - email => 'my-list@example.com' - ); - -=cut - -sub NewList { - my $self = shift; - - if ($_[0] !~ m/^HASH/) { - return $nos->new_list( - list => $_[0], email => $_[1], - ); - } else { - return $nos->new_list( %{ shift @_ } ); - } -} - -=head2 AddMemberToList - - $member_id = AddMemberToList( - list => "My list", - email => "e-mail@example.com", - name => "Full Name" - ); - -=cut - -sub AddMemberToList { - my $self = shift; - - if ($_[0] !~ m/^HASH/) { - return $nos->add_member_to_list( - list => $_[0], email => $_[1], name => $_[2], - ); - } else { - return $nos->add_member_to_list( %{ shift @_ } ); - } -} - -=head2 AddMessageToList - - $message_id = AddMessageToList( - list => 'My list', - message => 'From: My list...' - ); - -=cut - -sub AddMessageToList { - my $self = shift; - - if ($_[0] !~ m/^HASH/) { - return $nos->add_message_to_list( - list => $_[0], message => $_[1], - ); - } else { - return $nos->add_message_to_list( %{ shift @_ } ); - } -} - 1;