Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:
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 http://www.phr.ch http://www.hepfr.ch/ http://www.phbern.ch
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize::Firefox; my $mech = new WWW::Mechanize::Firefox(); open(INPUT, "<urls.txt") or die $!; while (<INPUT>) { chomp; next if $_ =~ m/http/i; print "$_\n"; $mech->get($_); my $png = $mech->content_as_png(); my $name = "$_"; $name =~s#http://##is; $name =~s#/##gis;$name =~s#\s+\z##is;$name =~s#\A\s+##is; $name =~s/^www\.//; $name .= ".png"; open(my $out, ">",$name) or die $!; binmode($out); print $out $png; close($out); sleep (5); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize::Firefox - allmost there - only a little regex error left
by Corion (Patriarch) on Mar 27, 2012 at 20:00 UTC | |
by Perlbeginner1 (Scribe) on Mar 27, 2012 at 20:07 UTC | |
|
Re: WWW::Mechanize::Firefox - allmost there - only a little regex error left
by ww (Archbishop) on Mar 27, 2012 at 20:25 UTC |