package ForumCheck; use Milkbone; use Tk; use strict; use HTTP::Lite; use Digest::MD5; use constant 'PAGE' => 'http://www.batkins.com/forum/?action=recent'; my ($original, $latest); register_hook("pre_mainloop", sub { my $http = new HTTP::Lite; $http->request(PAGE); $original = check($http->body()); my $mw = hook("tk_getmain"); $mw->repeat(10 * 1000, \&check); check(); }); sub get_latest { (split /<td colspan="3" bgcolor="#F8F8F8" valign="top" height="40" class="windowbg2">/, shift)[1]; } sub check { my $http = new HTTP::Lite; $http->request(PAGE); $latest = get_latest($http->body()); if($latest ne $original and $original ne ""){ hook("error", -short => "New posts in the BATKINS forum."); $original = $latest; } elsif($original eq "") { $original = $latest; } } 1;