2 # News.pl: Advanced news management
4 # Version: v0.3 (20010412)
6 # Notes: Testing done by greycat, kudos!
9 # news{ channel }{ string } { item }
10 # newsuser{ channel }{ user } = time()
12 # Time - when it was added (used for sorting)
14 # Expire - Time to expire.
22 use vars qw($who $chan);
30 if (!exists $::cache{newsFirst}) {
31 &::DEBUG("news: looks like we enabled news option just then; loading up news file just in case.");
32 $::cache{newsFirst} = 1;
38 if ($::msgType ne "private") {
40 &::msg($who, "I'm not noticing the entire channel. /msg me instead");
43 &::notice($who, "I'm not noticing the entire channel. /msg me instead");
47 if (defined $what and $what =~ s/^($::mask{chan})\s*//) {
48 # TODO: check if the channel exists aswell.
51 if (!&::IsNickInChan($who, $chan)) {
52 &::notice($who, "sorry but you're not on $chan.");
58 my @chans = &::getNickInChans($who);
60 if (scalar @chans > 1) {
61 &::notice($who, "error: I dunno which channel you are referring to since you're on more than one. Try 'news #chan ...' instead");
65 if (scalar @chans == 0) {
66 &::notice($who, "error: I couldn't find you on any chan. This must be a bug!");
71 &::VERB("Guessed $who being on chan $chan",2);
72 $::chan = $chan; # hack for IsChanConf().
75 if (!defined $what or $what =~ /^\s*$/) {
80 if ($what =~ /^add(\s+(.*))?$/i) {
83 } elsif ($what =~ /^del(\s+(.*))?$/i) {
86 } elsif ($what =~ /^mod(\s+(.*))?$/i) {
89 } elsif ($what =~ /^set(\s+(.*))?$/i) {
92 } elsif ($what =~ /^(\d+)$/i) {
93 &::VERB("News: read shortcut called.",2);
96 } elsif ($what =~ /^read(\s+(.*))?$/i) {
99 } elsif ($what =~ /^(latest|new)(\s+(.*))?$/i) {
100 &latest($3 || $chan, 1);
101 # $::cmdstats{'News latest'}++;
103 } elsif ($what =~ /^stats?$/i) {
106 } elsif ($what =~ /^list$/i) {
109 } elsif ($what =~ /^(expire|text|desc)(\s+(.*))?$/i) {
113 my($arg1,$arg2) = split(/\s+/, $3, 2);
114 &set("$arg1 $cmd $arg2");
116 } elsif ($what =~ /^help(\s+(.*))?$/i) {
119 } elsif ($what =~ /^newsflush$/i) {
120 &::msg($who, "newsflush called... check out the logs!");
123 } elsif ($what =~ /^(un)?notify$/i) {
124 my $state = ($1) ? 0 : 1;
126 # TODO: don't notify even if "News" is called.
127 if (&::IsChanConf("newsNotifyAll") <= 0) {
128 &::DEBUG("news: chan => $chan, ::chan => $::chan.");
129 &::notice($who, "not available for this channel or disabled altogether.");
133 my $t = $::newsuser{$chan}{$who};
134 if ($state) { # state = 1
135 if (defined $t and ($t == 0 or $t == -1)) {
136 &::notice($who, "enabled notify.");
137 delete $::newsuser{$chan}{$who};
140 &::notice($who, "already enabled.");
143 my $x = $::newsuser{$chan}{$who};
144 if (defined $x and ($x == 0 or $x == -1)) {
145 &::notice($who, "notify already disabled");
148 $::newsuser{$chan}{$who} = -1;
149 &::notice($who, "notify is now disabled.");
153 &::notice($who, "unknown command: $what");
158 my $file = "$::bot_base_dir/blootbot-news.txt";
159 if (! -f $file or -z $file) {
164 &::DEBUG("readNews: fileno exists, should never happen.");
175 # TODO: allow commands.
177 if (/^[\s\t]+(\S+):[\s\t]+(.*)$/) {
178 if (!defined $item) {
179 &::DEBUG("news: !defined item, never happen!");
183 $::news{$chan}{$item}{$1} = $2;
187 # U <chan> <nick> <time>
188 if (/^U\s+(\S+)\s+(\S+)\s+(\d+)$/) {
189 $::newsuser{$1}{$2} = $3;
194 if (/^(\S+)[\s\t]+(.*)$/) {
202 my $cn = scalar(keys %::news);
203 return unless ($ci or $cn or $cu);
205 &::status("News: read ".
206 $ci. &::fixPlural(" item", $ci). " for ".
207 $cn. &::fixPlural(" chan", $cn). ", ".
208 $cu. &::fixPlural(" user", $cu), " cache"
213 if (!scalar keys %::news and !scalar keys %::newsuser) {
214 &::VERB("wN: nothing to write.",2);
218 # should define this at the top of file.
219 my $file = "$::bot_base_dir/blootbot-news.txt";
222 &::ERROR("News: write: fileno NEWS exists, should never happen.");
226 # TODO: add commands to output file.
228 my($cc,$ci,$cu) = (0,0,0);
230 open(NEWS, ">$file");
231 foreach $chan (sort keys %::news) {
232 $c = scalar keys %{ $::news{$chan} };
237 foreach $item (sort keys %{ $::news{$chan} }) {
238 $c = scalar keys %{ $::news{$chan}{$item} };
242 print NEWS "$chan $item\n";
244 foreach $what (sort keys %{ $::news{$chan}{$item} }) {
245 print NEWS " $what: $::news{$chan}{$item}{$what}\n";
251 # TODO: show how many users we wrote down.
252 if (&::getChanConfList("newsKeepRead")) {
253 # old users are removed in newsFlush(), perhaps it should be
256 foreach $chan (sort keys %::newsuser) {
258 foreach (sort keys %{ $::newsuser{$chan} }) {
259 print NEWS "U $chan $_ $::newsuser{$chan}{$_}\n";
267 &::status("News: Wrote $ci items for $cc chans, $cu user cache.");
273 if (!defined $chan or !defined $str or $str =~ /^\s*$/) {
278 if (length $str > 64) {
279 &::notice($who, "That's not really an item (>64chars)");
283 if (exists $::news{$chan}{$str}{Time}) {
284 &::notice($who, "'$str' for $chan already exists!");
288 $::news{$chan}{$str}{Time} = time();
289 my $expire = &::getChanConfDefault("newsDefaultExpire",7, $chan);
290 $::news{$chan}{$str}{Expire} = time() + $expire*60*60*24;
291 $::news{$chan}{$str}{Author} = $::who; # case!
293 my $agestr = &::Time2String($::news{$chan}{$str}{Expire} - time() );
294 my $item = &newsS2N($str);
295 &::notice($who, "Added '\037$str\037' at [".gmtime(time).
296 "] by \002$::who\002 for item #\002$item\002.");
297 &::notice($who, "Now do 'news text $item <your_description>'");
298 &::notice($who, "This item will expire at \002".
299 gmtime($::news{$chan}{$str}{Expire})."\002 [$agestr from now] "
309 if (!defined $what) {
314 if ($what =~ /^\d+$/) {
315 my $count = scalar keys %{ $::news{$chan} };
317 &::notice($who, "No news for $chan.");
321 if ($what > $count or $what < 0) {
322 &::notice($who, "$what is out of range (max $count)");
326 $item = &getNewsItem($what);
327 $what = $item; # hack hack hack.
330 $_ = &getNewsItem($what); # hack hack hack.
331 $what = $_ if (defined $_);
333 if (!exists $::news{$chan}{$what}) {
335 foreach (keys %{ $::news{$chan} }) {
336 next unless (/\Q$what\E/);
340 if (!scalar @found) {
341 &::notice($who, "could not find $what.");
345 if (scalar @found > 1) {
346 &::notice($who, "too many matches for $what.");
351 &::DEBUG("news: del: str: guessed what => $what");
355 if (exists $::news{$chan}{$what}) {
357 $auth++ if ($::who eq $::news{$chan}{$what}{Author});
358 $auth++ if (&::IsFlag("o"));
361 # TODO: show when it'll expire.
362 &::notice($who, "Sorry, you cannot remove items; just let them expire on their own.");
366 &::notice($who, "ok, deleted '$what' from \002$chan\002...");
367 delete $::news{$chan}{$what};
369 &::notice($who, "error: not found $what in news for $chan.");
374 if (!scalar keys %{ $::news{$chan} }) {
375 &::notice($who, "No news for \002$chan\002.");
379 if (&::IsChanConf("newsKeepRead") > 0) {
380 my $x = $::newsuser{$chan}{$who};
382 if (defined $x and ($x == 0 or $x == -1)) {
383 &::DEBUG("news: not updating time for $who.");
385 if (!scalar keys %{ $::news{$chan} }) {
386 &::DEBUG("news: should not add $chan/$who to cache!");
389 $::newsuser{$chan}{$who} = time();
393 # ¬ice() breaks OPN :( - using msg() instead!
394 my $count = scalar keys %{ $::news{$chan} };
395 &::msg($who, "|==== News for \002$chan\002: ($count items)");
399 foreach (keys %{ $::news{$chan} }) {
400 my $t = $::news{$chan}{$_}{Time};
401 my $e = $::news{$chan}{$_}{Expire};
402 $newest = $t if ($t > $newest);
403 if ($e > 1 and $e < $expire) {
405 &::DEBUG("before newsS2N($_)");
407 &::DEBUG("after newsS2N($_) == $eno");
410 my $timestr = &::Time2String(time() - $newest);
411 &::msg($who, "|= Last updated $timestr ago.");
412 &::msg($who, " \037Num\037 \037Item ".(" "x40)." \037");
414 # &::DEBUG("news: list: expire = $expire");
415 # &::DEBUG("news: list: eno = $eno");
418 foreach ( &getNewsAll() ) {
420 my $setby = $::news{$chan}{$subtopic}{Author};
421 my $chr = (exists $::News{$chan}{$subtopic}{Text}) ? "" : "*";
423 if (!defined $subtopic) {
424 &::DEBUG("news: warn: subtopic == undef.");
428 # TODO: show request stats aswell.
429 &::msg($who, sprintf("\002[\002%2d\002]\002%s %s",
430 $i, $chr, $subtopic));
434 my $z = $::newsuser{$who};
436 &::DEBUG("cache $who: $z");
438 &::DEBUG("cache: $who doesn't have newscache set.");
441 &::msg($who, "|= End of News.");
442 &::msg($who, "use 'news read <#>' or 'news read <keyword>'");
448 if (!defined $chan or !defined $str or $str =~ /^\s*$/) {
449 &::help("news read");
453 if (!scalar keys %{ $::news{$chan} }) {
454 &::notice($who, "No news for \002$chan\002.");
458 my $item = &getNewsItem($str);
459 if (!defined $item or !scalar keys %{ $::news{$chan}{$item} }) {
460 # TODO: numerical check.
461 if ($str =~ /^(\d+)[-, ](\d+)$/ or
462 $str =~ /^-(\d+)$/ or
463 $str =~ /^(\d+)-$/ or 0
465 &::notice($who, "We don't support multiple requests of news items yet. Sorry.");
469 &::notice($who, "No news item called '$str'");
473 if (!exists $::news{$chan}{$item}{Text}) {
474 &::notice($who, "Someone forgot to add info to this news item");
478 my $t = gmtime( $::news{$chan}{$item}{Time} );
479 my $a = $::news{$chan}{$item}{Author};
480 my $text = $::news{$chan}{$item}{Text};
481 my $num = &newsS2N($item);
482 my $rwho = $::news{$chan}{$item}{Request_By} || $::who;
483 my $rcount = $::news{$chan}{$item}{Request_Count} || 0;
485 if (length $text < $::param{maxKeySize}) {
486 &::VERB("NEWS: Possible news->factoid redirection.",2);
487 my $f = &::getFactoid($text);
490 &::VERB("NEWS: ok, $text is factoid redirection.",2);
491 $f =~ s/^<REPLY>\s*//i; # anything else?
496 $_ = $::news{$chan}{$item}{'Expire'};
499 $e = sprintf("\037%s\037 [%s from now]",
501 &::Time2String($_ - time())
505 &::notice($who, "+- News \002$chan\002 #$num: $item");
506 &::notice($who, "| Added by $a at \037$t\037");
507 &::notice($who, "| Expire: $e") if (defined $e);
508 &::notice($who, $text);
509 &::notice($who, "| Requested \002$rcount\002 times, last by \002$rwho\002") if ($rcount and $rwho);
511 $::news{$chan}{$item}{'Request_By'} = $::who;
512 $::news{$chan}{$item}{'Request_Time'} = time();
513 $::news{$chan}{$item}{'Request_Count'}++;
517 my($item, $str) = split /\s+/, $_[0], 2;
519 if (!defined $item or $item eq "" or $str =~ /^\s*$/) {
524 my $news = &getNewsItem($item);
526 if (!defined $news) {
527 &::DEBUG("news: error: mod: news == undefined.");
530 my $nnews = $::news{$chan}{$news}{Text};
531 my $mod_news = $news;
532 my $mod_nnews = $nnews;
535 if ($str =~ m|^\s*s([/,#\|])(.+?)\1(.*?)\1([a-z]*);?\s*$|) {
536 my ($delim, $op, $np, $flags) = ($1,$2,$3,$4);
538 if ($flags !~ /^(g)?$/) {
539 &::notice($who, "error: Invalid flags to regex.");
543 ### TODO: use m### to make code safe!
544 # TODO: make code safer.
546 # TODO: use eval to deal with flags easily.
548 $done++ if (!$done and $mod_news =~ s/\Q$op\E/$np/);
549 $done++ if (!$done and $mod_nnews =~ s/\Q$op\E/$np/);
550 } elsif ($flags eq "g") {
551 $done++ if ($mod_news =~ s/\Q$op\E/$np/g);
552 $done++ if ($mod_nnews =~ s/\Q$op\E/$np/g);
556 &::notice($who, "warning: regex not found in news.");
560 if ($mod_news ne $news) { # news item.
561 if (exists $::news{$chan}{$mod_news}) {
562 &::notice($who, "item '$mod_news' already exists.");
566 &::notice($who, "Moving item '$news' to '$mod_news' with SAR s/$op/$np/.");
567 foreach (keys %{ $::news{$chan}{$news} }) {
568 $::news{$chan}{$mod_news}{$_} = $::news{$chan}{$news}{$_};
569 delete $::news{$chan}{$news}{$_};
572 delete $::news{$chan}{$news};
575 if ($mod_nnews ne $nnews) { # news Text/Description.
576 &::notice($who, "Changing text for '$news' SAR s/$op/$np/.");
577 if ($mod_news ne $news) {
578 $::news{$chan}{$mod_news}{Text} = $mod_nnews;
580 $::news{$chan}{$news}{Text} = $mod_nnews;
586 &::notice($who, "error: that regex failed ;(");
590 &::notice($who, "error: Invalid regex. Try s/1/2/, s#3#4#...");
595 my($item, $what, $value);
597 if (!defined $args) {
598 &::DEBUG("news: set: args == NULL.");
602 $item = $1 if ($args =~ s/^(\S+)\s*//);
603 $what = $1 if ($args =~ s/^(\S+)\s*//);
611 my $news = &getNewsItem($item);
613 if (!defined $news) {
614 &::notice($who, "Could not find item '$item' substring or # in news list.");
618 # list all values for chan.
619 if (!defined $what or $what =~ /^\s*$/) {
620 &::msg($who, "set: you didn't fill me on the arguments! (what and values)");
625 my @elements = ("Expire","Text");
626 foreach (@elements) {
627 next unless ($what =~ /^$_$/i);
634 &::notice($who, "Invalid set. Try: @elements");
639 if (!defined $value or $value =~ /^\s*$/) {
640 &::msg($who, "set: you didn't fill me on the arguments! (value)");
644 if (!exists $::news{$chan}{$news}) {
645 &::notice($who, "news '$news' does not exist");
649 if ($what eq "Expire") {
650 # TODO: use do_set().
653 my $plus = ($value =~ s/^\+//g);
654 while ($value =~ s/^(\d+)(\S*)\s*//) {
655 my($int,$unit) = ($1,$2);
656 $time += $int if ($unit =~ /^s(ecs?)?$/i);
657 $time += $int*60 if ($unit =~ /^m(in(utes?)?)?$/i);
658 $time += $int*60*60 if ($unit =~ /^h(ours?)?$/i);
659 $time += $int*60*60*24 if (!$unit or $unit =~ /^d(ays?)?$/i);
660 $time += $int*60*60*24*7 if ($unit =~ /^w(eeks?)?$/i);
661 $time += $int*60*60*24*30 if ($unit =~ /^mon(th)?$/i);
664 if ($value =~ s/^never$//i) {
671 # from creation of item.
672 $time += $::news{$chan}{$news}{Time};
675 if (!$time or ($value and $value !~ /^never$/i)) {
676 &::DEBUG("news: set: Expire... need to parse.");
677 &::msg($who, "hrm... couldn't parse that.");
682 &::notice($who, "Set never expire for \002$item\002." );
683 } elsif ($time < -1) {
684 &::DEBUG("news: time should never be negative ($time).");
687 &::notice($who, "Set expire for \002$item\002, to ".
688 gmtime($time) ." [".&::Time2String($time - time())."]" );
690 if (time() > $time) {
691 &::DEBUG("news: hrm... time() > $time, should expire.");
696 $::news{$chan}{$news}{Expire} = $time;
702 # &::DEBUG("news: who => '$who'");
703 my $author = $::news{$chan}{$news}{Author};
704 $auth++ if ($::who eq $author);
705 $auth++ if (&::IsFlag("o"));
706 if (!defined $author) {
707 &::DEBUG("news: news{$chan}{$news}{Author} is not defined! auth'd anyway");
708 $::news{$chan}{$news}{Author} = $::who;
714 # TODO: show when it'll expire.
715 &::notice($who, "Sorry, you cannot set items. (author $author owns it)");
719 # TODO: clean this up.
720 my $old = $::news{$chan}{$news}{$what};
722 &::DEBUG("news: old => $old.");
724 $::news{$chan}{$news}{$what} = $value;
725 &::notice($who, "Setting [$chan]/{$news}/<$what> to '$value'.");
729 my ($tchan, $flag) = @_;
731 # hack hack hack. fix later.
735 # TODO: if chan = undefined, guess.
736 # if (!exists $::news{$chan}) {
737 if (!exists $::channels{$chan}) {
738 &::notice($who, "invalid chan $chan") if ($flag);
742 my $t = $::newsuser{$chan}{$who};
744 # &::DEBUG("newsuser: $chan/$who == $t");
746 # &::DEBUG("newsuser: $chan/$who == undefined");
749 if (defined $t and ($t == 0 or $t == -1)) {
751 &::notice($who, "if you want to read news, try \002/msg $::ident news $chan\002 or \002/msg $::ident news $chan notify\002");
753 &::DEBUG("news: not displaying any new news for $who");
759 return if (&::IsChanConf("newsNotifyAll") <= 0);
761 # I don't understand this code ;)
762 $t = 1 if (!defined $t);
765 # &::msg($who, "News is disabled for $chan");
766 &::DEBUG("news: $chan: something went really wrong.");
771 foreach (keys %{ $::news{$chan} }) {
772 next if (!defined $t);
773 next if ($t > $::news{$chan}{$_}{Time});
775 # don't list new items if they don't have Text.
776 if (!exists $::news{$chan}{$_}{Text}) {
777 if (time() - $::news{$chan}{$_}{Time} > 60*60*24*3) {
778 &::DEBUG("deleting news{$chan}{$_} because it was too old and had no text info.");
779 delete $::news{$chan}{$_};
788 # !scalar @new, $flag
789 if (!scalar @new and $flag) {
790 &::notice($who, "no new news for $chan for $who.");
792 $::newsuser{$chan}{$who} = time();
796 # scalar @new, !$flag
797 my $unread = scalar @new;
798 my $total = scalar keys %{ $::news{$chan} };
799 if (!$flag && &::IsChanConf("newsTellUnread") <= 0) {
804 return unless ($unread);
806 # just a temporary measure not to flood ourself off the
807 # network with news until we get global notice() and msg()
809 if (time() - ($::cache{newsTime} || 0) < 5) {
810 &::status("news: not displaying latest notice to $who/$chan.");
814 $::cache{newsTime} = time();
815 my $reply = "There are unread news in $chan ($unread unread, $total total). /msg $::ident news $::chan latest";
816 $reply .= " If you don't want further news notification, /msg $::ident news unnotify" if ($unread == $total);
817 &::notice($who, $reply);
824 &::notice($who, "+==== New news for \002$chan\002 ($unread new; $total total):");
826 my $t = $::newsuser{$chan}{$who};
827 if (defined $t and $t > 1) {
828 my $timestr = &::Time2String( time() - $t );
829 &::notice($who, "|= Last time read $timestr ago");
839 for ($i=0; $i<=scalar(@sorted); $i++) {
840 my $news = $sorted[$i];
841 next unless (defined $news);
843 # my $age = time() - $::news{$chan}{$news}{Time};
844 my $msg = sprintf("\002[\002%2d\002]\002 %s", $i, $news);
845 ### $i, $_, &::Time2String($age)
846 $::conn->schedule(int((2+$i)/2), sub {
847 &::notice($who, $msg);
851 # TODO: implement throttling via schedule into ¬ice() / &msg().
852 $::conn->schedule(int((2+$i)/2), sub {
853 &::notice($who, "|= to read, do \002news $chan read <#>\002 or \002news $chan read <keyword>\002");
856 # lame hack to prevent dupes if we just ignore it.
857 my $x = $::newsuser{$chan}{$who};
858 if (defined $x and ($x == 0 or $x == -1)) {
859 &::DEBUG("news: not updating time for $who. (2)");
861 $::newsuser{$chan}{$who} = time();
872 foreach (keys %{ $::news{$chan} }) {
873 $time{ $::news{$chan}{$_}{Time} } = $_;
877 foreach (sort { $a <=> $b } keys %time) {
878 push(@items, $time{$_});
891 foreach (keys %{ $::news{$chan} }) {
892 my $t = $::news{$chan}{$_}{Time};
894 if (!defined $t or $t !~ /^\d+$/) {
895 &::DEBUG("news: warn: t is undefined for news{$chan}{$_}{Time}; removing item.");
896 delete $::news{$chan}{$_};
903 foreach (sort { $a <=> $b } keys %time) {
905 return $item if ($time{$_} eq $what);
908 &::DEBUG("newsS2N($what): failed...");
915 $what =~ s/^\#//; # '#1' for example.
918 foreach (keys %{ $::news{$chan} }) {
919 my $t = $::news{$chan}{$_}{Time};
921 if (!defined $t or $t !~ /^\d+$/) {
922 &::DEBUG("news: warn: t is undefined for news{$chan}{$_}{Time}; removing item.");
923 delete $::news{$chan}{$_};
930 # number to string resolution.
931 if ($what =~ /^\d+$/) {
932 foreach (sort { $a <=> $b } keys %time) {
934 return $time{$_} if ($item == $what);
938 # partial string to full string resolution
939 # in some cases, string->number resolution.
943 foreach (sort { $a <=> $b } keys %time) {
945 # $no = $item if ($time{$_} eq $what);
946 ## if ($time{$_} eq $what) {
951 push(@items, $time{$_}) if ($time{$_} =~ /\Q$what\E/i);
954 ## if (defined $no and !@items) {
955 ## &::DEBUG("news: string->number resolution: $what->$no.");
959 if (scalar @items > 1) {
960 &::DEBUG("news: Multiple matches, not guessing.");
961 &::notice($who, "Multiple matches, not guessing.");
966 # &::DEBUG("news: gNI: part_string->full_string: $what->$items[0]");
969 &::DEBUG("news: gNI: No match for '$what'");
974 &::ERROR("news: gNI: should not happen (what = $what)");
979 my($what,$value) = @_;
981 if (!defined $chan) {
982 &::DEBUG("news: do_set: chan not defined.");
986 if (!defined $what or $what =~ /^\s*$/) {
987 &::DEBUG("news: what $what is not defined.");
991 if (!defined $value or $value =~ /^\s*$/) {
992 &::DEBUG("news: value $value is not defined.");
996 &::TODO("news: do_set:");
1000 &::DEBUG("News: stats called.");
1001 &::msg($who, "check my logs/console.");
1004 # total request count.
1005 foreach $chan (keys %::news) {
1006 foreach (keys %{ $::news{$chan} }) {
1007 $i += $::news{$chan}{$_}{Request_Count};
1010 &::DEBUG("news: stats: total request count => $i");
1013 # total user cached.
1014 foreach $chan (keys %::newsuser) {
1015 $i += $::newsuser{$chan}{$_};
1017 &::DEBUG("news: stats: total user cache => $i");
1020 # average latest time read.
1022 foreach $chan (keys %::newsuser) {
1023 $i += $t - $::newsuser{$chan}{$_};
1024 &::DEBUG(" i = $i");
1027 &::DEBUG("news: stats: average latest time read: total time: $i");
1028 &::DEBUG("news: ... count: $j");
1029 &::DEBUG("news: average: ".sprintf("%.02f", $i/($j||1))." sec/user");
1033 sub AUTOLOAD { &::AUTOLOAD(@_); }