crashing on the full moon
Josh Goldberg <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
A (java programming) coworker presented this challenge while discussing a hypothetical situation: > * Chris troubleshoots and sees that David (in a moment of sheer > insanity) coded the site to crash at 5:42pm on every full moon (do I > hear a Perl Monger side say there is a Perl library for just such a > thing -- and it's only 2 lines?). So, is there a 2 line or less solution? Here's an untested four line solution straight out of cpan, but I'd love to see what fwp can come up with. use DateTime::Event::Lunar qw(:phases); $a=DateTime->now(); $d=DateTime::Event::Lunar->lunar_phase_after(phase => FULL_MOON,datetime=>$a,on_or_after=>1); die if $a->dmy eq $d->dmy && $a->hms =~ /^17:42/;