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:
Strange output with a mechanize-script - closing filehandles - is this a cpu-limit

 



dilbert
User

Mar 11, 2012, 8:25 AM

Post #1 of 3 (979 views)
Strange output with a mechanize-script - closing filehandles - is this a cpu-limit Can't Post

dear perl-fans -

well i run this script , which is written to do some screenshots of websites
i have also up and running mozrepl

whats strange is the output - see below...
question: should i do change the script

why do i ge the output?


Code
 
#!/usr/bin/perl

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

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

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";
open(OUTPUT, ">$name");
print OUTPUT $png;
sleep (
5);
}


see whats happenning


Code
http://www.unifr.ch/sfm 
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 2.
http://www.zug.phz.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 3.
http://www.schwyz.phz.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 4.
http://www.luzern.phz.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 5.
http://www.schwyz.phz.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 6.
http://www.phvs.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 7.
http://www.phtg.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 8.
http://www.phsg.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 9.
http://www.phsh.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 10.
http://www.phr.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 11.
http://www.hepfr.ch/
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 12.
http://www.phbern.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 13.
http://www.ph-solothurn.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 14.
http://www.pfh-gr.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 15.
http://www.ma-shp.luzern.phz.ch
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 16.
http://www.heilpaedagogik.phbern.ch/
print() on closed filehandle OUTPUT at test_3.pl line 20, <INPUT> line 17.



dilbert
User

Mar 11, 2012, 8:52 AM

Post #2 of 3 (978 views)
Re: [dilbert] Strange output with a mechanize-script - closing filehandles - is this a cpu-limit [In reply to] Can't Post

 
well - hmm - what can i do here

i can use the diagnostics-pragma to get more insights into what is happening...

Alternatively, print() on closed filehandle OUTPUT also gives lots of answers that will tell us that we did not use autodie and also did not check the return value of open.

well what do you think?


FishMonger
Veteran / Moderator

Mar 11, 2012, 9:14 AM

Post #3 of 3 (977 views)
Re: [dilbert] Strange output with a mechanize-script - closing filehandles - is this a cpu-limit [In reply to] Can't Post

See my answer on your cross post.

http://forums.devshed.com/perl-programming-6/strange-output-with-a-mechanize-script-closing-filehandles-is-this-a-cpu-limit-890573.html

 
 


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

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