line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Param; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
11863
|
use strict; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
187
|
|
4
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
151
|
|
5
|
4
|
|
|
4
|
|
35
|
use base 'Class::Param::Base'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
3974
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.1; |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
5505
|
use Params::Validate qw[]; |
|
4
|
|
|
|
|
77198
|
|
|
4
|
|
|
|
|
2038
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
4
|
100
|
|
4
|
1
|
21888
|
my $class = ref $_[0] ? ref shift : shift; |
13
|
|
|
|
|
|
|
|
14
|
4
|
|
|
|
|
179
|
my ( $hash ) = Params::Validate::validate_with( |
15
|
|
|
|
|
|
|
params => \@_, |
16
|
|
|
|
|
|
|
spec => [ |
17
|
|
|
|
|
|
|
{ |
18
|
|
|
|
|
|
|
type => Params::Validate::HASHREF, |
19
|
|
|
|
|
|
|
default => {}, |
20
|
|
|
|
|
|
|
optional => 1 |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
], |
23
|
|
|
|
|
|
|
called => "$class\::new" |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
4
|
|
|
|
|
82
|
return bless( \$hash, $class ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub get { |
30
|
59
|
|
|
59
|
1
|
91
|
my ( $self, $name ) = @_; |
31
|
59
|
|
|
|
|
247
|
return $$self->{$name}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub set { |
35
|
14
|
|
|
14
|
1
|
30
|
my ( $self, $name, $value ) = @_; |
36
|
14
|
|
|
|
|
36
|
$$self->{$name} = $value; |
37
|
14
|
|
|
|
|
74
|
return 1; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub has { |
41
|
42
|
|
|
42
|
1
|
77
|
my ( $self, $name ) = @_; |
42
|
42
|
|
|
|
|
192
|
return exists $$self->{$name}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub count { |
46
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
47
|
4
|
|
|
|
|
7
|
return scalar keys %{ $$self }; |
|
4
|
|
|
|
|
25
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub clear { |
51
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
52
|
1
|
|
|
|
|
3
|
%{ $$self } = (); |
|
1
|
|
|
|
|
5
|
|
53
|
1
|
|
|
|
|
6
|
return 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub remove { |
57
|
6
|
|
|
6
|
1
|
13
|
my ( $self, $name ) = @_; |
58
|
6
|
|
|
|
|
46
|
return delete $$self->{$name}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub names { |
62
|
10
|
|
|
10
|
1
|
21
|
my $self = shift; |
63
|
10
|
|
|
|
|
13
|
return keys %{ $$self }; |
|
10
|
|
|
|
|
77
|
|
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |