From: Steve B. <st...@me...> - 2006-05-29 13:26:19
|
OK, so I'm attempting my first custom code for MH and I'm getting a Perl error that doesn't make sense... here's the code: ------- cut here --------- # Category=Informational #@ Announces misc. reminders. speak("rooms=all It is now sunset at $Time_Sunset") if $Time_Now == $Time_Sunset; if (time_cron('30 20 * * 0,1,2,3,4,5') || time_cron('30 21 * * 5,6')) { my @ashley_reminders = ('time for you to do your chores', 'time to earn your paycheck', 'start getting ready for bed'); speak "rooms=all voice=Kate $Time_Now. Ashley, " . $ashley_reminders[int rand @ashley_reminders]; } if (time_cron('0 21 * * 0,1,2,3,4') || time_cron('0 22 * * 5,6')) { my @mark_reminders = ('time for you to do your chores', 'time to earn your paycheck', 'start getting ready for bed'); speak "rooms=all voice=Kate $Time_Now. Mark, " . $ashley_reminders[int rand @ashley_reminders]; } sub speak_anniversary { my ($year, $person, $type) = @_; my $years = &speakify_numbers($Year - $year); speak("voice=Kate Listen up everybody. Today is ${person}'s $years $type!"); } &speak_anniversary(1989, 'Steve & Lisa', 'anniversary') if (time_cron('0 8,10,14,18,22 17 6 *')); &speak_anniversary(1992, 'Mark', 'birthday') if (time_cron('0 9,11,15,17,21 17 6 *')); &speak_anniversary(1997, 'Ashley', 'birthday') if (time_cron('0 8,10,14,18,22 11 2 *')); &speak_anniversary(1970, 'Lisa', 'birthday') if (time_cron('0 8,10,14,18,22 4 2 *')); &speak_anniversary(1968, 'Steve', 'birthday') if (time_cron('0 8,10,14,18,22 29 10 *')); ------- cut here --------- It's lifted right from Bruce's sample code so my assumption is that it's pretty close to error free. Anyway, first it didn't like $sunset so i changed it to $Time_Sunset and that worked. Now it's giving me "Global symbol @ashley_reminders requires explicit package name at (eval 112) line 4053." According to what I read after googling some, this only applies when strict typing is enforced. I thought that the @ symbol made it a local variable in which case the error I'm getting doesn't even make sense. Sorry to sound new but I'm guessing everyone started somewhere. Steve |