GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Handler::Range(3) User Contributed Perl Documentation Handler::Range(3)

Date::Handler::Range - Time range object

  use Date::Handler::Range;
 
   my $range = new Date::Handler::Range( { date => $date, delta => $delta);

   $range->new                                          Constructor     
   $range->StartDate()                                  Returns a Date::Handler object of the range's start date.
   $range->EndDate()                                    Returns a Date::Handler object of the range's end date.
   $range->Overlaps($range2)                            Returns true if $range overlaps $range2
   $range->Direction('FORWARDS' || 'BACKWARDS')         Sets the direction of the range 
   $range->Delta()                                      Returns the delta contained by this range.
   $range->Date()                                       Returns the date contained by this range.

Range objects are used to specify moments in time between 2 dates. For the moment, this functionnality is very primitive but will evolve in future versions. Each range object is constructed by a base Date::Handler object. Then combined to that is a Date::Handler::Delta will specify the length of the range. Then thirdly, the range is given a direction, either 'FORWARDS' or 'BACKWARDS' in time. From these three values are calculated a start date and an end date.

Example:

        #Creation of the range starting now, ending in 2 days.
        my $range = Date::Handler::Range->new({
                                                        date => time(),
                                                        delta => [0,0,2,0,0],
        });

        #This is already set to 'FORWARDS' by default.
        $range->Direction('FORWARDS');

        print "This range start ".$range->StartDate()." and ends ". $range->EndDate()."\n";

        #Another range, starting at the end date of range 1, going backwards in time 7 days.
        my $range2 = Date::Handler::Range->new({
                                                date => $range->StartDate(),
                                                delta => [0,0,7,0,0],
                                                });

        $range2->Direction('BACKWARDS');

        #This returns true if range overlaps range2.
        $range->Overlaps($range2);

As I said earlier, the range functionnality is still very primitive, and the interface might change. Refer to Date::Handler::Range(1) for more information.

Deltas going after 2038 are not handled by this module yet. (POSIX)

Deltas before 1902 are not handled by this module. (POSIX)

If you find bugs with this module, do not hesitate to contact the author. Your comments and rants are welcomed :)

Implement overloading on ranges. Provide the value of the overlap in Overlaps()

Copyright(c) 2001 Benoit Beausejour <bbeausej@pobox.com>

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Portions Copyright (c) Philippe M. Chiasson <gozer@cpan.org>

Portions Copyright (c) Szabó, Balázs <dlux@kapu.hu>

Portions Copyright (c) Larry Rosler

Benoit Beausejour <bbeausej@pobox.com>

Date::Handler(1). Date::Handler::Delta(1). Class::Date(1). Time::Object(1). Date::Calc(1). perl(1).

Hey! The above document had some coding errors, which are explained below:
Around line 240:
Non-ASCII character seen before =encoding in 'Szabó,'. Assuming CP1252
2002-09-19 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.