in reply to Re^7: Screencapture with Perl on Linux
in thread Screencapture with Perl on Linux (SOLVED)

Updated. I installed the MozRepl firefox addon and now it partially works.

When I try to capture 'www.cnn.com' it work, but when I try to grab a page like 'http://cmcc.deviantart.com/', I get the error:

MozRepl: Accepted connection. maximum input buffer length exceeded: 1048576 bytes at /usr/local/shar +e/perl/5.10.0/MozRepl/Client.pm line 186 (in cleanup) write error: filehandle isn't open at /usr/local/ +share/perl/5.10.0/MozRepl/Client.pm line 186

Any suggestions?

Replies are listed 'Best First'.
Re^9: Screencapture with Perl on Linux
by Corion (Patriarch) on Dec 07, 2009 at 07:48 UTC

    Interesting - I didn't transfer such large data from MozRepl, but it seems that there is a size limit either in Net::Telnet or in MozRepl::Client, neither of which are much under my control. I'll test with your URL and see if I can reproduce the error and then what I can do about it.

    Update: Ah hah - the maxbufsize        => 1_048_576, parameter in Net::Telnet seems to be a likely culprit. You can set that one through the extra_client_args arg in MozRepl:

    extra_client_args => { maxbufsize => 10_485_760, }

    Currently, there is no convenient way to set that from WWW::Mechanize::Firefox, so I suggest you create the object bridge and then reach deep down into Net::Telnet to reconfigure it:

    my $net_telnet = $mech->repl->repl->client; $net_telnet->max_buffer_length(10_485_760);

    As I'm thinking about moving away from MozRepl if the "custom interactors" feature proves stable enough, this approach is of limited duration.

      Thanks again for going the extra distance on helping me. But it seems I cannot get the telnet buffer to change.

      #!/bin/usr/perl -w use strict; use WWW::Mechanize::Firefox; my $mech = WWW::Mechanize::Firefox->new( launch => 'firefox',); my $net_telnet = $mech->repl->repl->client; $net_telnet->max_buffer_length(10485760);
      This returns the error message: "Can't locate object method "max_buffer_length" via package "MozRepl::Client" at screenshot.pl line 6, <DATA> line 1."

      After looking over the documentation I could find for MozRepl, I could not find any lines that matched the '$obj->repl->repl->client' call, though I did find telnet documentation on setting max_buffer_length.

      Perhaps you could give a full example with code? Thanks for all the help.

        As of version 0.13 of WWW::Mechanize::Firefox, there is the bufsize parameter you can pass in at construction time to set the bufsize used by Net::Telnet. If you want to adjust the buffer size at runtime, you'll have to look at the source code of WWW::Mechanize::Firefox.