| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Shell::GetEnv::Dumper; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 8 |  |  | 8 |  | 30 | use strict; | 
|  | 8 |  |  |  |  | 8 |  | 
|  | 8 |  |  |  |  | 178 |  | 
| 4 | 8 |  |  | 8 |  | 24 | use warnings; | 
|  | 8 |  |  |  |  | 8 |  | 
|  | 8 |  |  |  |  | 155 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 8 |  |  | 8 |  | 21 | use Carp; | 
|  | 8 |  |  |  |  | 9 |  | 
|  | 8 |  |  |  |  | 314 |  | 
| 7 | 8 |  |  | 8 |  | 4688 | use Storable; | 
|  | 8 |  |  |  |  | 17946 |  | 
|  | 8 |  |  |  |  | 1191 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our $VERSION = '0.10'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # crazy, but avoids need to use YAML or evals of Data::Dumper | 
| 12 |  |  |  |  |  |  | # or crazy shell escapes | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | # can be run directly or use()'d | 
| 15 |  |  |  |  |  |  | write_envs() unless caller(); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | sub write_envs | 
| 19 |  |  |  |  |  |  | { | 
| 20 | 0 |  |  | 0 | 1 | 0 | my $file = shift @ARGV; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 0 | 0 |  |  |  | 0 | if ( ! store(\%ENV, $file) ) | 
| 23 |  |  |  |  |  |  | { | 
| 24 | 0 |  |  |  |  | 0 | warn( "error storing environment to $file\n" ); | 
| 25 | 0 |  |  |  |  | 0 | exit(1); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | sub read_envs | 
| 30 |  |  |  |  |  |  | { | 
| 31 | 21 |  |  | 21 | 1 | 34 | my ( $file ) = @_; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 21 | 50 |  |  |  | 192 | my $envs = retrieve( $file ) | 
| 34 |  |  |  |  |  |  | or croak( "unable to retrieve environment from $file\n" ); | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 21 |  |  |  |  | 2561 | return $envs; | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | __END__ |