line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Business::DK::CVR; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
432305
|
use strict; |
|
4
|
|
|
|
|
51
|
|
|
4
|
|
|
|
|
119
|
|
4
|
4
|
|
|
4
|
|
24
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
124
|
|
5
|
4
|
|
|
4
|
|
2273
|
use Class::InsideOut qw( private register id ); |
|
4
|
|
|
|
|
28807
|
|
|
4
|
|
|
|
|
29
|
|
6
|
4
|
|
|
4
|
|
506
|
use Carp qw(croak); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
178
|
|
7
|
4
|
|
|
4
|
|
1017
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
7332
|
|
|
4
|
|
|
|
|
24
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
3265
|
use Business::DK::CVR qw(validate); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
1212
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.11'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
private number => my %number; # read-only accessor: number() |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
6
|
|
|
6
|
1
|
563
|
my ( $class, $number ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
6
|
|
|
|
|
14
|
my $self = {}; |
19
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
17
|
bless $self, $class; |
21
|
|
|
|
|
|
|
|
22
|
6
|
|
|
|
|
30
|
register($self); |
23
|
|
|
|
|
|
|
|
24
|
6
|
100
|
|
|
|
126
|
if ($number) { |
25
|
5
|
|
|
|
|
20
|
$self->set_number($number); |
26
|
|
|
|
|
|
|
} else { |
27
|
1
|
|
|
|
|
16
|
croak 'You must provide a CVR number'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
4
|
|
|
|
|
16
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
1
|
1
|
5
|
sub number { my $self = shift; return $number{ id $self } } |
|
1
|
|
|
|
|
7
|
|
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
1
|
6
|
sub get_number { my $self = shift; return $number{ id $self } } |
|
1
|
|
|
|
|
6
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub set_number { |
38
|
8
|
|
|
8
|
1
|
97
|
my ( $self, $unvalidated_cvr ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
8
|
|
|
|
|
14
|
my $rv; |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
|
|
23
|
if ($unvalidated_cvr) { |
43
|
7
|
100
|
|
|
|
10
|
eval { $rv = validate($unvalidated_cvr); 1; } or 0; |
|
7
|
|
|
|
|
25
|
|
|
6
|
|
|
|
|
52
|
|
44
|
|
|
|
|
|
|
|
45
|
7
|
100
|
100
|
|
|
795
|
if ( $EVAL_ERROR or not $rv ) { |
46
|
2
|
|
|
|
|
19
|
croak 'Invalid CVR number parameter'; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} else { |
49
|
5
|
|
|
|
|
22
|
$number{ id $self } = $unvalidated_cvr; |
50
|
5
|
|
|
|
|
15
|
return 1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} else { |
54
|
1
|
|
|
|
|
15
|
croak 'You must provide a CVR number'; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |