From: Bruce W. <br...@mi...> - 2000-11-29 03:39:00
|
> Didn't Bruce say a day or two ago that variables declared using 'my' in > column 1 only get defined once, at MH startup. > > Kevin 'really just guessing' Olalde > > Kip Gebhardt wrote: > > > > I am running mh2.3.2 and the time_less_than and time_greater_than > > functions don't seem to be working. The code I am using is: > > > > my $dark_flag = ( (time_less_than($Time_Sunrise)) || > > (time_greater_than($Time_Sunset)) ); > > if ($dark_flag) { > > ... > > } Kevin be right. I've debated if we should have a different mechanism to declare global out-of-the-loop variable ... relying on column 1 my declarations seems kind of dorky. This is a good example that shows maybe its a bad idea. This will work: ---- my $dark_flag; $dark_flag = time_less_than .... if ($dark_flag) {....} ---- This will cause $dark_flag to be a global variable, so you can share it between file members. The $dark_flag assignment stays in the loop code. As of mh 2.34, there is a $Dark global variable pre-defined, using exactly the test you defined (almost exactly ... it useses the _Twilight variables). Bruce |