From: David N. <dno...@ya...> - 2008-10-16 21:17:55
|
The sf mail server is really getting bad. Resending... ----- Original Message ----- From: "David Norwood" <dno...@ya...> To: "The main list for the MisterHouse home automation program" <mis...@li...> Sent: Wednesday, October 15, 2008 9:36 PM Subject: Re: [mh] Reusing variables? (mp3.pl) > The problem is that the Voice Cmd is being created before $mp3names is. > From what I can tell, noloop code is executed in the following order: mht > definitions, noloop code pulled from user code files, and finally noloop > code pulled from common code files. > > I think this code should work around the problem: > > my ($mp3names, %mp3files) = &mp3_playlists; > $v_playlist_list = new Voice_Cmd("Playlist [$mp3names]"); > my $playlist_state = said $v_playlist_list; > if ($playlist_state) { > run_voice_cmd 'Set the house mp3 player to playlist > $playlist_state'; > } > > The loop code is executed in the opposite order: common code, then user > code. It's also possible to change the order of individual scripts. Does > anyone see a problem with changing the order of noloop code so common code > gets executed before user code? > > David > > ----- Original Message ----- > From: "Rick Steeves" <mis...@co...> > To: "misterhouse users" <mis...@li...> > Sent: Tuesday, October 14, 2008 8:25 PM > Subject: [mh] Reusing variables? (mp3.pl) > > >> >> >> >> Every time I get on a roll I trip over something :-) >> >> in \code\common\mp3.pl (yes, windows!) MH pulls the playlist into >> $mp3names. I want to reference that value in my own chunk of code >> (mostly so I have to say less to active it, without tinkering with >> "core" code that I have to worry about MH updates, or reading back in >> that information, so I can do something like: >> >> # use the playlist values read in by mp3.pl >> $v_playlist_list = new Voice_Cmd("Playlist [$mp3names]"); >> my $playlist_state = said $v_playlist_list; >> if ($playlist_state) { >> run_voice_cmd 'Set the house mp3 player to playlist >> $playlist_state'; >> } >> >> but I get back: >> 10/14/08 23:19:38 : Global symbol "$mp3names" requires explicit >> package name at (eval 198) line 218. >> >> Now I know that's because it's defines as a local variable to >> mp3.pl. How can I use it elsewhere? >> >> Thx >> >> Rick >> PS All part of my final master plan that I can walk around the house >> with a bluetooth headset and make the house do everything :-) >> >> Rick Steeves >> http://www.sinister.net >> >> "The journey is the destination" >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's >> challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the >> world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> ________________________________________________________ >> To unsubscribe from this list, go to: >> http://sourceforge.net/mail/?group_id=1365 >> > |