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

That helped, but things are not working yet. Doing the manual install for Module::Pluggable::Fast and then retrying the install of WWW::Mechanize::Firefox worked.

However the script is giving me an error when I do this:

prompt$ ./screenshot.pl "www.cnn.com" write error: filehandle isn't open at /usr/local/share/perl/5.10.0/Moz +Repl/Client.pm line 186

Any suggestions?

Replies are listed 'Best First'.
Re^7: Screencapture with Perl on Linux
by Corion (Patriarch) on Dec 06, 2009 at 14:31 UTC

    No. The script works for me with the following incantations:

    perl -Ilib -w eg\screenshot.pl www.cnn.com
    and
    perl -Ilib -w eg\screenshot.pl http://www.cnn.com

    This works for me using the WWW::Mechanize::Firefox v0.12 from CPAN and the current development release on Github.

      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?

        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.

Re^7: Screencapture with Perl on Linux
by LanX (Saint) on Dec 06, 2009 at 22:50 UTC
    > Any suggestions?

    Did you already install and activate the MozRepl-AddOn in your FF?

    Cheers Rolf

      No, I did not have that installed before, but once I installed it, the script worked. Thanks.