Perlbeginner1 has asked for the wisdom of the Perl Monks concerning the following question:

hi dear perl-monks

again me- well
i have started another thread since i have issues with the ports. But that is another story:
first of all; i run linux opensuse 11.4 i try to run this little programme on a linux box.
#!/usr/bin/perl use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new(); open(INPUT, "urls.txt") or die "Can't open file: $!"; while (<INPUT>) { chomp; $mech->get($_); my $png = $mech->content_as_png(); } close(INPUT); exit;


well i have a list of URLS: i have more than 1000 URLS - so it might be a problem if i get the results in a unsorted way.
i have a list of 1000 URLs, one on each line, saved in a file. then i want the script above to open the file, read a line, then retrieve the website! Well the URLS are stored something like this:

Filename: urls.txt ------------------ www.google.com www.cnn.com www.msnbc.com news.bbc.co.uk www.bing.com www.yahoo.com


question: how to write the script that the output of the thumbnail-images are stored with certain names - eg with the domain-names. How to do that!?

otherwise - the resuults would be a whole mess. I need to identify the thumbnails - related to the URLS. :Is this possible!?

love to hear from you
beginner1

Replies are listed 'Best First'.
Re: Perl Mechanize - how to add a certain variable to get a sorted output
by Corion (Patriarch) on Dec 10, 2011 at 14:22 UTC

    Have you looked at the "screenshot" example in WWW::Mechanize::Firefox::Examples?

    I'm pretty sure that you can extract the relevant code from there and use it in your program. This has nothing to do with WWW::Mechanize::Firefox by the way - your problem seems to be how to write image data to a file.

    A reply falls below the community's threshold of quality. You may see it by logging in.