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'); |
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*$/); |
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 |
|
|