line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
### Change History |
2
|
|
|
|
|
|
|
# 1999-02-21 Created. -Simon |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Data::Quantity::Time::YearAndMonth; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require 5; |
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
50
|
|
11
|
|
|
|
|
|
|
$VERSION = 0.001; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
564
|
use Data::Quantity::Abstract::Compound '-isasubclass'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub component_classes { |
16
|
2
|
|
|
2
|
0
|
9
|
qw( Data::Quantity::Time::Year Data::Quantity::Time::MonthOfYear ) |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# $year_q = $month_q->year; |
20
|
|
|
|
|
|
|
sub year { |
21
|
4
|
|
|
4
|
0
|
7
|
my $month_q = shift; |
22
|
4
|
|
|
|
|
15
|
$month_q->[0]; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# $moy_q = $month_q->month_of_year; |
26
|
|
|
|
|
|
|
sub month_of_year { |
27
|
2
|
|
|
2
|
0
|
3
|
my $month_q = shift; |
28
|
2
|
|
|
|
|
9
|
$month_q->[1]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# $count = $month_q->days_in_month; |
32
|
|
|
|
|
|
|
sub days_in_month { |
33
|
1
|
|
|
1
|
0
|
1
|
my $month_q = shift; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
899
|
require Time::DaysInMonth; |
36
|
1
|
|
|
|
|
469
|
return Time::DaysInMonth::days_in( map { $_->value } @$month_q ); |
|
2
|
|
|
|
|
6
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# $new_date = $month_q->first_day; |
40
|
|
|
|
|
|
|
sub first_day { |
41
|
1
|
|
|
1
|
0
|
2
|
my $month_q = shift; |
42
|
1
|
|
|
|
|
4
|
Data::Quantity::Time::Date->new_from_ymd( |
43
|
|
|
|
|
|
|
$month_q->year, |
44
|
|
|
|
|
|
|
$month_q->month_of_year, |
45
|
|
|
|
|
|
|
Data::Quantity::Time::DayOfMonth->new( 1 ), |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# $new_date = $month_q->last_day; |
50
|
|
|
|
|
|
|
sub last_day { |
51
|
1
|
|
|
1
|
0
|
2
|
my $month_q = shift; |
52
|
1
|
|
|
|
|
3
|
Data::Quantity::Time::Date->new_from_ymd( |
53
|
|
|
|
|
|
|
$month_q->year, |
54
|
|
|
|
|
|
|
$month_q->month_of_year, |
55
|
|
|
|
|
|
|
Data::Quantity::Time::DayOfMonth->new( $month_q->days_in_month ), |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |