I'm trying to create an event to wait for a modem to ring.
I'm using the Device::SerialPort from CPAN.
I can detect a ring with the following :
use Device::SerialPort qw(:STAT);
use Event qw(loop unloop);
$Port = new Device::SerialPort("/dev/ttyS0", 0) or die "Can't create port
object";
# Set up modem.
...
blah
blah
blah
...
while (1) {
print "RING Detected\n" if ($Port->modemlines &
$Port->MS_RING_ON);
}
All it does obviously is enter an infinate loop and print when it detects a
ring.
How can I use Event->var to watch for a change in $Port->modemlines?
I've tried this, and it doesn't work :
Event->var(
var=>\$Port->modemlines ,
cb=>\&checkring,
poll=>'rw');
loop();
undef $Port;
sub checkring {
if($Port->modemlines & $Port->MS_RING_ON) {
print "Ring Detected\n";
unloop();
}
}
---------------------------------------
Stuart Grimshaw |
Schoolsnet LTD | Special
www.schoolsnet.com | Projects
| Developer
[EMAIL PROTECTED] |
---------------------------------------