Hi,

I've been looking at the Schedule::Cron module to handle some schduling that seems to be perfectly suited for the module. I need to be able to add, remove and update events on the fly. For adding new events, it works great. However, when I update an event with a new timespec it doesn't seem to register it, unless I am adding a new event at the same time - not a real problem, I worked around it with a delete and add.

When I delete an event, the deletion works fine, however, the indexes of the other events get lost if they were added to the list after the deleted one was originally added. When check_event(ID) gets executed, the index that is returned is the "old" index before the deletion, where the index should be one value lower.

I looked at the code for the module, and it appears that there is a "map" and a "time_table" structure. The time_table appears to contain the acutal values of the cron events in an array format (ordered list) and the map points to the indexes as they are added to the list. However, I don't see anywhere in the code that updates the ordering after an entry is deleted.

So after my long winded explanation, my question is, is there a way to re-map the list, or should I be calling list_entries and searching as opposed to check_entry?

Thanks for any help.


In reply to Indexes lost on Schedule::Cron by trm

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.