From 753cd2636e2fbc211405342dcf879a6a29572eee Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 21 May 2010 14:55:26 +0200 Subject: comirror: Rename read_file & other minor improvements --- bin/comirror | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/comirror b/bin/comirror index 6604657..df157cf 100755 --- a/bin/comirror +++ b/bin/comirror @@ -9,8 +9,8 @@ my $mech = WWW::Mechanize->new( stack_depth => 2, ); -my $uri = shift || read_file('last_uri'); -my $image_re = read_file('image_re'); +my $uri = shift || first_line('last_uri'); +my $image_re = first_line('image_re'); if (not defined $uri or not defined $image_re) { die("last_uri or image_re not found / specified\n"); @@ -61,7 +61,7 @@ sub get_image { return; } -sub read_file { +sub first_line { my ($filename) = @_; my ($line, $fh); @@ -89,7 +89,7 @@ sub save_lasturi { return; } -$SIG{INT} = sub { +local $SIG{INT} = sub { save_lasturi(); exit(0); }; @@ -112,6 +112,7 @@ while ( } print "\n"; + # Avoid accidently DoSing webservers. sleep(1); } -- cgit v1.2.3