From: Evan G. <ev...@mn...> - 2001-06-26 11:12:45
|
Bruce, I ran into a similar problem using the following code: if ($state1 eq 'on' and $alarm_state eq 'off'){ # Set if ($Wday < 5){ $Save{alarm1_switch} = "set"; speak (rooms =>'mag', volume =>'20', text =>"Good Night Maggie, Tomorrow is a school day. ". "I have set your alarm for $Save{alarm1_time}"); } speak (rooms =>'mag', volume =>'20', text =>"Good Night Maggie") if $Wday > 4; &pa_sleep_mode('maggie'=>'sleeping'); set $mag_lights_timer 2; } You will see that I am using the variable $state1 instead of $state. The reason for this is (if I am remembering correctly) that $state gets changed during the call to the pa subroutines. When I used the $state variable I would get unintended behavior in my alarmclock code. I will try to take a closer look at this in the next couple of days if I have time. A better fix that what I did may be to alter the pa code since this problem could show up in other places. Evan On 25 Jun 2001, at 21:20, Bruce Winter wrote: > Glad you worked around the problem. The global $state variable was ment to > be like a scratchpad. I don't understand how setting it in your pa code > would have messed up barcode_scan.pl usage (works ok for me). It should > get reset by the state_now method on each pass. I use $state = state_now > all over the place. > > Bruce > > -----Original Message----- > > well, after a lot of digging and scratching my head... I solved my problem. > > it turns out in barcode_scan.pl, on this line > > if ($state = state_now $barcode_scan) { > > The $state is a major global variable and was getting set to 'ON' when I > sent anything to the speakers. so mh_speakers was 'ON' it set the $state > global variable. > > so I just change the line to say > > if (my $state = state_now ...) > > and all seems to be well > > > ________________________________________________________ > To unsubscribe from this list, go to: http://sourceforge.net/mail/?group_id=1365 > > |