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

Diff of /trunk/Nos.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 71 by dpavlin, Mon Aug 22 19:25:24 2005 UTC revision 72 by dpavlin, Mon Aug 22 20:24:04 2005 UTC
# Line 16  our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all' Line 16  our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'
16  our @EXPORT = qw(  our @EXPORT = qw(
17  );  );
18    
19  our $VERSION = '0.6';  our $VERSION = '0.7';
20    
21  use Class::DBI::Loader;  use Class::DBI::Loader;
22  use Email::Valid;  use Email::Valid;
# Line 120  sub new { Line 120  sub new {
120  }  }
121    
122    
123  =head2 new_list  =head2 create_list
124    
125  Create new list. Required arguments are name of C<list>, C<email> address  Create new list. Required arguments are name of C<list>, C<email> address
126  and path to C<aliases> file.  and path to C<aliases> file.
127    
128   $nos->new_list(   $nos->create_list(
129          list => 'My list',          list => 'My list',
130          from => 'Outgoing from comment',          from => 'Outgoing from comment',
131          email => 'my-list@example.com',          email => 'my-list@example.com',
# Line 139  Calls internally C<_add_list>, see detai Line 139  Calls internally C<_add_list>, see detai
139    
140  =cut  =cut
141    
142  sub new_list {  sub create_list {
143          my $self = shift;          my $self = shift;
144    
145          my $arg = {@_};          my $arg = {@_};
# Line 158  sub new_list { Line 158  sub new_list {
158  }  }
159    
160    
161  =head2 delete_list  =head2 drop_list
162    
163  Delete list from database.  Delete list from database.
164    
165   my $ok = delete_list(   my $ok = drop_list(
166          list => 'My list'          list => 'My list'
167          aliases => '/etc/mail/mylist',          aliases => '/etc/mail/mylist',
168   );   );
# Line 171  Returns false if list doesn't exist. Line 171  Returns false if list doesn't exist.
171    
172  =cut  =cut
173    
174  sub delete_list {  sub drop_list {
175          my $self = shift;          my $self = shift;
176    
177          my $args = {@_};          my $args = {@_};
# Line 939  sub new { Line 939  sub new {
939  }  }
940    
941    
942  =head2 NewList  =head2 CreateList
943    
944   $message_id = NewList(   $message_id = CreateList(
945          list => 'My list',          list => 'My list',
946          from => 'Name of my list',          from => 'Name of my list',
947          email => 'my-list@example.com'          email => 'my-list@example.com'
# Line 949  sub new { Line 949  sub new {
949    
950  =cut  =cut
951    
952  sub NewList {  sub CreateList {
953          my $self = shift;          my $self = shift;
954    
955          my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor";          my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor";
956    
957          if ($_[0] !~ m/^HASH/) {          if ($_[0] !~ m/^HASH/) {
958                  return $nos->new_list(                  return $nos->create_list(
959                          list => $_[0], from => $_[1], email => $_[2],                          list => $_[0], from => $_[1], email => $_[2],
960                          aliases => $aliases,                          aliases => $aliases,
961                  );                  );
962          } else {          } else {
963                  return $nos->new_list( %{ shift @_ }, aliases => $aliases );                  return $nos->create_list( %{ shift @_ }, aliases => $aliases );
964          }          }
965  }  }
966    
967    
968  =head2 DeleteList  =head2 DropList
969    
970   $ok = DeleteList(   $ok = DropList(
971          list => 'My list',          list => 'My list',
972   );   );
973    
974  =cut  =cut
975    
976  sub DeleteList {  sub DropList {
977          my $self = shift;          my $self = shift;
978    
979          my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor";          my $aliases = $nos->{'aliases'} || croak "need 'aliases' argument to new constructor";
980    
981          if ($_[0] !~ m/^HASH/) {          if ($_[0] !~ m/^HASH/) {
982                  return $nos->delete_list(                  return $nos->drop_list(
983                          list => $_[0],                          list => $_[0],
984                          aliases => $aliases,                          aliases => $aliases,
985                  );                  );
986          } else {          } else {
987                  return $nos->delete_list( %{ shift @_ }, aliases => $aliases );                  return $nos->drop_list( %{ shift @_ }, aliases => $aliases );
988          }          }
989  }  }
990    

Legend:
Removed from v.71  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26