line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
2
|
|
|
|
|
|
|
# @class : Chef::Rest::Client::attributes # |
3
|
|
|
|
|
|
|
# @author : Bhavin Patel # |
4
|
|
|
|
|
|
|
#--------------------------------------------------------------------# |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Chef::REST::Client::attributes; |
7
|
1
|
|
|
1
|
|
739
|
use Chef::REST::Client::attribute; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
318
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$Chef::REST::Client::attributes::VERSION = 1.0; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
14
|
0
|
|
|
|
|
|
my $param = shift; |
15
|
0
|
|
|
|
|
|
my $self = {}; |
16
|
0
|
|
|
|
|
|
bless $self, $class; |
17
|
0
|
|
|
|
|
|
$self->array_parse($param); |
18
|
0
|
|
|
|
|
|
$self->parse( $param ); |
19
|
0
|
|
|
|
|
|
return $self->{'___collection___'}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub array_parse |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
my $param = shift; |
26
|
0
|
0
|
|
|
|
|
return $self->{'___collection___'} unless ref $param eq 'ARRAY'; |
27
|
0
|
|
|
|
|
|
map { $self->parse( $_ ); } @$param; |
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub parse |
31
|
|
|
|
|
|
|
{ |
32
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
33
|
0
|
|
|
|
|
|
my $param = shift; |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
return unless ref $param eq 'HASH'; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
foreach my $k ( keys (%$param ) ) |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
0
|
|
|
|
|
if ( ref $param->{$k} eq 'HASH' ) |
|
|
0
|
|
|
|
|
|
40
|
|
|
|
|
|
|
{ |
41
|
0
|
|
|
|
|
|
my $_obj = new Chef::REST::Client::attribute( |
42
|
|
|
|
|
|
|
key => $k , |
43
|
|
|
|
|
|
|
value => $self->parse( $param->{ $k } ) |
44
|
|
|
|
|
|
|
); |
45
|
0
|
0
|
|
|
|
|
push @{ $self->{ '___collection___'} } , $_obj if defined $_obj; |
|
0
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
elsif ( ref $param->{$k} eq 'ARRAY' ) |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
#my $_obj = new Chef::REST::Client::attribute( key => $k , value => $param->{$k} ); |
50
|
0
|
|
|
|
|
|
return $param->{$k}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
|
|
|
my $_obj = new Chef::REST::Client::attribute( |
55
|
|
|
|
|
|
|
key => $k , |
56
|
|
|
|
|
|
|
value => $param->{ $k } |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
push @{ $self->{ '___collection___'} } , $_obj if defined $_obj; |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
#return $self->{'___collection___'}; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__DATA__ |