First of all, let me say that I think you are engagning in false hubris with this since 12 lines in cron or at isn't a very big deal. That said, I often obsess about elegant solutions myself, so what the hell. Any scheduler has to sleep between checks if you don't want to waste cycles. Yet very short sleeps fix this problem. In perl, sleeping for less than a second is somewhat difficult. If it is supported on NT use the 4-argument version of select():
select(undef, undef, undef, 0.25);
or use Time::HiRes:
use Time::HiRes qw(sleep); sleep(0.25);
You can also make your sleep time variable; have it sleep an hour if there are over two hours left, 30 minutes for an hour, etc. Once you hit a certain threshold, start using subsecond sleeps.

In reply to Re: Scheduling with Perl? by dbp
in thread Scheduling with Perl? by EyeOpener

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.