line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package setenv; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# where are we? |
4
|
|
|
|
|
|
|
$VERSION= '0.04'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# be as strict and verbose as possible |
7
|
1
|
|
|
1
|
|
29808
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
8
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
141
|
|
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
|
|
7912
|
shift; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# set the keys / values |
27
|
3
|
|
|
|
|
5
|
my ( $key, $value ); |
28
|
3
|
|
|
|
|
30
|
$ENV{$key}= $value while ( $key, $value )= splice @_, 0, 2; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
68
|
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
|
|
554
|
shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# get rid of just these, please |
43
|
2
|
100
|
|
|
|
7
|
if (@_) { |
44
|
1
|
|
|
|
|
6
|
delete @ENV{@_}; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# get rid of all |
48
|
|
|
|
|
|
|
else { |
49
|
1
|
|
|
|
|
39
|
%ENV= (); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
65
|
return; |
53
|
|
|
|
|
|
|
} #unimport |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |