in reply to Re: WWW::Mechanize::Firefox and Net::Telnet timeout
in thread WWW::Mechanize::Firefox and Net::Telnet timeout

$mech->repl->repl->timeout(100000);
Unfortunatly it does not work:
Can't locate object method "timeout" via package "MozRepl"

Documentation says this should:
$mech->repl->repl->setup_client( { extra_client_args => { timeout => 1 +80 } } );

But after this statement $mech->get() raises an error:
MozRepl::RemoteObject: TypeError: repl.breakLink is not a function
But I wonder - WWW::Mechanize::Firefox polls for results from Firefox, so there should be no timeout even if a website is slow to respond. The main cause I know for getting timeout errors is when I send invalid Javascript code over to Firefox.
Last commands before timeout which I can see with strace:
write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 999993} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\n", 4096) = 38 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 964561} +) read(3, "repl> ", 4096) = 6 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997753} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997763} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999992 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 998085} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999992 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997690} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\n", 4096) = 38 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 960641} +) read(3, "repl> ", 4096) = 6 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999992 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997790} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997765} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997764} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997768} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999992 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 999993} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997789} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999992 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 996842} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\nrepl> ", 4096) + = 44 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 997698} +) read(3, "\"{\"result\":{\"result\":0,\"type\":null}}\"\n", 4096) = 38 select(8, [3], NULL, NULL, {11, 0}) = 1 (in [3], left {10, 960724} +) read(3, "repl> ", 4096) = 6 select(8, NULL, [3], NULL, {11, 0}) = 1 (out [3], left {10, 999993 +}) write(3, "JSON.stringify( function(){ var res = repl.getAttr(17,\"busy +\")\n; return { result: res }}())\n", 91) = 91 select(8, [3], NULL, NULL, {11, 0}) = 0 (Timeout) write(2, "command timed-out at /usr/local/share/perl/5.10.1/MozRepl/Cl +ient.pm line 186\n", 77) = 77

Replies are listed 'Best First'.
Re^3: WWW::Mechanize::Firefox and Net::Telnet timeout
by Corion (Patriarch) on Apr 27, 2011 at 16:09 UTC

    This is weird and I don't know where that timeout comes from. Maybe it really is Firefox timing out as it is busy synchronously fetching some result. As you see in the trace, WWW::Mechanize::Firefox polls every second (or so) to see whether Firefox has fetched a page.

    If it really is Net::Telnet, then you'll have to dive down:

    $mech->repl->repl->client->{telnet}->timeout($new_timeout);
      $mech->repl->repl->client->{telnet}->timeout($new_timeout);
      Thanks a lot, it helped. There are no timeout errors now.
      hello dear all s

      the same here:
      If it really is Net::Telnet, then you'll have to dive down:
      $mech->repl->repl->client->{telnet}->timeout($new_timeout);


      so the question is: do i need the Net::Telnet: http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm



      What i have tried allready; here it is:


      #!/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; 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); }



      Well this does not care about the size:
      See the output commandline:
      linux-vi17:/home/martin/perl # perl mecha_test_1.pl www.google.com www.cnn.com www.msnbc.com command timed-out at /usr/lib/perl5/site_perl/5.12.3/MozRepl/Client.pm + line 186 linux-vi17:/home/martin/perl #



      This is my source ... see a snippet exampleof the sites i have in the url-list

      www.google.com www.cnn.com www.msnbc.com news.bbc.co.uk www.bing.com www.yahoo.com



      f it really is Net::Telnet, then you'll have to dive down:
      $mech->repl->repl->client->{telnet}->timeout($new_timeout);


      so the question is: do i need the Net::Telnet: http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm

      what do you say!? Do i need it!?

        Your question has nothing to do with the problem talked about here. This thread is about getting a timeout. As far as I am aware you are struggling with using the right version of Perl and getting WWW::Mechanize::Firefox installed at all, not with getting a timeout in some specific situation.

        Net::Telnet is needed by MozRepl which is needed by MozRepl::RemoteObject which is needed by WWW::Mechanize::Firefox.

        I recommend you attend a course on Perl and on Perl modules. Please stop trying nonsensical things and try to learn the concepts of Perl and Perl modules before trying to proceed further with WWW::Mechanize::Firefox.

        what do you say!? Do i need it!?

        You're a scarecrow, you need a brain

        corion i postet this as looged out by accident i am sure you can help here.... guess so! greetings