Created
November 28, 2010 20:25
-
-
Save alexm/719276 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/