/[notice-sender]/trunk/soap.cgi
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/soap.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (show annotations)
Tue May 17 15:03:57 2005 UTC (18 years, 11 months ago) by dpavlin
File size: 1633 byte(s)
added positional API for SOAP (PEAR SOAP library nas problems with named
variables)

1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 soap.cgi - CGI SOAP interface to notice sender
6
7 =cut
8
9 use strict;
10 use Nos;
11
12 my $nos = new Nos(
13 dsn => 'dbi:Pg:dbname=notices',
14 user => 'dpavlin',
15 passwd => '',
16 );
17
18 use SOAP::Transport::HTTP +trace => 'debug';
19 SOAP::Transport::HTTP::CGI
20 ->dispatch_to('Nos::SOAP')
21 ->handle;
22
23 package Nos::SOAP;
24
25 =head1 SOAP methods
26
27 This methods are thin wrappers to provide SOAP calls.
28
29 Usually, you want to used named variables in your SOAP calls if at all
30 possible. However, if you have broken SOAP libraries (like PHP's PEAR SOAP)
31 you will want to use positional arguments (in same order as documented for
32 methods below).
33
34 =head2 NewList
35
36 $message_id = NewList(
37 list => 'My list',
38 email => 'my-list@example.com'
39 );
40
41 =cut
42
43 sub NewList {
44 my $self = shift;
45
46 if ($_[0] !~ m/^HASH/) {
47 return $nos->new_list(
48 list => $_[0], email => $_[1],
49 );
50 } else {
51 return $nos->new_list( %{ shift @_ } );
52 }
53 }
54
55 =head2 AddMemberToList
56
57 $member_id = AddMemberToList(
58 list => "My list",
59 email => "e-mail@example.com",
60 name => "Full Name"
61 );
62
63 =cut
64
65 sub AddMemberToList {
66 my $self = shift;
67
68 if ($_[0] !~ m/^HASH/) {
69 return $nos->add_member_to_list(
70 list => $_[0], email => $_[1], name => $_[2],
71 );
72 } else {
73 return $nos->add_member_to_list( %{ shift @_ } );
74 }
75 }
76
77 =head2 AddMessageToList
78
79 $message_id = AddMessageToList(
80 list => 'My list',
81 message => 'From: My list...'
82 );
83
84 =cut
85
86 sub AddMessageToList {
87 my $self = shift;
88
89 if ($_[0] !~ m/^HASH/) {
90 return $nos->add_message_to_list(
91 list => $_[0], message => $_[1],
92 );
93 } else {
94 return $nos->add_message_to_list( %{ shift @_ } );
95 }
96 }
97

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26