Explorar o código

Remove debugging code, was never really used. This should give a few secs in
performance on big logfiles

Morten Brix Pedersen %!s(int64=24) %!d(string=hai) anos
pai
achega
80200e3bc0

+ 1 - 54
modules/Pisg.pm

@@ -35,19 +35,6 @@ sub new
         tmps => {},
     };
 
-    # FIXME - ugly hack to get the anonymous sub working, looks stupid to
-    # put this in the new constructor:
-    $self->{debug} = sub {
-        if ($self->{cfg}->{debug} or not $self->{cfg}->{debugstarted}) {
-            my $debugline = $_[0] . "\n";
-            if ($self->{cfg}->{debugstarted}) {
-                print DEBUG $debugline;
-            } else {
-                $self->{cfg}->{debugqueue} .= $debugline;
-            }
-        }
-    };
-
     # Import common functions in Pisg::Common
     require Pisg::Common;
     Pisg::Common->import();
@@ -76,10 +63,6 @@ sub run
     $self->init_words()       # Init words. (Foulwords, ignorewords, etc.)
         if ($self->{use_configfile});
 
-    # Init the debugging file.
-    $self->init_debug()
-        if (!$self->{cfg}->{debugstarted});
-
     # Get translations from langfile
     $self->get_language_templates();
 
@@ -90,8 +73,6 @@ sub run
     $self->do_channel()
         if (!$self->{cfg}->{chan_done}{$self->{cfg}->{channel}});
 
-    # Close the debugging file.
-    $self->close_debug();
 }
 
 sub get_default_config_settings
@@ -200,8 +181,6 @@ sub get_default_config_settings
 
         # Developer stuff
 
-        debug => 0,
-        debugfile => 'debug.log',
         version => "v0.33-cvs",
     };
 
@@ -243,33 +222,6 @@ sub get_language_templates
     close(FILE);
 }
 
