Hi Sam. I've cc'd the datetime mailing list so that they can chime in if they want.
> I am trying to write a converter for crontab entries into another format > (iCal). Unfortunately I need a limited recurrence set as the output > module does not allow infinite sets. I thought that using the %parms or > the %set_parms I would be able to limit the Set produced using from_cron > and then pass that on as a finite DateTime::Set to the other module. > > Should the approach I am taking (to limit the resulting Set using a > span) work? > When searching on Google I found very limited results for use of the > DateTime::Event::Cron module and so I wonder if you could point me in a > direction for reference information. Do you have any other suggestions > or ideas? It sounds to me like you're trying to translate one grammar (cron) into another (ICal). Alternatively, if you can get the constraints expressed as recurrences and sets, then you need an ICal generator that will produce the results you want. Currently, DateTime::Event::Cron is not using the DateTime::Set logic internally to produce its results (I did this for speed at one point and keep meaning to run some benchmarks with the more recent datetime code to see how it compares...but...time and all). Short of converting directly from cron grammar to ICal grammar, it seems to me that using sets as an intermediary would be the natural way to go, but I'm not aware of any Set to ICal generators (indeed, I'm not certain that all sets can even be expressed as ICal strings). Have I misunderstood your question? Matt > P.S. Here is the code I am using to try and restrict the returned set > where $now is a time in the last year and $end_date is $now + one year: > > %set_parms = (cron => $_, after => $now, before => $end_date); > $cron_entry = DateTime::Event::Cron->from_cron(%set_parms);