line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2012, Broadcom Corporation. All rights reserved. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of the DMTF::CIM module. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DMTF::CIM::_valued; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
8
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require DMTF::CIM::_model; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
5
|
use version; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
13
|
|
|
|
|
|
|
our $VERSION = qv('0.04'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA=qw(DMTF::CIM::_model); |
16
|
1
|
|
|
1
|
|
70
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
508
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Module implementation here |
19
|
|
|
|
|
|
|
sub new |
20
|
|
|
|
|
|
|
{ |
21
|
0
|
|
|
0
|
0
|
|
my $class=shift; |
22
|
0
|
|
|
|
|
|
my %args=@_; |
23
|
0
|
|
|
|
|
|
my $self=DMTF::CIM::_model::new($class,$args{parent},$args{data}); |
24
|
0
|
|
0
|
|
|
|
$self->{VALUE}=$args{value} || {}; |
25
|
0
|
|
|
|
|
|
return($self); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub value |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
31
|
0
|
|
|
|
|
|
my @newvals=@_; |
32
|
0
|
0
|
|
|
|
|
if($#newvals > -1) { |
33
|
0
|
0
|
|
|
|
|
if($self->is_array) { |
34
|
0
|
|
|
|
|
|
my $new=[]; |
35
|
0
|
|
|
|
|
|
foreach my $nv (@newvals) { |
36
|
0
|
|
|
|
|
|
push @$new, $self->unmap_value($nv); |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
${$self->{VALUE}}=$new; |
|
0
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
0
|
0
|
|
|
|
|
if($#newvals > 0) { |
42
|
0
|
|
|
|
|
|
carp("Array specified for non-array value"); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else { |
45
|
0
|
|
|
|
|
|
${$self->{VALUE}}=$self->unmap_value($newvals[0]); |
|
0
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
return($self->_value(1)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub raw_value |
53
|
|
|
|
|
|
|
{ |
54
|
0
|
|
|
0
|
0
|
|
my $self=shift; |
55
|
0
|
|
|
|
|
|
my @newvals=@_; |
56
|
0
|
0
|
|
|
|
|
if($#newvals > -1) { |
57
|
0
|
0
|
|
|
|
|
if($self->is_array) { |
58
|
0
|
|
|
|
|
|
${$self->{VALUE}}=\@newvals; |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
0
|
0
|
|
|
|
|
if($#newvals > 0) { |
62
|
0
|
|
|
|
|
|
carp("Array specified for non-array value"); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
else { |
65
|
0
|
|
|
|
|
|
${$self->{VALUE}}=$newvals[0]; |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
0
|
|
|
|
|
|
return($self->_value(0)); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
############# |
73
|
|
|
|
|
|
|
# "Private" # |
74
|
|
|
|
|
|
|
############# |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _value |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
0
|
|
|
my $self=shift; |
79
|
0
|
|
|
|
|
|
my $map=shift; |
80
|
0
|
|
|
0
|
|
|
local $SIG{__WARN__}=sub {}; |
|
0
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my $val=${$self->{VALUE}}; |
|
0
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
return $val unless defined $val; |
83
|
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
|
if(defined $map && $map) { |
85
|
0
|
0
|
|
|
|
|
if(ref($val) eq 'ARRAY') { |
86
|
0
|
|
|
|
|
|
$val=[@$val]; |
87
|
0
|
|
|
|
|
|
foreach my $value (@{$val}) { |
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $newval=$self->map_value($value); |
89
|
0
|
|
|
|
|
|
$value=$newval; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
else { |
93
|
0
|
|
|
|
|
|
my $newval=$self->map_value($val); |
94
|
0
|
|
|
|
|
|
$val=$newval; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if(ref($val) eq 'ARRAY') { |
99
|
0
|
0
|
|
|
|
|
return wantarray ? @{$val} : join(', ', @{$val}); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
101
|
0
|
|
|
|
|
|
return $val; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|