in reply to Re: How to get screenshort using PERL?
in thread How to get screenshort using PERL?
#!/usr/local/bin/perl use strict; use warnings; my $file = '/root/Desktop/'; sleep 5; $file = system("import -window root MyScreenshot.png"); print $file, "\n";
Ouch! That really hurts my eyes!
At least, you use strict and warnings.
use strict; use warnings; system("import -window root MyScreenshot.png");
Better, but still problematic: You still invoke the default shell, begging for trouble. All error checks are missing. Yes, system() may fail. For example, because there is no import utility -- e.g. when ImageMagick is not installed. Or because there is some other tool named import, with completely different parameters a and a completely different purpose.
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to get screenshort using PERL?
by almut (Canon) on Apr 28, 2010 at 15:13 UTC | |
by afoken (Chancellor) on Apr 29, 2010 at 12:18 UTC |