5 use Imager::Screenshot 'screenshot';
7 # delay so I can bring the window to the front
11 my $find_window = Win32::API->new('user32', 'FindWindowA', 'NP', 'N')
12 or die "Cannot import FindWindow\n";
14 # get the window, this requires an exact match on the window title
15 my $hwnd = $find_window->Call(0, "use Perl: All the Perl that's Practical to Extract and Report - Mozilla Firefox");
18 or die "Mozilla window not found";
20 # take a picture, including the border and title bar
21 my $img = screenshot(hwnd => $hwnd, decor=>1)
22 or die Imager->errstr;
25 $img->write(file=>'mozilla.ppm')