1Handler::Range(3) User Contributed Perl Documentation Handler::Range(3)
2
3
4
6 Date::Handler::Range - Time range object
7
9 use Date::Handler::Range;
10
11 my $range = new Date::Handler::Range( { date => $date, delta => $delta);
12
13 $range->new Constructor
14 $range->StartDate() Returns a Date::Handler object of the range's start date.
15 $range->EndDate() Returns a Date::Handler object of the range's end date.
16 $range->Overlaps($range2) Returns true if $range overlaps $range2
17 $range->Direction('FORWARDS' || 'BACKWARDS') Sets the direction of the range
18 $range->Delta() Returns the delta contained by this range.
19 $range->Date() Returns the date contained by this range.
20
22 Range objects are used to specify moments in time between 2 dates. For
23 the moment, this functionnality is very primitive but will evolve in
24 future versions. Each range object is constructed by a base
25 Date::Handler object. Then combined to that is a Date::Handler::Delta
26 will specify the length of the range. Then thirdly, the range is given
27 a direction, either 'FORWARDS' or 'BACKWARDS' in time. From these three
28 values are calculated a start date and an end date.
29
30 Example:
31
32 #Creation of the range starting now, ending in 2 days.
33 my $range = Date::Handler::Range->new({
34 date => time(),
35 delta => [0,0,2,0,0],
36 });
37
38 #This is already set to 'FORWARDS' by default.
39 $range->Direction('FORWARDS');
40
41 print "This range start ".$range->StartDate()." and ends ". $range->EndDate()."\n";
42
43 #Another range, starting at the end date of range 1, going backwards in time 7 days.
44 my $range2 = Date::Handler::Range->new({
45 date => $range->StartDate(),
46 delta => [0,0,7,0,0],
47 });
48
49 $range2->Direction('BACKWARDS');
50
51 #This returns true if range overlaps range2.
52 $range->Overlaps($range2);
53
54 As I said earlier, the range functionnality is still very primitive,
55 and the interface might change. Refer to Date::Handler::Range(1) for
56 more information.
57
59 Deltas going after 2038 are not handled by this module yet. (POSIX)
60
61 Deltas before 1902 are not handled by this module. (POSIX)
62
63 If you find bugs with this module, do not hesitate to contact the
64 author. Your comments and rants are welcomed :)
65
67 Implement overloading on ranges. Provide the value of the overlap in
68 Overlaps()
69
71 Copyright(c) 2001 Benoit Beausejour <bbeausej@pobox.com>
72
73 All rights reserved. This program is free software; you can
74 redistribute it and/or modify it under the same terms as Perl itself.
75
76 Portions Copyright (c) Philippe M. Chiasson <gozer@cpan.org>
77
78 Portions Copyright (c) Szabó, Balázs <dlux@kapu.hu>
79
80 Portions Copyright (c) Larry Rosler
81
83 Benoit Beausejour <bbeausej@pobox.com>
84
86 Date::Handler(1). Date::Handler::Delta(1). Class::Date(1).
87 Time::Object(1). Date::Calc(1). perl(1).
88
89
90
91perl v5.38.0 2023-09-25 Handler::Range(3)