Date::Simple::Range - A range of Date::Simple objects
use Date::Simple::Range; # the new, start and end methods accept Date::Simple, DateTime, Time::Piece, # Date::Calc::Object objects, ISO 8601 strings and undef values. my $range = new Date::Simple::Range('2008-01-01', '2008-01-05'); my $incomplete = new Date::Simple::Range(undef, '2008-01-05'); my $start = new Date::Simple('2008-01-01'); $incomplete->start($start); # now complete if ($range) { ... # start and end dates are both valid print $range; # stringifies as '2008-01-01 - 2008-01-05' # or 'incomplete range' $range->start # start date $range->end # end date $range->start('2008-01-02') # change start date $range->end($anotherobj) # change end date $range >>= 2 # shift range two days in the future... $range <<= 4 # ...and 4 days in the past $range->duration # duration as a Time::Seconds object $range->duration->days # duration in days scalar @$range # duration in days (ugly!) foreach (@$range) { ... # iterate thru the range while (<$range>) { ... # another way, less memory hungry $range->clone # a new, independent, cloned range object
A range of Date::Simple objects.
Date::Simple, Time::Seconds
Alessandro Zummo, <a.zummo@towertech.it>
Copyright (C) 2008 by Alessandro Zummo
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
To install Date::Simple::Range, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Date::Simple::Range
CPAN shell
perl -MCPAN -e shell install Date::Simple::Range
For more information on module installation, please visit the detailed CPAN module installation guide.