-sub init_debug
-{
-    my $self = shift;
-    $self->{cfg}->{debugstarted} = 1;
-    if ($self->{cfg}->{debug}) {
-        print "[ Debugging => $self->{cfg}->{debugfile} ]\n"
-            unless ($self->{cfg}->{silent});
-        open(DEBUG,"> $self->{cfg}->{debugfile}") or print STDERR "$0: Unable to open debug
-        file($self->{cfg}->{debugfile}): $!\n";
-        $self->{debug}->("*** pisg debug file for $self->{cfg}->{logfile}\n");
-        if ($self->{cfg}->{debugqueue}) {
-            print DEBUG $self->{cfg}->{debugqueue};
-            delete $self->{cfg}->{debugqueue};
-        }
-    } else {
-        $self->{debug} = sub {};
-    }
-}
-
-sub close_debug
-{
-    my $self = shift;
-    if ($self->{cfg}->{debug}) {
-        close(DEBUG) or print STDERR "$0: Cannot close debugfile($self->{cfg}->{debugfile}): $!\n";
-    }
-}
-
 sub init_words
 {
     my $self = shift;
@@ -362,7 +314,6 @@ sub init_config
                     unless (($self->{cfg}->{$var} eq $2) || $self->{override_cfg}->{$var}) {
                         $self->{cfg}->{$var} = $2;
                     }
-                    $self->{debug}->("cfg: $var = $2");
                 }
 
             } elsif ($line =~ /<channel=['"]([^'"]+)['"](.*)>/i) {
@@ -372,7 +323,6 @@ sub init_config
                 while ($settings =~ s/\s([^=]+)=["']([^"']*)["']//) {
                     my $var = lc($1);
                     $self->{chans}->{$channel}{$var} = $2;
-                    $self->{debug}->("Channel cfg $channel: $var = $2");
                 }
                 while (<CONFIG>) {
                     last if ($_ =~ /<\/*channel>/i);
@@ -381,7 +331,6 @@ sub init_config
                         unless ($self->{override_cfg}->{$var}) {
                             $self->{chans}->{$channel}{$var} = $2;
                         }
-                        $self->{debug}->("Conf $channel: $var = $2");
                     } else {
                         print STDERR "Warning: $self->{cfg}->{configfile}, line $.: Unrecognized line\n";
                     }
@@ -439,8 +388,7 @@ sub do_channel
         eval <<_END;
 use Pisg::Parser::$self->{cfg}->{logtype};
 \$analyzer = new Pisg::Parser::$self->{cfg}->{logtype}(
-    cfg => \$self->{cfg},
-    debug => \$self->{debug}
+    cfg => \$self->{cfg}
 );
 _END
         if ($@) {
@@ -456,7 +404,6 @@ _END
 use Pisg::HTMLGenerator;
 \$generator = new Pisg::HTMLGenerator(
     cfg => \$self->{cfg},
-    debug => \$self->{debug},
     stats => \$stats,
     users => \$self->{users},
     tmps => \$self->{tmps}

+ 0 - 3
modules/Pisg/Common.pm

@@ -33,9 +33,7 @@ sub add_alias
     } elsif (not defined $aliases{$lcalias}) {
         $aliases{$lcalias} = $aliases{$lcnick};
     } elsif ($aliases{$lcnick} ne $aliases{$lcalias}) {
-        #$debug->("Alias collision: alias $alias -> $aliases{$lcalias} but nick $nick -> $aliases{$lcnick}");
     }
-    #$debug->("Alias added: $alias -> $aliases{$lcalias}");
 }
 
 sub add_aliaswild
@@ -48,7 +46,6 @@ sub add_aliaswild
         $aliases{$lcnick}  = $nick;
     }
     $aliaswilds{$lcalias} = $nick;
-    #$debug->("Aliaswild added: $alias -> $aliaswilds{$lcalias}");
 }
 
 sub add_ignore

+ 0 - 10
modules/Pisg/HTMLGenerator.pm

@@ -12,7 +12,6 @@ sub new
     my %args = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         stats => $args{stats},
         users => $args{users},
         tmps => $args{tmps}
@@ -297,7 +296,6 @@ sub _activetimes
     my $image;
 
     for my $hour (sort keys %{ $self->{stats}->{times} }) {
-        $self->{debug}->("Time: $hour => ". $self->{stats}->{times}{$hour});
 
         my $size = ($self->{stats}->{times}{$hour} / $highest_value) * 100;
         my $percent = ($self->{stats}->{times}{$hour} / $self->{stats}->{totallines}) * 100;
@@ -324,7 +322,6 @@ sub _activetimes
         }
         $image = "pic_v_".(int($hour/6)*6);
         $image = $self->{cfg}->{$image};
-        $self->{debug}->("Image: $image");
 
         $output{$hour} = "<td align=\"center\" valign=\"bottom\" class=\"asmall\">$percent%<br /><img src=\"$self->{cfg}->{pic_loc}/$image\" width=\"15\" height=\"$size\" alt=\"$percent\" /></td>\n";
     }
@@ -1262,7 +1259,6 @@ sub _lasttopics
     my $self = shift;
 
     if ($self->{stats}->{topics}) {
-        $self->{debug}->("Total number of topics: " . scalar @{ $self->{stats}->{topics} });
 
         my %topic_seen;
 
@@ -1585,18 +1581,15 @@ sub _user_linetimes
 
     my $bar      = "";
     my $len      = ($self->{stats}->{lines}{$nick} / $self->{stats}->{lines}{$top}) * 100;
-    my $debuglen = 0;
 
     for (my $i = 0; $i <= 3; $i++) {
         next if not defined $self->{stats}->{line_times}{$nick}[$i];
         my $w = int(($self->{stats}->{line_times}{$nick}[$i] / $self->{stats}->{lines}{$nick}) * $len);
-        $debuglen += $w;
         if ($w) {
             my $pic = 'pic_h_'.(6*$i);
             $bar .= "<img src=\"$self->{cfg}->{pic_loc}/$self->{cfg}->{$pic}\" border=\"0\" width=\"$w\" height=\"15\" align=\"middle\" alt=\"\" />";
         }
     }
-    $self->{debug}->("Length='$len', Sum='$debuglen'");
     return "$bar&nbsp;$self->{stats}->{lines}{$nick}";
 }
 
@@ -1636,7 +1629,6 @@ C<Pisg::HTMLGenerator> uses the hash returned by Pisg::Parser::Logfile and turns
 
     $generator = new Pisg::HTMLGenerator(
         cfg => $cfg,
-        debug => $debug,
         stats => $stats,
         users => $users,
         tmps => $tmps
@@ -1654,8 +1646,6 @@ Possible options are:
 
 B<cfg> - hashref containing configuration variables, created by the Pisg module.
 
-B<debug> - reference to a sub routine to send the debug information.
-
 B<stats> - reference to the hash returned by Pisg::Parser::Logfile containing all stats.
 
 B<users> - reference to a hash containg user information

+ 0 - 4
modules/Pisg/Parser/Format/Template.pm

@@ -19,7 +19,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '',
         actionline => '',
         thirdline  => '',
@@ -36,7 +35,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         # Most log formats are regular enough that you can just match the
         # appropriate things with parentheses in the regular expression.
@@ -58,7 +56,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         # Most log formats are regular enough that you can just match the
         # appropriate things with parentheses in the regular expression.
@@ -94,7 +91,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8 $9");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/Trillian.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\[(\d+):\d+[^ ]+ <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*{3}\s(.+)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = remove_prefix($2);
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = remove_prefix($2);
@@ -62,7 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/bxlog.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\[\d+ \S+\/(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[\d+ \S+\/(\d+):\d+\] \* (\S+) (.*)',
         thirdline => '^\[\d+ \S+\/(\d+):(\d+)\] ([<>@!]) (.*)'
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}    = $1;
         $hash{nick}   = $2;
@@ -62,7 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3 $4");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 8
modules/Pisg/Parser/Format/eggdrop.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\[(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+\] Action: (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+)(.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        if (defined $7) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7");
-        } else {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6");
-        }
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 8
modules/Pisg/Parser/Format/grufti.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\[(\d+):\d+\] <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+\] \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)\] (\S+) (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        if (defined $9) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8 $9");
-        } else {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8");
-        }
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/infobot.pm

@@ -14,7 +14,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^(\d+) \[\d+\] <([^\/]+)\/[^>]+> ([^a-z].*)',
         actionline => '^(\d+) \[\d+\] <([^\/]+)\/[^>]+> ([a-z].*)',
         thirdline  => '^(\d+) \[\d+\] >>> (.*)',
@@ -32,7 +31,6 @@ sub normalline
     my $wday; my $yday; my $isdst;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($1);
         $hash{hour}   = $hour;
@@ -53,7 +51,6 @@ sub actionline
     my $wday; my $yday; my $isdst;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($1);
         $hash{hour}   = $hour;
@@ -74,7 +71,6 @@ sub thirdline
     my $wday; my $yday; my $isdst;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2");
 
         ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($1);
         $hash{hour} = $hour;

+ 0 - 8
modules/Pisg/Parser/Format/ircle.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^(\d+):\d+ \w+:[^\w]+(\w+): (.*)',
         actionline => '^(\d+):\d+ \w+:[^\w]+(\w+) (.*)',
         thirdline  => '^(\d+):(\d+) \w+: \*\*\* (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        if (defined $8) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8");
-        } else {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7");
-        }
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 8
modules/Pisg/Parser/Format/irssi.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^(\d+):\d+ <[@+ ]?([^>]+)> (.*)',
         actionline => '^(\d+):\d+  \* (\S+) (.*)',
         thirdline  => '^(\d+):(\d+) -\!- (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        if (defined $8) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8");
-        } else {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7");
-        }
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 8
modules/Pisg/Parser/Format/mIRC.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\[(\d+):\d+[^ ]+ <([^>]+)> (.*)',
         actionline => '^\[(\d+):\d+[^ ]+ \* (\S+) (.*)',
         thirdline  => '^\[(\d+):(\d+)[^ ]+ \*\*\* (\S+) (\S+) (\S+) (\S+) (\S+)(.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = remove_prefix($2);
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = remove_prefix($2);
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        if (defined $8) {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8");
-        } else {
-            $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7");
-        }
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 8
modules/Pisg/Parser/Format/mbot.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\S+ \S+ [ \d]\d (\d+):\d+:\d+ \d+ <([^>]+)> (?!\001ACTION)(.*)',
         actionline => '^\S+ \S+ [ \d]\d (\d+):\d+:\d+ \d+ <([^>]+)> \001ACTION (.*)\001$',
         thirdline  => '^\S+ \S+ [ \d]\d (\d+):(\d+):\d+ \d+ (\S+) (\S+) ?(\S*) ?(\S*) ?(.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,11 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        my $debugstring = "[$lines] ***: $1 $2 $3 $4";
-        $debugstring .= " $5" if (defined $5);
-        $debugstring .= " $6" if (defined $6);
-        $debugstring .= " $7" if (defined $7);
-        $self->{debug}->($debugstring);
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/psybnc.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^\d+-\d+-\d+-(\d+)-\d+-\d+:[^:]+::([^!]+)[^:]+:(.*)',
         actionline => '^\d+-\d+-\d+-(\d+)-\d+-\d+:[^:]+::([^!]+)[^:]+:\001ACTION (.*)',
         thirdline  => '^\d+-\d+-\d+-(\d+)-(\d+)-\d+:[^:]+::([^!]+)[^ ]+ (\w+) (.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -62,7 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/winbot.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^(\d\d):\d\d\.\d\d \d+\/\d+\/\d+  <([^\/]+)\/([^\>]+)> (.*)',
         actionline => '^(\d\d):\d\d\.\d\d \d+\/\d+\/\d+  \* ([^\/]+)\/(\S+) (.*)',
         thirdline  => '^(\d\d):(\d\d)\.\d\d \d+\/\d+\/\d+  \*{3}\s(.+)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o && $3 eq $self->{cfg}->{channel}) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3 $4");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -43,7 +41,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o && $3 eq $self->{cfg}->{channel}) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3 $4");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -60,7 +57,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 0 - 4
modules/Pisg/Parser/Format/xchat.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^(\d+):\d+:\d+ <([^>\s]+)>\s+(.*)',
         actionline => '^(\d+):\d+:\d+ \*\s+(\S+) (.*)',
         thirdline  => '^(\d+):(\d+):\d+ .--\s+(\S+) (\S+) (\S+) (\S+) (\S+) (\S+) (.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3");
 
         $hash{hour} = $1;
         $hash{nick} = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3");
 
         $hash{hour} = $1;
         $hash{nick} = $2;
@@ -62,7 +59,6 @@ sub thirdline
     my %hash;
 
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5 $6 $7 $8 $9");
 
         $hash{hour} = $1;
         $hash{min} = $2;

+ 0 - 4
modules/Pisg/Parser/Format/zcbot.pm

@@ -10,7 +10,6 @@ sub new
     my ($type, %args) = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         normalline => '^[^ ]+ (\d+):[^ ]+ :([^!]+)[^ ]+ PRIVMSG (\#[^ ]+) :[^\001](.*)',
         actionline => '^[^ ]+ (\d+):[^ ]+ :([^!]+)[^ ]+ PRIVMSG (\#[^ ]+) :\001ACTION (.*)',
         thirdline  => '^[^ ]+ (\d+):(\d+):\d+ :([^!]+)[^ ]+ ([A-Z]+) (.*)',
@@ -26,7 +25,6 @@ sub normalline
     my %hash;
 
     if ($line =~ /$self->{normalline}/o && lc($3) eq lc($self->{cfg}->{channel})) {
-        $self->{debug}->("[$lines] Normal: $1 $2 $3 $4");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -44,7 +42,6 @@ sub actionline
     my %hash;
 
     if ($line =~ /$self->{actionline}/o && lc($3) eq lc($self->{cfg}->{channel})) {
-        $self->{debug}->("[$lines] Action: $1 $2 $3 $4");
 
         $hash{hour}   = $1;
         $hash{nick}   = $2;
@@ -63,7 +60,6 @@ sub thirdline
     my $tmp;
     
     if ($line =~ /$self->{thirdline}/o) {
-        $self->{debug}->("[$lines] ***: $1 $2 $3 $4 $5");
 
         $hash{hour} = $1;
         $hash{min}  = $2;

+ 27 - 31
modules/Pisg/Parser/Logfile.pm

@@ -12,7 +12,6 @@ sub new
     my %args = @_;
     my $self = {
         cfg => $args{cfg},
-        debug => $args{debug},
         parser => undef
     };
 
@@ -34,12 +33,10 @@ sub _choose_format
     my $self = shift;
     my $format = shift;
     $self->{parser} = undef;
-    $self->{debug}->("Loading module for log format $format");
     eval <<_END;
 use lib '$self->{cfg}->{modules_dir}';
 use Pisg::Parser::Format::$format;
 \$self->{parser} = new Pisg::Parser::Format::$format(
-    debug => \$self->{debug},
     cfg => \$self->{cfg},
 );
 _END
@@ -199,11 +196,9 @@ sub _parse_file
         # Match normal lines.
         if ($hashref = $self->{parser}->normalline($line, $.)) {
 
-            my $repeated;
+            my $repeated = 0;
             if (defined $hashref->{repeated}) {
                 $repeated = $hashref->{repeated};
-            } else {
-                $repeated = 0;
             }
 
             my ($hour, $nick, $saying, $i);
@@ -292,7 +287,7 @@ sub _parse_file
                         }
                     }
 
-                    $self->_parse_words($stats, $saying, $nick);
+                    _parse_words($stats, $saying, $nick, $self->{cfg}->{ignoreword});
                 }
             }
             $lastnormal = $line;
@@ -336,7 +331,7 @@ sub _parse_file
                 my $len = length($saying);
                 $stats->{lengths}{$nick} += $len;
 
-                $self->_parse_words($stats, $saying, $nick);
+                _parse_words($stats, $saying, $nick, $self->{cfg}->{ignoreword});
             }
         }
 
@@ -373,19 +368,8 @@ sub _parse_file
                         push @{ $lines->{kicklines}{$nick} }, $line;
                     }
 
-                } elsif (defined($newtopic)) {
-                    if ($newtopic ne '') {
-                        my $tcount;
-                        if (defined $stats->{topics}) {
-                            $tcount = @{ $stats->{topics} };
-                        } else {
-                            $tcount = 0;
-                        }
-                        $stats->{topics}[$tcount]{topic} = $newtopic;
-                        $stats->{topics}[$tcount]{nick}  = $nick;
-                        $stats->{topics}[$tcount]{hour}  = $hour;
-                        $stats->{topics}[$tcount]{min}   = $min;
-                    }
+                } elsif (defined($newtopic) && $newtopic ne '') {
+                    _topic_change($stats, $newtopic, $nick, $hour, $min);
 
                 } elsif (defined($newmode)) {
                     _modechanges($stats, $newmode, $nick);
@@ -406,6 +390,24 @@ sub _parse_file
         unless ($self->{cfg}->{silent});
 }
 
+sub _topic_change
+{
+    my $stats = shift;
+    my $newtopic = shift;
+    my $nick = shift;
+    my $hour = shift;
+    my $min = shift;
+
+    my $tcount = 0;
+    if (defined $stats->{topics}) {
+        $tcount = @{ $stats->{topics} };
+    }
+    $stats->{topics}[$tcount]{topic} = $newtopic;
+    $stats->{topics}[$tcount]{nick}  = $nick;
+    $stats->{topics}[$tcount]{hour}  = $hour;
+    $stats->{topics}[$tcount]{min}   = $min;
+}
+
 sub _modechanges
 {
     my $stats = shift;
@@ -428,25 +430,22 @@ sub _modechanges
     $stats->{tookops}{$nick} += $ops[1] if $ops[1];
     $stats->{gavevoice}{$nick} += $voice[0] if $voice[0];
     $stats->{tookvoice}{$nick} += $voice[1] if $voice[1];
-
 }
 
 sub _parse_words
 {
-    my $self = shift;
-    my ($stats, $saying, $nick) = @_;
+    my ($stats, $saying, $nick, $ignoreword) = @_;
 
     foreach my $word (split(/[\s,!?.:;)(\"]+/, $saying)) {
         $stats->{words}{$nick}++;
         # remove uninteresting words
-        # next unless (length($word) >= $self->{cfg}->{wordlength});
-        next if ($self->{cfg}->{ignoreword}{$word});
+        next if ($ignoreword->{$word});
 
         # ignore contractions
-        next if ($word =~ m/'..?$/);#'
+        next if ($word =~ m/'..?$/);
 
         # Also ignore stuff from URLs.
-        next if ($word =~ m{https?|^//});
+        next if ($word =~ m/https?|^\/\//);
 
         $stats->{wordcounts}{$word}++;
         $stats->{wordnicks}{$word} = $nick;
@@ -502,7 +501,6 @@ C<Pisg::Parser::Logfile> parses a logfile using the configuration variables set
 
     $analyzer = new Pisg::Parser::Logfile(
         cfg => $cfg,
-        debug => $debug,
     );
 
 =head1 CONSTRUCTOR
@@ -517,8 +515,6 @@ Possible options are:
 
 B<cfg> - hashref containing configuration variables, created by the Pisg module.
 
-B<debug> - reference to a sub routine to send the debug information.
-
 =back
 
 =head1 AUTHOR