in reply to Re: WWW::Mechanize::Firefox - allmost there - only a little regex error left
in thread WWW::Mechanize::Firefox - allmost there - only a little regex error left
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, ">", $name or die $!; binmode $out; print $out $png; close $out; sleep 5; }
linux-wyee:/home/martin/perl # perl test_7.pl http://www.unifr.ch/sfm http://www.zug.phz.ch http://www.schwyz.phz.ch http://www.luzern.phz.ch http://www.schwyz.phz.ch + http://www.phvs.ch + http://www.phtg.ch + http://www.phsg.ch + http://www.phsh.ch + Use of uninitia +lized value $png in print at test_7.pl line 25, <$urls> line 10. + + http://www.phr.ch + http://www.hepfr.ch/ http://www.phbern.ch http://www.ph-solothurn.ch http://www.pfh-gr.ch Got status code 500 at test_7.pl line 14 linux-wyee:/home/martin/perl #
|
|---|