line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
### |
3
|
|
|
|
|
|
|
### Copyright 2002-2003 University of Illinois Board of Trustees |
4
|
|
|
|
|
|
|
### Copyright 2002-2003 Mark D. Roth |
5
|
|
|
|
|
|
|
### All rights reserved. |
6
|
|
|
|
|
|
|
### |
7
|
|
|
|
|
|
|
### Config::Objective::DataType - base class for Config::Objective data types |
8
|
|
|
|
|
|
|
### |
9
|
|
|
|
|
|
|
### Mark D. Roth |
10
|
|
|
|
|
|
|
### Campus Information Technologies and Educational Services |
11
|
|
|
|
|
|
|
### University of Illinois at Urbana-Champaign |
12
|
|
|
|
|
|
|
### |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Config::Objective::DataType; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
247
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
############################################################################### |
21
|
|
|
|
|
|
|
### constructor |
22
|
|
|
|
|
|
|
############################################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new |
25
|
|
|
|
|
|
|
{ |
26
|
21
|
|
|
21
|
1
|
170
|
my ($class, %opts) = @_; |
27
|
21
|
|
|
|
|
23
|
my ($self); |
28
|
|
|
|
|
|
|
|
29
|
21
|
|
|
|
|
24
|
$self = \%opts; |
30
|
21
|
|
|
|
|
44
|
bless($self, $class); |
31
|
|
|
|
|
|
|
|
32
|
21
|
50
|
|
|
|
124
|
$self->unset() |
33
|
|
|
|
|
|
|
if (!exists($self->{'value'})); |
34
|
|
|
|
|
|
|
|
35
|
21
|
|
|
|
|
138
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
############################################################################### |
40
|
|
|
|
|
|
|
### get method |
41
|
|
|
|
|
|
|
############################################################################### |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub get |
44
|
|
|
|
|
|
|
{ |
45
|
21
|
|
|
21
|
1
|
22
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# print "==> get(" . ref($self) . ")\n"; |
48
|
|
|
|
|
|
|
|
49
|
21
|
|
|
|
|
64
|
return $self->{'value'}; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
############################################################################### |
54
|
|
|
|
|
|
|
### set method |
55
|
|
|
|
|
|
|
############################################################################### |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub set |
58
|
|
|
|
|
|
|
{ |
59
|
11
|
|
|
11
|
1
|
12
|
my ($self, $value) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# print "==> set(\"$value\")\n"; |
62
|
|
|
|
|
|
|
|
63
|
11
|
|
|
|
|
14
|
$self->{'value'} = $value; |
64
|
11
|
|
|
|
|
32
|
return 1; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
############################################################################### |
69
|
|
|
|
|
|
|
### default method |
70
|
|
|
|
|
|
|
############################################################################### |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub default |
73
|
|
|
|
|
|
|
{ |
74
|
19
|
|
|
19
|
1
|
26
|
my ($self, $value) = @_; |
75
|
|
|
|
|
|
|
|
76
|
19
|
|
|
|
|
60
|
$self->set($value); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
############################################################################### |
81
|
|
|
|
|
|
|
### unset method |
82
|
|
|
|
|
|
|
############################################################################### |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub unset |
85
|
|
|
|
|
|
|
{ |
86
|
12
|
|
|
12
|
1
|
14
|
my ($self) = @_; |
87
|
|
|
|
|
|
|
|
88
|
12
|
|
|
|
|
23
|
$self->{'value'} = undef; |
89
|
12
|
|
|
|
|
15
|
return 1; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
############################################################################### |
94
|
|
|
|
|
|
|
### utility function for parsing arguments |
95
|
|
|
|
|
|
|
############################################################################### |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub _scalar_or_list |
98
|
|
|
|
|
|
|
{ |
99
|
13
|
|
|
13
|
|
24
|
my ($self, $value) = @_; |
100
|
|
|
|
|
|
|
|
101
|
13
|
100
|
|
|
|
40
|
$value = [ $value ] |
102
|
|
|
|
|
|
|
if (! ref($value)); |
103
|
|
|
|
|
|
|
|
104
|
13
|
50
|
|
|
|
36
|
die "method requires scalar or list argument\n" |
105
|
|
|
|
|
|
|
if (ref($value) ne 'ARRAY'); |
106
|
|
|
|
|
|
|
|
107
|
13
|
|
|
|
|
36
|
return $value; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
############################################################################### |
112
|
|
|
|
|
|
|
### cleanup and documentation |
113
|
|
|
|
|
|
|
############################################################################### |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
__END__ |