Re: Watching a modem
[email protected] (Joshua N Pritikin)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
On Tue, May 23, 2000 at 01:21:49PM +0100, [email protected] wrote: > 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'); $Port->modemlines is a method, not a variable. Will a timer serve your purpose? Something like: Event->timer(interval => .1, cb => \&checkring); ?? > loop(); > > undef $Port; > > sub checkring { > if($Port->modemlines & $Port->MS_RING_ON) { > print "Ring Detected\n"; > unloop(); > } > } -- "May the best description of competition prevail." via, but not speaking for Deutsche Bank