Skip to content

Instantly share code, notes, and snippets.

@creaktive
Created July 1, 2011 20:25
Show Gist options
  • Save creaktive/1059320 to your computer and use it in GitHub Desktop.
Save creaktive/1059320 to your computer and use it in GitHub Desktop.
WWW::Mechanize::Firefox + Flash
#!/usr/bin/perl
use common::sense;
use Benchmark;
use WWW::Mechanize::Firefox;
my $mech = new WWW::Mechanize::Firefox;
$mech->allow(
javascript => 1,
metaredirects => 1,
plugins => 1,
);
say "get";
my $t0 = new Benchmark;
$mech->get('http://sysd.org/stas/node/150', synchronize => 1);
my $t1 = new Benchmark;
my $td = timediff($t1, $t0);
say timestr($td);
say "save";
my $png = $mech->content_as_png;
say "ok";
open(my $fh, '>:raw', 'teste.png');
print $fh $png;
close $fh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment