It could also be stored in a database (which is in a way just another way of storing it in the file system). I sort of hate to say that, because I am often getting a bit angry when I see other monks suggesting a database approach for cases where I think it would not work properly (for example, database access is often 2 to 3 (or more) orders of magnitude slower than hashes, so that suggestion to use databases instead of hashes are often ill-advised IMHO), but, here, this is something completely different, it is just a matter of making one single piece of data available to a program.

As for environment variables, yes, it would probably not work if the Perl program environment is abandoned, but there might be some ways of doing thing where you could keep the current environment, for example if the next instance of the script is launched by the last one (with a proper delay, sleep time, or some other way to control launch time).

This may seem not very robust, but we are using something like that on a group of 7 VMS platforms. VMS does not have a cron tab, but has a queue system on which you can submit a job on a given future date. We have a crucial daily process to update our replicated databases with the production data every night. The process does the required update work and then submits the next execution for the next day, passing appropriate parameters. This actually works fairly well. We just need not to forget to update the whole shebang when we fiddle with the process or when a reboot occurs.

Our use case is quite different from the OP's, but it might still be the idea of a possible solution.


In reply to Re^2: How can one open a filehandle in realtime or current log by Laurent_R
in thread How can one open a filehandle in realtime or current log by new2perl2016

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.