#!/usr/bin/perl # blah, distribute this as much as you want as long as # my name is here or something. modify it, redistribute it, # print it out several copies and fold it into a pair of pants # and a suitjacket, I don't care. Just remember where you got # it from, f00. # - Alex Prestin use GIFgraph::lines; # you'll need the gifgraph perl module; # I like the GIF one over the PNG one. $FILE="/tmp/frucount"; $RECORD="/path/to/count.db"; # change this or it aint gonna work. $wget="/usr/local/bin/wget"; # yes, you need wget. what do you mean, # you don't have wget? $date=`date +%b%e`; # yes this is a terrible kludge. $date=~s/\n//g; # open(WGET, "$wget -O $FILE \"http://www.altavista.com/cgi-bin/query?pg=q&kl=XX&stype=stext&q=%22moxy+fruvous%22\" 2>/dev/null 1>/dev/null|"); close(WGET); open (file,$FILE) || die; while() # Loop through the file. { if (/(pages\ found\.)/) { $_=~s/About\ (.*)\ pages\ found\..*\n/$1/g; $_=~s/.*( )(.*)\ pages\ found\..*\n/$2/g; $_=~s/,//g; $num=$_; } } close(file); if ($num == "") { open(savefile,"/tmp/frunum") || die; while() { $num = $_; $num =~s/.*\ (.*)\n/$1/g; } } open(savefile,">>/tmp/frunum") || die; # change this too if you want... print savefile ("$date $num\n"); close(savefile); @data = read_data(); $my_graph = new GIFgraph::lines(); $my_graph->set( bgclr => 'black', fgclr => 'white', textclr => 'white', labelclr => 'white', axislabelclr => 'white', accentclr => 'black', dclrs => [ qw(lorange green pink blue cyan) ], x_label => 'Day', y_label => 'Number of Webpages', title => 'Fruvous Pages on the \'Net', line_width => 3, ); sub read_data { my @d = (); open(ZZZ, "/tmp/frunum") || return (); while () { chomp; my @row = split; for (my $i = 0; $i <= $#row; $i++) { undef $row[$i] if ($row[$i] eq 'undef'); push @{$d[$i]}, $row[$i]; } } close (ZZZ); return @d; } # yes, this gets changed too. isn't it fun when people make their crappy # code available online? you're gonna have to wrestle to get this to work # just to draw a dumb litle graph! $my_graph->plot_to_gif("/home/wakko/public_html/waytogomurray/fruhits.gif", \@data ); exit;