Alessandro Zummo > Date-Simple-Range-1.1 > Date::Simple::Range

Download:
Date-Simple-Range-1.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.1   Source  

NAME ^

Date::Simple::Range - A range of Date::Simple objects

SYNOPSIS ^

 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

DESCRIPTION ^

A range of Date::Simple objects.

SEE ALSO ^

Date::Simple, Time::Seconds

AUTHOR ^

Alessandro Zummo, <a.zummo@towertech.it>

COPYRIGHT ^

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.

syntax highlighting: