http://qs321.pair.com?node_id=367755
Category: Web stuff
Author/Contact Info foo
Description: Very simply script that keeps me informed of changes in a static page. Runs daily with cron, which emails me any changes or error messages.
#!/usr/bin/perl -w
use strict;
use File::Copy qw(copy);
use LWP::Simple qw(mirror is_error);

my $url = 'http://...';
my $file = '/home/juerd/tmp/foo.html';

copy $file, "$file.old" or warn $!;

my $status = mirror $url, $file;
warn "HTTP $status" if is_error $status;

system qw(diff -u), "$file.old", $file;
 #!/usr/bin/perl -w
 use strict;
+use File::Copy qw(copy);
-use LWP::Simple qw(mirror is_success);
+use LWP::Simple qw(mirror is_error);

 my $url = 'http://...';
 my $file = '/home/juerd/tmp/foo.html';

-rename $file, "$file.old" or warn $!;
+copy $file, "$file.old" or warn $!;

 my $status = mirror $url, $file;
-warn "HTTP $status" unless is_success $status;
+warn "HTTP $status" if is_error $status;

 system qw(diff -u), "$file.old", $file;