line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Vars; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20
|
use 5.018; |
|
1
|
|
|
|
|
3
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Venus::Class 'attr', 'base', 'with'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Kind::Utility'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Venus::Role::Valuable'; |
13
|
|
|
|
|
|
|
with 'Venus::Role::Buildable'; |
14
|
|
|
|
|
|
|
with 'Venus::Role::Accessible'; |
15
|
|
|
|
|
|
|
with 'Venus::Role::Proxyable'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# ATTRIBUTES |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
attr 'named'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# BUILDERS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub build_proxy { |
24
|
2
|
|
|
2
|
0
|
5
|
my ($self, $package, $method, $value) = @_; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
4
|
my $has_value = exists $_[3]; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return sub { |
29
|
2
|
50
|
|
2
|
|
8
|
return $self->get($method) if !$has_value; # no value |
30
|
0
|
|
|
|
|
0
|
return $self->set($method, $value); |
31
|
2
|
|
|
|
|
12
|
}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub build_self { |
35
|
19
|
|
|
19
|
0
|
36
|
my ($self, $data) = @_; |
36
|
|
|
|
|
|
|
|
37
|
19
|
50
|
|
|
|
53
|
$self->named({}) if !$self->named; |
38
|
|
|
|
|
|
|
|
39
|
19
|
|
|
|
|
42
|
return $self; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub default { |
45
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
35
|
return {%ENV}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub exists { |
51
|
4
|
|
|
4
|
1
|
17
|
my ($self, $name) = @_; |
52
|
|
|
|
|
|
|
|
53
|
4
|
50
|
|
|
|
13
|
return if not defined $name; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
9
|
my $pos = $self->name($name); |
56
|
|
|
|
|
|
|
|
57
|
4
|
100
|
|
|
|
12
|
return if not defined $pos; |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
9
|
return exists $self->value->{$pos}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub get { |
63
|
6
|
|
|
6
|
1
|
15
|
my ($self, $name) = @_; |
64
|
|
|
|
|
|
|
|
65
|
6
|
50
|
|
|
|
13
|
return if not defined $name; |
66
|
|
|
|
|
|
|
|
67
|
6
|
|
|
|
|
13
|
my $pos = $self->name($name); |
68
|
|
|
|
|
|
|
|
69
|
6
|
100
|
|
|
|
21
|
return if not defined $pos; |
70
|
|
|
|
|
|
|
|
71
|
5
|
|
|
|
|
11
|
return $self->value->{$pos}; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub name { |
75
|
18
|
|
|
18
|
1
|
37
|
my ($self, $name) = @_; |
76
|
|
|
|
|
|
|
|
77
|
18
|
100
|
|
|
|
41
|
if (defined $self->named->{$name}) { |
78
|
6
|
|
|
|
|
14
|
return $self->named->{$name}; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
12
|
100
|
|
|
|
37
|
if (defined $self->value->{$name}) { |
82
|
4
|
|
|
|
|
13
|
return $name; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
8
|
100
|
|
|
|
21
|
if (defined $self->value->{uc($name)}) { |
86
|
4
|
|
|
|
|
16
|
return uc($name); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
4
|
|
|
|
|
11
|
return undef; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub set { |
93
|
4
|
|
|
4
|
1
|
18
|
my ($self, $name, $data) = @_; |
94
|
|
|
|
|
|
|
|
95
|
4
|
50
|
|
|
|
10
|
return if not defined $name; |
96
|
|
|
|
|
|
|
|
97
|
4
|
|
|
|
|
11
|
my $pos = $self->name($name); |
98
|
|
|
|
|
|
|
|
99
|
4
|
100
|
|
|
|
15
|
return if not defined $pos; |
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
8
|
return $self->value->{$pos} = $data; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub unnamed { |
105
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
106
|
|
|
|
|
|
|
|
107
|
1
|
|
|
|
|
3
|
my $list = {}; |
108
|
|
|
|
|
|
|
|
109
|
1
|
|
|
|
|
5
|
my $vars = $self->value; |
110
|
1
|
|
|
|
|
4
|
my $data = +{reverse %{$self->named}}; |
|
1
|
|
|
|
|
5
|
|
111
|
|
|
|
|
|
|
|
112
|
1
|
|
|
|
|
8
|
for my $index (sort keys %$vars) { |
113
|
2
|
100
|
|
|
|
7
|
unless (exists $data->{$index}) { |
114
|
1
|
|
|
|
|
4
|
$list->{$index} = $vars->{$index}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
1
|
|
|
|
|
9
|
return $list; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
1; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 NAME |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Venus::Vars - Vars Class |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 ABSTRACT |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Vars Class for Perl 5 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 SYNOPSIS |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
package main; |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
use Venus::Vars; |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my $vars = Venus::Vars->new( |
144
|
|
|
|
|
|
|
value => { USER => 'awncorp', HOME => '/home/awncorp', }, |
145
|
|
|
|
|
|
|
named => { iam => 'USER', root => 'HOME', }, |
146
|
|
|
|
|
|
|
); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
# $vars->root; # $ENV{HOME} |
149
|
|
|
|
|
|
|
# $vars->home; # $ENV{HOME} |
150
|
|
|
|
|
|
|
# $vars->get('home'); # $ENV{HOME} |
151
|
|
|
|
|
|
|
# $vars->get('HOME'); # $ENV{HOME} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
# $vars->iam; # $ENV{USER} |
154
|
|
|
|
|
|
|
# $vars->user; # $ENV{USER} |
155
|
|
|
|
|
|
|
# $vars->get('user'); # $ENV{USER} |
156
|
|
|
|
|
|
|
# $vars->get('USER'); # $ENV{USER} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 DESCRIPTION |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
This package provides methods for accessing C<%ENV> items. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
This package has the following attributes: |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=cut |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 named |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
named(HashRef) |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This attribute is read-write, accepts C<(HashRef)> values, is optional, and defaults to C<{}>. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 INHERITS |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This package inherits behaviors from: |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
L |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=cut |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 INTEGRATES |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This package integrates behaviors from: |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
L |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
L |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
L |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 METHODS |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
This package provides the following methods: |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 default |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
default() (hashref) |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
The default method returns the default value, i.e. C<{%ENV}>. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
I> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=over 4 |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item default example 1 |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
# given: synopsis; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
my $default = $vars->default; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# { USER => 'awncorp', HOME => '/home/awncorp', ... } |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=back |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head2 exists |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
exists(string $key) (boolean) |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
The exists method takes a name or index and returns truthy if an associated |
235
|
|
|
|
|
|
|
value exists. |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
I> |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=over 4 |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item exists example 1 |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
# given: synopsis; |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
my $exists = $vars->exists('iam');; |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
# 1 |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=back |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=over 4 |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=item exists example 2 |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
# given: synopsis; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
my $exists = $vars->exists('USER');; |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
# 1 |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=back |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=over 4 |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item exists example 3 |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
# given: synopsis; |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
my $exists = $vars->exists('PATH'); |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# undef |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=back |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=over 4 |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=item exists example 4 |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
# given: synopsis; |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
my $exists = $vars->exists('user'); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
# 1 |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=back |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=cut |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head2 get |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
get(string $key) (any) |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
The get method takes a name or index and returns the associated value. |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
I> |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=over 4 |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=item get example 1 |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
# given: synopsis; |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
my $get = $vars->get('iam'); |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
# "awncorp" |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=back |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=over 4 |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item get example 2 |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
# given: synopsis; |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
my $get = $vars->get('USER'); |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
# "awncorp" |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=back |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=over 4 |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=item get example 3 |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
# given: synopsis; |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
my $get = $vars->get('PATH'); |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
# undef |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=back |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=over 4 |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item get example 4 |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
# given: synopsis; |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
my $get = $vars->get('user'); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
# "awncorp" |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
=back |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
=cut |
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
=head2 name |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
name(string $key) (string | undef) |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
The name method takes a name or index and returns index if the the associated |
352
|
|
|
|
|
|
|
value exists. |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
I> |
355
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=over 4 |
357
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=item name example 1 |
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
# given: synopsis; |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
my $name = $vars->name('iam'); |
363
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
# "USER" |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
=back |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
=over 4 |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
=item name example 2 |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
# given: synopsis; |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
my $name = $vars->name('USER'); |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
# "USER" |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
=back |
379
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
=over 4 |
381
|
|
|
|
|
|
|
|
382
|
|
|
|
|
|
|
=item name example 3 |
383
|
|
|
|
|
|
|
|
384
|
|
|
|
|
|
|
# given: synopsis; |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
my $name = $vars->name('PATH'); |
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
# undef |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
=back |
391
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
=over 4 |
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
=item name example 4 |
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
# given: synopsis; |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
my $name = $vars->name('user'); |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
# "USER" |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
=back |
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
=cut |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head2 set |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
set(string $key, any $value) (any) |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
The set method takes a name or index and sets the value provided if the |
411
|
|
|
|
|
|
|
associated argument exists. |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
I> |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=over 4 |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=item set example 1 |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
# given: synopsis; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
my $set = $vars->set('iam', 'root'); |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
# "root" |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
=back |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=over 4 |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=item set example 2 |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
# given: synopsis; |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
my $set = $vars->set('USER', 'root'); |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
# "root" |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=back |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=over 4 |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=item set example 3 |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
# given: synopsis; |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
my $set = $vars->set('PATH', '/tmp'); |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
# undef |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=back |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=over 4 |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=item set example 4 |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
# given: synopsis; |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
my $set = $vars->set('user', 'root'); |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
# "root" |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=back |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=cut |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
=head2 unnamed |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
unnamed() (hashref) |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
The unnamed method returns an arrayref of values which have not been named |
470
|
|
|
|
|
|
|
using the C attribute. |
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
I> |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=over 4 |
475
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=item unnamed example 1 |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
package main; |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
use Venus::Vars; |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
my $vars = Venus::Vars->new( |
483
|
|
|
|
|
|
|
value => { USER => 'awncorp', HOME => '/home/awncorp', }, |
484
|
|
|
|
|
|
|
named => { root => 'HOME', }, |
485
|
|
|
|
|
|
|
); |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
my $unnamed = $vars->unnamed; |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
# { USER => "awncorp" } |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=back |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
=cut |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=head1 AUTHORS |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
Awncorp, C |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=cut |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head1 LICENSE |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
Copyright (C) 2000, Awncorp, C. |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
506
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
=cut |