Perl Imager::Screenshot not doing screenshot with default parameters
- by Grigor
I have the following code:
use Imager::Screenshot 'screenshot';
my $img = screenshot(hwnd => 'active', left => 450, right => 200, top => 50, bottom => 50);
$img->write(file => 'screenshot.png', type => 'png' ) || print "Failed: ", $img->{ERRSTR} , "\n";
it returns:
"Can't call method "write" on undefined value at line 3"
but when I do:
use Imager::Screenshot 'screenshot';
my $img = screenshot(hwnd => 'active', left => 100, right => 300, top => 100, bottom => 300);
$img->write(file => 'screenshot.png', type => 'png' ) || print "Failed: ", $img->{ERRSTR} , "\n";
it does take a screenshot. Why would the left, right, top and bottom values matter here?