CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [Laurent_R] storing the output of a www::mechanize script: Edit Log



dilbert
User

May 26, 2013, 4:56 AM


Views: 1412
Re: [Laurent_R] storing the output of a www::mechanize script

hello dear Laurent , hello dear Fishmonger,

i think that i messed up my script a bit.





Code
 
#!/usr/bin/perl

use strict;
use warnings;
use WWW::Mechanize::Firefox;

my $mech = new WWW::Mechanize::Firefox();

my $path = "images";

open(INPUT, "<urls.txt") or die $!;

while (<INPUT>) {
chomp;
print "$_\n";
$mech->get($_);
my $png = $mech->content_as_png();
my $name = "$_";
$name =~s/^www\.//;
$name .= ".png";
my $file_out = "$path/$name";
open OUTPUT, ">", $file_out or die "cannot open $file_out $! \n";
print OUTPUT $png;
sleep (5);
}



and see the corresponding output: note we have some minor chnages - now
the script does some thing

but - nothing is stored. That is funny - isnt it!?

see the output.




Code
 
martin@linux-70ce:~/perl> perl mech20.pl

http://www.google.com
cannot open images/http://www.google.com.png Datei oder Verzeichnis nicht gefunden
martin@linux-70ce:~/perl>


hmmm . i tink that the script needs some rework

any idea!?

greetings


(This post was edited by dilbert on May 26, 2013, 4:57 AM)


Edit Log:
Post edited by dilbert (User) on May 26, 2013, 4:57 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives