summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-21 14:55:26 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-21 14:55:26 +0200
commit753cd2636e2fbc211405342dcf879a6a29572eee (patch)
treedf770d963639b3bda862d27e41b28f7639d1335b
parent44459767caf31fee8f92bff6f606e9bc403d50d6 (diff)
comirror: Rename read_file & other minor improvements
-rwxr-xr-xbin/comirror9
1 files 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);
}