Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:
http://www.bez-zofingen.ch http://www.schulesins.ch http://www.schulen-turgi.ch/pages/bezirksschule/startseite.php http://www.schinznach-dorf.ch http://www.schule-seengen.ch http://www.gilgenberg.ch/schule/bez/2005-06/ http://www.rheinfelden-schulen.ch/bezirksschule/ http://www.bezmuri.ch http://www.moehlin.ch/schulen/ http://www.schule-mewo.ch http://www.bez-frick.ch http://www.bezendingen.ch http://www.bezbrugg.ch http://www.schule-bremgarten.ch/content/view/20/37/ http://www.bez-balsthal.ch http://www.schule-baden.ch http://bezaarau.educanet2.ch/info/.ws_gen/index.htm http://www.benedict-basel.ch http://www.institut-beatenberg.ch/ http://www.schulewilchingen.ch http://www.ksuo.ch http://www.international-school.ch http://www.vsgtaegerwilen.ch/ http://www.vgk.ch/ http://www.vstb.ch
see the results and yes, also the errors where it stops.#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize::Firefox; my $mech = new WWW::Mechanize::Firefox(); open my $urls, '<', 'urls.txt' or die $!; while (<$urls>) { chomp; next unless /^http/i; print "$_\n"; $mech->get($_); my $png = $mech->content_as_png; my $name = $_; $name =~ s#^http://##i; $name =~ s#/##g; $name =~ s/\s+\z//; $name =~ s/\A\s+//; $name =~ s/^www\.//; $name .= ".png"; open(my $out, '>', "/home/martin/images/$name") or die $!; binmode $out; print $out $png; close $out; sleep 5; }
martin@linux-wyee:~/perl> perl test_10.pl http://www.bez-zofingen.ch Datei oder Verzeichnis nicht gefunden at test_10.pl line 24, <$urls> l +ine 3. martin@linux-wyee:~/perl> perl test_10.pl http://www.bez-zofingen.ch http://www.schulesins.ch http://www.schulen-turgi.ch/pages/bezirksschule/startseite.php http://www.schinznach-dorf.ch http://www.schule-seengen.ch http://www.gilgenberg.ch/schule/bez/2005-06/ http://www.rheinfelden-schulen.ch/bezirksschule/ Not Found at test_10.pl line 15 martin@linux-wyee:~/perl>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize::Firefox runs well: some attempts to make the script a bit more robust
by Marshall (Canon) on Apr 02, 2012 at 01:50 UTC |