######################################################################### # # # Routine for counting mails in mailfolders with certain properties # # # ######################################################################### # # # Version 2.0 - Written 11.11.96 by Steffen Beyer # # # ######################################################################### # # # Copyright (C) 1995 by software design & management GmbH & Co. KG # # # ######################################################################### unshift(@INC, '/opt/lib/problem'); require "config.pl"; # Subroutine that does it all: sub analyze { my($i,$j,$k); my(@folder); my(@count); my($file); # # Configure here the name(s) of your mail folder(s): # (MUST be an ABSOLUTE path!!!) # push(@folder, '/u/preport/preport'); push(@folder, '/u/preport/zurueck'); push(@folder, '/u/preport/notes'); # &configure(); # $path =~ s!/$!!; foreach $file (@files) { $file =~ s!^/!!; push(@folder, "$path/$file"); } # # Loop through list of folders: # @count = (0, 0, 0, 0, 0); for ( $i = 0; $i <= $#folder; $i++ ) { # # Loop through mail folder: # if (open(FOLDER, "<$folder[$i]")) { $k = 0; while () { if (/^From \S/) { if ($k) { $count[$j]++; } $j = 0; $k = 1; next; } if ($k) { if (/^\s*\[\s*\S+\s*\]\s+gering/) { if ($j < 1) { $j = 1; } } elsif (/^\s*\[\s*\S+\s*\]\s+normal/) { if ($j < 2) { $j = 2; } } elsif (/^\s*\[\s*\S+\s*\]\s+dringend/) { if ($j < 3) { $j = 3; } } elsif (/^\s*\[\s*\S+\s*\]\s+extrem wichtig/) { if ($j < 4) { $j = 4; } } else { } } } close(FOLDER); if ($k) { $count[$j]++; } } # else # { # warn "can't read folder '$folder[$i]': $!\n"; # } } return(@count); } 1; __END__