line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::Piece::Range; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
Time::Piece::Range - deal with a range of Time::Piece objects |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Time::Piece::Range; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $range = Time::Piece::Range->new($t1, $d2); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $earliest = $range->start; |
14
|
|
|
|
|
|
|
my $latest = $range->end; |
15
|
|
|
|
|
|
|
my $days = $range->length; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
if ($range->includes($d3)) { ... } |
18
|
|
|
|
|
|
|
if ($range->includes($range2)) { ... } |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
if ($range->overlaps($range2)) { |
21
|
|
|
|
|
|
|
my $range3 = $range->overlap($range2); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
foreach my $date ($range->dates) { ... } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $range3 = $range->gap($range2); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
if ($range->abuts($range2)) { ... } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 DESCRIPTION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This is a subclass of Date::Range that uses Time::Piece objects rather |
33
|
|
|
|
|
|
|
than Date::Simple objects. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
It only works at the precision of complete days - times are ignored in |
36
|
|
|
|
|
|
|
all calculations. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$VERSION = '1.2'; |
41
|
|
|
|
|
|
|
|
42
|
1
|
|
|
1
|
|
31655
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
|
6
|
use base 'Date::Range'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
848
|
|
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
1014
|
use Carp; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
53
|
|
47
|
1
|
|
|
1
|
|
1824
|
use Time::Seconds; |
|
1
|
|
|
|
|
11079
|
|
|
1
|
|
|
|
|
77
|
|
48
|
1
|
|
|
1
|
|
941
|
use Time::Piece; |
|
1
|
|
|
|
|
10432
|
|
|
1
|
|
|
|
|
5
|
|
49
|
|
|
|
|
|
|
|
50
|
103
|
|
|
103
|
1
|
54841
|
sub want_class { 'Time::Piece' } |
51
|
31
|
|
|
31
|
|
10422
|
sub _day_length { ONE_DAY } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 AUTHOR |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Tony Bowden |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 BUGS and QUERIES |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Please direct all correspondence regarding this module to: |
62
|
|
|
|
|
|
|
bug-Time-Piece-Range@rt.cpan.org |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Copyright (C) 2003-2005 Tony Bowden. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
69
|
|
|
|
|
|
|
the terms of the GNU General Public License; either version 2 of the License, |
70
|
|
|
|
|
|
|
or (at your option) any later version. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT |
73
|
|
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
74
|
|
|
|
|
|
|
FOR A PARTICULAR PURPOSE. |
75
|
|
|
|
|
|
|
|