dazz has asked for the wisdom of the Perl Monks concerning the following question:
I am using Image::Grab to gr1ab images off an IP Camera. That is all working OK.
The problem I have is that the timeout for a bad connection is 3minutes but I expect to be grabbing images every 60 seconds. If there is a problem with the camera, I will end up with multiple threads running waiting for an image. I have looked at the documentation here http://search.cpan.org/~mahex/Image-Grab-1.4.2/lib/Image/Grab.pod
I need to change the value of Timeout.
My code looks like this:
Perl debugger spits out the following error message:#get the latest image from the IP camera my $snapshot = new Image::Grab; $snapshot->timeout(5); #sets the timeout (sec) for image::grab (defau +lt is 180s) $snapshot->url("$Camera{$key}"); # create the grab object $snapshot->grab; # grab the image open (IMAGE, ">$lastsnap{$key}") || die syslog(LOG_ERR, "Couldn't ope +n file, $!"); # opens and clears th$ binmode IMAGE; # for MSDOS derivations. print IMAGE $snapshot->image; # save the image to the /var/images/Tra +ckcam folder close IMAGE or die $!;
Can't access `timeout' field in class Image::Grab at upload-images.pl +line 79. at /usr/local/share/perl/5.18.2/Image/Grab.pm line 81. Image::Grab::AUTOLOAD('Image::Grab=HASH(0x8698344)', 5) called + at upload-images.pl line 79
My question is how do I change the Timeout property to 5sec?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Setting Timeout in Image::Grab??
by dazz (Beadle) on Mar 26, 2017 at 19:41 UTC |