/[notice-sender]/trunk/sender.pl
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/sender.pl

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

revision 2 by dpavlin, Fri May 13 22:08:44 2005 UTC revision 3 by dpavlin, Sat May 14 10:44:53 2005 UTC
# Line 23  my $loader = Class::DBI::Loader::Pg->new Line 23  my $loader = Class::DBI::Loader::Pg->new
23          namespace       => "Noticer",          namespace       => "Noticer",
24  #       additional_classes      => qw/Class::DBI::AbstractSearch/,  #       additional_classes      => qw/Class::DBI::AbstractSearch/,
25  #       additional_base_classes => qw/My::Stuff/,  #       additional_base_classes => qw/My::Stuff/,
26          relationships   => 1          relationships   => 1,
27  );  );
28    
29  my $lists = $loader->find_class('lists');  my $lists = $loader->find_class('lists');
# Line 40  if ($list_opt) { Line 40  if ($list_opt) {
40          }          }
41  } elsif ($add_opt) {  } elsif ($add_opt) {
42          #my $noticer = $loader->find_class('Noticer') || die "can't find my class!";          #my $noticer = $loader->find_class('Noticer') || die "can't find my class!";
         foreach my $c_name ($loader->tables) {  
                 my $c = $loader->find_class($c_name)|| die "can't find $c_name";  
                 $c->autoupdate(1);  
         }  
                   
43          my $list = $lists->find_or_create({          my $list = $lists->find_or_create({
44                  name => $add_opt,                  name => $add_opt,
45          }) || die "can't add list $add_opt\n";          }) || die "can't add list $add_opt\n";
         my $added = 0;  
46          while(<>) {          while(<>) {
47                  chomp;                  chomp;
48                  next if (/^#/ || /^\s*$/);                  next if (/^#/ || /^\s*$/);
# Line 63  if ($list_opt) { Line 57  if ($list_opt) {
57                          list_id => $list->id,                          list_id => $list->id,
58                  }) || die "can't add user to list";                  }) || die "can't add user to list";
59          }          }
60          print "processed $added members\n";  
61            foreach my $c_name ($loader->tables) {
62                    my $c = $loader->find_class($c_name)|| die "can't find $c_name";
63                    $c->dbi_commit();
64            }
65    
66  } else  {  } else  {
67          die "$0 --lists --list-add=name_of_list --debug\n";          die "$0 --list --add=name_of_list --debug\n";
68  }  }
69    
70    

Legend:
Removed from v.2  
changed lines
  Added in v.3

  ViewVC Help
Powered by ViewVC 1.1.26