X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=blobdiff_plain;f=gatherstats.pl;h=160c115df856bcfc893d520c21ea9f878e4a2ce2;hp=ae7d65dd890725cced757ce1c5178268b71f9779;hb=439c85a28071a8b44b1710926e471399a71cfd1c;hpb=b5125b1099cf5cf12beb0520d5896b9a1d7850ae diff --git a/gatherstats.pl b/gatherstats.pl index ae7d65d..160c115 100755 --- a/gatherstats.pl +++ b/gatherstats.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -W +#! /usr/bin/perl # # gatherstats.pl # @@ -18,8 +18,9 @@ BEGIN { push(@INC, dirname($0)); } use strict; +use warnings; -use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ReadGroupList); +use NewsStats qw(:DEFAULT :TimePeriods ListNewsgroups ParseHierarchies ReadGroupList); use DBI; use Getopt::Long qw(GetOptions); @@ -145,13 +146,15 @@ foreach my $Month (&ListMonth($Period)) { if (%ValidGroups) { foreach (sort keys %ValidGroups) { if (!defined($Postings{$_})) { - # expand newsgroup with hierarchies - my @Newsgroups = ParseHierarchies($_); - # add each empty newsgroup and empty hierarchies, too, as needed - foreach (@Newsgroups) { - if (!defined($Postings{$_})) { - $Postings{$_} = 0; - warn (sprintf("ADDED: %s as empty group\n",$_)); + # add current newsgroup as empty group + $Postings{$_} = 0; + warn (sprintf("ADDED: %s as empty group\n",$_)); + # add empty hierarchies for current newsgroup as needed + foreach (ParseHierarchies($_)) { + my $Hierarchy = $_ . '.ALL'; + if (!defined($Postings{$Hierarchy})) { + $Postings{$Hierarchy} = 0; + warn (sprintf("ADDED: %s as empty group\n",$Hierarchy)); }; }; }