--- trunk/Nos.pm 2005/08/02 19:41:28 70 +++ trunk/Nos.pm 2005/08/24 17:19:16 74 @@ -16,7 +16,7 @@ our @EXPORT = qw( ); -our $VERSION = '0.6'; +our $VERSION = '0.7'; use Class::DBI::Loader; use Email::Valid; @@ -62,9 +62,9 @@ It will just queue your e-mail message to particular list (sending it to possibly remote Notice Sender SOAP server just once), send it out at reasonable rate (so that it doesn't flood your e-mail infrastructure) and -track replies. +keep track replies. -It is best used to send smaller number of messages to more-or-less fixed +It is best used to send small number of messages to more-or-less fixed list of recipients while allowing individual responses to be examined. Tipical use include replacing php e-mail sending code with SOAP call to Notice Sender. It does support additional C field for each member @@ -72,7 +72,7 @@ particular user. It comes with command-line utility C which can be used to perform -all available operation from scripts (see C). +all available operation from scripts (see C). This command is also useful for debugging while writing client SOAP application. @@ -120,12 +120,12 @@ } -=head2 new_list +=head2 create_list Create new list. Required arguments are name of C, C address and path to C file. - $nos->new_list( + $nos->create_list( list => 'My list', from => 'Outgoing from comment', email => 'my-list@example.com', @@ -139,7 +139,7 @@ =cut -sub new_list { +sub create_list { my $self = shift; my $arg = {@_}; @@ -158,11 +158,11 @@ } -=head2 delete_list +=head2 drop_list Delete list from database. - my $ok = delete_list( + my $ok = drop_list( list => 'My list' aliases => '/etc/mail/mylist', ); @@ -171,7 +171,7 @@ =cut -sub delete_list { +sub drop_list { my $self = shift; my $args = {@_}; @@ -267,7 +267,7 @@ list => 'My list', ); -Returns array of hashes with user informations like this: +Returns array of hashes with user information like this: $member = { name => 'Dobrica Pavlinusic', @@ -699,7 +699,7 @@ =head2 _add_aliases -Add or update alias in C (or equivavlent) file for selected list +Add or update alias in C (or equivalent) file for selected list my $ok = $nos->add_aliases( list => 'My list', @@ -735,6 +735,8 @@ chmod 0777, $aliases || warn "can't change permission to 0777"; } + die "FATAL: aliases file $aliases is not writable\n" unless (-w $aliases); + my $a = new Mail::Alias($aliases) || croak "can't open aliases file $aliases: $!"; my $target = ''; @@ -937,9 +939,9 @@ } -=head2 NewList +=head2 CreateList - $message_id = NewList( + $message_id = CreateList( list => 'My list', from => 'Name of my list', email => 'my-list@example.com' @@ -947,42 +949,42 @@ =cut -sub NewList { +sub CreateList { my $self = shift; my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor"; if ($_[0] !~ m/^HASH/) { - return $nos->new_list( + return $nos->create_list( list => $_[0], from => $_[1], email => $_[2], aliases => $aliases, ); } else { - return $nos->new_list( %{ shift @_ }, aliases => $aliases ); + return $nos->create_list( %{ shift @_ }, aliases => $aliases ); } } -=head2 DeleteList +=head2 DropList - $ok = DeleteList( + $ok = DropList( list => 'My list', ); =cut -sub DeleteList { +sub DropList { my $self = shift; my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor"; if ($_[0] !~ m/^HASH/) { - return $nos->delete_list( + return $nos->drop_list( list => $_[0], aliases => $aliases, ); } else { - return $nos->delete_list( %{ shift @_ }, aliases => $aliases ); + return $nos->drop_list( %{ shift @_ }, aliases => $aliases ); } } @@ -1018,10 +1020,6 @@ Returns array of hashes with user informations, see C. -Returning arrays from SOAP calls is somewhat fuzzy (at least to me). It -seems that SOAP::Lite client thinks that it has array with one element which -is array of hashes with data. - =cut sub ListMembers { @@ -1082,9 +1080,53 @@ } } +=head1 UNIMPLEMENTED FUNCTIONS + +This is a stub for documentation of unimplemented functions. + +=head2 MessagesReceived + + my @result = MessagesReceived( + list => 'My list', + email => 'jdoe@example.com', + ); + +You can specify just C or C or any combination of those. + +It will return array of hashes with following structure: + + { + id => 42, # unique ID of received message + list => 'My list', # useful only of filtering by email + ext_id => 9999, # ext_id from message user + email => 'jdoe@example.com', # e-mail of user + bounced => 0, # true value if message is bounce + date => '2005-08-24 18:57:24', # date of recival in ISO format + } + +=head2 MessagesReceivedByDate + +=head2 MessagesReceivedByDateWithContent + +=head2 ReceivedMessasgeContent + +Return content of received message. + + my $mail_body = ReceivedMessageContent( id => 42 ); + +=cut + + + ### +=head1 NOTE ON ARRAYS IN SOAP + +Returning arrays from SOAP calls is somewhat fuzzy (at least to me). It +seems that SOAP::Lite client thinks that it has array with one element which +is array of hashes with data. + =head1 EXPORT Nothing.