line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
### Change History |
2
|
|
|
|
|
|
|
# 1999-02-21 Created. -Simon |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Data::Quantity::Abstract::Compound; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require 5; |
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
11
|
|
|
|
|
|
|
$VERSION = 0.001; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
57
|
use Data::Quantity::Abstract::Base '-isasubclass'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# $clone_q = $quantity->new_instance(); |
16
|
|
|
|
|
|
|
# $empty_q = Data::Quantity::Abstract::Compound->new_instance(); |
17
|
|
|
|
|
|
|
sub new_instance { |
18
|
2
|
|
|
2
|
0
|
3
|
my $referent = shift; |
19
|
2
|
|
33
|
|
|
8
|
my $class = ref($referent) || $referent; |
20
|
4
|
|
|
|
|
12
|
my $month_q = [ |
21
|
2
|
50
|
|
|
|
11
|
map { $_->new_instance } ( |
22
|
|
|
|
|
|
|
ref($referent) ? ( @$referent ) : $class->component_classes |
23
|
|
|
|
|
|
|
) |
24
|
|
|
|
|
|
|
]; |
25
|
2
|
|
|
|
|
9
|
bless $month_q, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub component_classes { |
29
|
0
|
|
|
0
|
0
|
0
|
die "abstract!"; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# $quantity->init( $year, $month ); |
33
|
|
|
|
|
|
|
sub init { |
34
|
2
|
|
|
2
|
0
|
3
|
my $month_q = shift; |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
20
|
@$month_q = @_; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |