I had searched with the Super Search and quite frankly I realy had no idea as to what keywords to use for this type of problem. So forgive me if this has been answered dozens of times.

I'm writing a server type program that backgrounds itself. So it will be running continuously until its killed. What I need to do is to be able to schedule a process within the server to run once every half hour or so and telling it to sleep is not an option since it needs to listen for connections. I came up with this code but as I see it its completely unacceptable since it would run over and over again for a minute. A valiant attempt, however I fell in the moat halfway over.

This attempt uses Date::Calc's Today_and_Now
sub is_it_time { my ($year,$month,$day, $hour,$min,$sec) = Today_and_Now(); if ($min == 29) { return 1; } else { return 0; } }
Any ideas as to how to mimic cronlike scheduling within a perl program for running subroutines without blocking other processes?

I am at your mercy,
Brother BMaximus

In reply to Scheduling internal functions/processes to run within a program (like cron does programs) by BMaximus

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.