Date::Calc::Iterator

Iterate over a range of dates
Download

Date::Calc::Iterator Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Marco Marongiu
  • Publisher web site:
  • http://search.cpan.org/~bronto/

Date::Calc::Iterator Tags


Date::Calc::Iterator Description

Iterate over a range of dates The Date::Calc::Iterator objects are used to iterate over a range of dates, day by day or with a specified step. The method next() will return each time an array reference containing ($year,$month,$date) for the next date, or undef when finished.WARNINGThis module is little and simple. It solves a little problem in a simple way. It doesn't attempt to be the smarter module on CPAN, nor the more complete one. If your problem is more complicated than this module can solve, you should go and check DateTime::Event::Recurrence, which solves a so broad range of problems that yours can't fall out of it.Probabily this module won't evolve a lot. Expect bug fixes, minor improvements in the interface, and nothing more. If you need to solve bigger problems, you have two choices: vivifying a 2.x version of the module (after contacting me, of course) or using DateTime::Event::Recurrence and its brothers.Anyway, I left the name Iterator, and not Iterator::Day or DayIterator, for example, so that the module can evolve if the need be. Who knows? Maybe one day I could need to make it iterate over weekdays, or over moon phases... let's leave the way open, time will tell.newCreates a new object. You must pass it the end points of a date interval as array references: $i = Date::Calc::Iterator->new( from => , to => )from and to are, obviously, required.Optionally, you can specify a custom step with the step key, for example: $i = Date::Calc::Iterator->new( from => , to => , step => 7 ) ;will iterate on December 2003, week by week, starting from December 1st.nextReturns the next date; in list context it returns an array containing year, month and day in this order, or undef if iteration is over; in scalar context, it returns a reference to that array, or undef if iteration is over. Requirements: · Perl


Date::Calc::Iterator Related Software