20 |
my $VERBOSE; |
my $VERBOSE; |
21 |
my $directory = './module/'; |
my $directory = './module/'; |
22 |
my $posted_log = '.posted'; |
my $posted_log = '.posted'; |
23 |
|
my $module_pattern = q([A-Za-z0-9_]+); |
24 |
GetOptions ( |
GetOptions ( |
25 |
debug => \$Bunshin::DEBUG, |
debug => \$Bunshin::DEBUG, |
26 |
'module-dir=s' => \$directory, |
'module-dir=s' => \$directory, |
27 |
|
'module-name=s' => \$module_pattern, |
28 |
'nntp-server=s' => \$NNTP_SERVER, |
'nntp-server=s' => \$NNTP_SERVER, |
29 |
'posted-log=s' => \$posted_log, |
'posted-log=s' => \$posted_log, |
30 |
verbose => \$VERBOSE, |
verbose => \$VERBOSE, |
36 |
binmode STDOUT; |
binmode STDOUT; |
37 |
|
|
38 |
opendir DIR, $directory; |
opendir DIR, $directory; |
39 |
my @module = sort map {s/\.sb$//; $_} grep /^[A-Za-z0-9_]+\.sb$/, readdir DIR; |
my @module = sort map {s/\.sb$//; $_} grep /^$module_pattern\.sb$/, readdir DIR; |
40 |
close DIR; |
close DIR; |
41 |
die "$0: $directory: No suikawari definition" if @module == 0; |
die "$0: $directory: No suikawari definition" if @module == 0; |
42 |
push @main::INC, $directory; |
push @main::INC, $directory; |
54 |
close LOG; |
close LOG; |
55 |
} |
} |
56 |
|
|
57 |
|
my $nntp; |
58 |
for (@module) { |
for (@module) { |
59 |
vprint $_; |
vprint $_; |
60 |
my $module = "Suikawari::$_"; |
my $module = "Suikawari::$_"; |
73 |
$module->on_load_source ($b); |
$module->on_load_source ($b); |
74 |
$b->set_source ($module->source); |
$b->set_source ($module->source); |
75 |
$module->on_make ($b); |
$module->on_make ($b); |
76 |
my ($nntp, $time); |
my ($time); |
77 |
my $latest_time = $plog->field ($_, -new_item_unless_exist => 0); |
my $latest_time = $plog->field ($_, -new_item_unless_exist => 0); |
78 |
dprint 'Latest-Posted-Date: '.$latest_time; |
dprint 'Latest-Posted-Date: '.$latest_time; |
79 |
for ($b->make_msgs) { |
for ($b->make_msgs) { |
87 |
send_msg ($_ => $nntp); |
send_msg ($_ => $nntp); |
88 |
$time = $t if $t > $time || !$time; |
$time = $t if $t > $time || !$time; |
89 |
} |
} |
|
close_nntp ($nntp); |
|
90 |
$plog->replace ($_ => $time) if $time > $latest_time; |
$plog->replace ($_ => $time) if $time > $latest_time; |
91 |
} |
} |
92 |
|
close_nntp ($nntp); |
93 |
|
|
94 |
open LOG, '> '.$posted_log or die "$0: $posted_log: $!"; |
open LOG, '> '.$posted_log or die "$0: $posted_log: $!"; |
95 |
binmode LOG; |
binmode LOG; |