From: Marc M. <ma...@me...> - 2012-01-14 21:37:21
|
On Fri, Jan 13, 2012 at 04:13:55PM -0600, John wrote: > Hello, > > I am refactoring my code and revised version is not working with regard > to sequenced events. > > Previous code snippet: > > $mech_water_detector = new Generic_Item; > > $mech_water_detector->set("~10~off"); > > This works as expected. After 10 seconds the state is set to off. > > Revised code: > > $_->{detector} = new Generic_Item; > $_->{detector}->set("~10~off"); > > This throws an error: > > Error in running timer action: action=set 'off', > error: syntax error at (eval 1043) line 1, near "set 'off'" > > I changed code to this: > > $_->{detector} = new Generic_Item; > $_->{detector}->set("10~off"); # got rid of the leading ~ Just a weird guess, but there is magic code that takes your code and modifies it for the main loop. I think that code modifier is chocking on $_->{detector} You ought to stick with $mech_water_detector. But this may work: $mech_water_detector = new Generic_Item; $_->{detector} = $mech_water_detector See the omnistat.pl where I tried $stat[1] = new Omnistat and that wouldn't work either for the same reason. Hope this helps. Marc -- "A mouse is a device used to point at the xterm you want to type in" - A.S.R. Microsoft is to operating systems .... .... what McDonalds is to gourmet cooking Home page: http://marc.merlins.org/ |