Skip to content

Instantly share code, notes, and snippets.

@alexm
Created November 28, 2010 20:25
Show Gist options
  • Save alexm/719276 to your computer and use it in GitHub Desktop.
Save alexm/719276 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
#
# vots-pirates.pl
#
# Requeriments:
# sudo apt-get install libnotify-bin libwww-perl
#
use LWP::Simple;
my $uri = 'http://www.parlament2010resultats.cat/09AU/DAU090044P_L2.htm?d=370';
my $vots = 0;
while (defined (my $html = get($uri) )) {
my ($nous) = $html =~ /total vots\D+([.\d]+)/;
$nous =~ s/\.//;
if ( $nous > $vots ) {
$vots = $nous;
system "notify-send $vots";
print scalar(localtime) . " $vots\n";
}
# actualitzem cada minut
sleep 60;
}
@aaguilera
Copy link

Not as "KISS" as the "one-liner" call to notify-send, but a more "perl-ish" (???) approach would be to use the Desktop::Notify module... http://search.cpan.org/~sacavilia/Desktop-Notify/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment