| setenv documentation | Contained in the setenv distribution. |
setenv - conveniently (re)set %ENV variables at compile time
no setenv; # BEGIN { %ENV = () }
no setenv qw( FOO BAR ); # BEGIN { delete @ENV{ qw( FOO BAR ) } }
use setenv # BEGIN { $ENV{FOO} = 1, $ENV{BAR} = 2 }
FOO => 1,
BAR => 2,
;
Provide a simple way to (re)set %ENV variables at compile time. Usually
used during debugging only. This is just syntactic sugar, without any
additives.
This documentation describes version 0.03.
There are no methods.
Since "import" and "noimport" are called by Perl at compile time when doing a
use or no, it will perform any (re)setting of %ENV at that time.
(none)
Elizabeth Mattijsen
Copyright (c) 2008 Elizabeth Mattijsen <liz@dijkmat.nl>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| setenv documentation | Contained in the setenv distribution. |
package setenv; # where are we? $VERSION = '0.03'; # be as strict and verbose as possible use strict; use warnings; # satisfy -require- 1; #--------------------------------------------------------------------------- # # Standard Perl functionality # #--------------------------------------------------------------------------- # import # # IN: 1 class (ignored) # 2..N hash with key / value pairs to set in %ENV sub import { shift; # set the keys / values while ( my ( $key, $value ) = splice @_, 0, 2 ) { $ENV{$key} = $value; } return; } #import #--------------------------------------------------------------------------- # unimport # # IN: 1 class (ignored) # 2..N environment variables to remove (default: all) sub unimport { shift; # get rid of just these, please if (@_) { delete @ENV{@_}; } # get rid of all else { %ENV = (); } return; } #unimport #--------------------------------------------------------------------------- __END__