X-Git-Url: https://code.th-h.de/?p=usenet%2Fnewsstats.git;a=blobdiff_plain;f=NewsStats.pm;h=cc3dd83d85629a70a41f9702b151646279483912;hp=2cb1be2ebf66a62bb7e7edafee890d9af8c38be9;hb=17ffbebad562acd3af71328cdbf187297b5a9e6d;hpb=ad6097927113a27587ed8b1785f18c4b18db58e8 diff --git a/NewsStats.pm b/NewsStats.pm index 2cb1be2..cc3dd83 100644 --- a/NewsStats.pm +++ b/NewsStats.pm @@ -36,11 +36,11 @@ require Exporter; FormatOutput SQLHierarchies SQLGroupList - GetMaxLenght + GetMaxLength ); %EXPORT_TAGS = ( TimePeriods => [qw(GetTimePeriod LastMonth CheckMonth SplitPeriod ListMonth)], Output => [qw(OutputData FormatOutput)], - SQLHelper => [qw(SQLHierarchies SQLGroupList GetMaxLenght)]); + SQLHelper => [qw(SQLHierarchies SQLGroupList GetMaxLength)]); $VERSION = '0.01'; our $PackageVersion = '0.01'; @@ -156,10 +156,11 @@ sub ListNewsgroups { ### hierarchy names where every newsgroup and hierarchy appears only once: ### de.alt.test,de.alt.admin -> de.ALL, de.alt.ALL, de.alt.test, de.alt.admin ### IN : $Newsgroups : a list of newsgroups (content of Newsgroups: header) +### $TLH : top level hierarchy (all other newsgroups are ignored) ### $ValidGroupsR: reference to a hash containing all valid newsgroups ### as keys ### OUT: %Newsgroups : hash containing all newsgroup and hierarchy names as keys - my ($Newsgroups,$ValidGroupsR) = @_; + my ($Newsgroups,$TLH,$ValidGroupsR) = @_; my %ValidGroups = %{$ValidGroupsR} if $ValidGroupsR; my %Newsgroups; chomp($Newsgroups); @@ -167,6 +168,8 @@ sub ListNewsgroups { $Newsgroups =~ s/\s//; # call &HierarchyCount for each newsgroup in $Newsgroups: for (split /,/, $Newsgroups) { + # don't count newsgroup/hierarchy in wrong TLH + next if($TLH and !/^$TLH/); # don't count invalid newsgroups if(%ValidGroups and !defined($ValidGroups{$_})) { warn (sprintf("DROPPED: %s\n",$_)); @@ -409,7 +412,7 @@ sub SQLHierarchies { }; ################################################################################ -sub GetMaxLenght { +sub GetMaxLength { ################################################################################ ### get length of longest field in future query result ### IN : $DBHandle : database handel