line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package setenv; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# where are we? |
4
|
|
|
|
|
|
|
$VERSION= '0.05'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# be as strict and verbose as possible |
7
|
1
|
|
|
1
|
|
63594
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
104
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# satisfy -require- |
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Standard Perl functionality |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
18
|
|
|
|
|
|
|
# import |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# IN: 1 class (ignored) |
21
|
|
|
|
|
|
|
# 2..N hash with key / value pairs to set in %ENV |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub import { |
24
|
3
|
|
|
3
|
|
1418
|
shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# set the keys / values |
27
|
3
|
|
|
|
|
6
|
my ( $key, $value ); |
28
|
3
|
|
|
|
|
21
|
$ENV{$key}= $value while ( $key, $value )= splice @_, 0, 2; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
60
|
return; |
31
|
|
|
|
|
|
|
} #import |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
34
|
|
|
|
|
|
|
# unimport |
35
|
|
|
|
|
|
|
# |
36
|
|
|
|
|
|
|
# IN: 1 class (ignored) |
37
|
|
|
|
|
|
|
# 2..N environment variables to remove (default: all) |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub unimport { |
40
|
2
|
|
|
2
|
|
470
|
shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# get rid of just these, please |
43
|
2
|
100
|
|
|
|
28
|
if (@_) { |
44
|
1
|
|
|
|
|
6
|
delete @ENV{@_}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# get rid of all |
48
|
|
|
|
|
|
|
else { |
49
|
1
|
|
|
|
|
28
|
%ENV= (); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
60
|
return; |
53
|
|
|
|
|
|
|
} #unimport |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |