line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Param::Ordered; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4593
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
95
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
73
|
|
5
|
2
|
|
|
2
|
|
12
|
use base 'Class::Param::Base'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
926
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1277
|
use Params::Validate qw[]; |
|
2
|
|
|
|
|
47452
|
|
|
2
|
|
|
|
|
63
|
|
8
|
2
|
|
|
2
|
|
1290
|
use Tie::Hash::Indexed qw[]; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
|
|
|
|
|
|
my $class = ref $_[0] ? ref shift : shift; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my ( $hash ) = Params::Validate::validate_with( |
14
|
|
|
|
|
|
|
params => \@_, |
15
|
|
|
|
|
|
|
spec => [ |
16
|
|
|
|
|
|
|
{ |
17
|
|
|
|
|
|
|
type => Params::Validate::HASHREF, |
18
|
|
|
|
|
|
|
default => {}, |
19
|
|
|
|
|
|
|
optional => 1 |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
], |
22
|
|
|
|
|
|
|
called => "$class\::new" |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $param = Tie::Hash::Indexed->TIEHASH( %{ $hash } ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return bless( \$param, $class ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get { |
31
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
32
|
|
|
|
|
|
|
return $$self->FETCH($name); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set { |
36
|
|
|
|
|
|
|
my ( $self, $name, $value ) = @_; |
37
|
|
|
|
|
|
|
$$self->STORE( $name => $value ); |
38
|
|
|
|
|
|
|
return 1; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub has { |
42
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
43
|
|
|
|
|
|
|
return $$self->EXISTS($name); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub count { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
return scalar $self->names || 0; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub remove { |
52
|
|
|
|
|
|
|
my ( $self, $name ) = @_; |
53
|
|
|
|
|
|
|
return $$self->DELETE($name); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub clear { |
57
|
|
|
|
|
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
$$self->CLEAR; |
59
|
|
|
|
|
|
|
return 1; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub names { |
63
|
|
|
|
|
|
|
my $self = shift; |
64
|
|
|
|
|
|
|
my @names = ( $$self->FIRSTKEY ); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
return () unless defined $names[0]; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
while ( defined ( $_ = $$self->NEXTKEY( $names[-1] ) ) ) { |
69
|
|
|
|
|
|
|
push @names, $_; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
return @names; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |