4 mkdir("/tmp/irc", 0775);
5 open (STATS, '>/tmp/irc/stats.txt');
6 open (CHANS, '>/tmp/irc/channels.txt');
7 my $irc = new Net::IRC;
8 my $conn = $irc->newconn(Nick => 'srv254-stats', Server => 'localhost');
10 $conn->add_global_handler('luserclient', \&luserclient);
11 $conn->add_global_handler('luserchannels', \&luserchannels);
12 $conn->add_global_handler('endofmotd', \&ask);
13 $conn->add_global_handler('list', \&list);
14 $conn->add_global_handler('listend', \&quit);
18 my($self, $event) = @_;
19 if(($event->args)[1] =~ /There are (\d+) users and (\d+) invisible on (\d+) servers/) {
20 # printf STATS "".(($event->args)[1])."\n";
21 printf STATS "clients.value ".($1 + $2 -1)."\n";
22 printf STATS "servers.value $3\n";
27 my($self, $event) = @_;
28 if(($event->args)[1] =~ /^(\d+)/) {
29 printf STATS "channels.value $1\n";
34 my($self, $event) = @_;
39 my($self, $event) = @_;
40 printf CHANS (($event->args)[1])." ".(($event->args)[2])." ".(($event->args)[3])."\n";
44 my($self, $event) = @_;