File Coverage

blib/lib/App/Env/Login.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 28 29 96.5


line stmt bran cond sub pod time code
1             # --8<--8<--8<--8<--
2             #
3             # Copyright (C) 2016 Smithsonian Astrophysical Observatory
4             #
5             # This file is part of App::Env::Login
6             #
7             # App::Env::Login is free software: you can redistribute it and/or modify
8             # it under the terms of the GNU General Public License as published by
9             # the Free Software Foundation, either version 3 of the License, or (at
10             # your option) any later version.
11             #
12             # This program is distributed in the hope that it will be useful,
13             # but WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             # GNU General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License
18             # along with this program. If not, see .
19             #
20             # -->8-->8-->8-->8--
21              
22             package App::Env::Login;
23              
24 1     1   33543 use strict;
  1         1  
  1         21  
25 1     1   4 use warnings;
  1         1  
  1         17  
26 1     1   3 use Carp;
  1         4  
  1         53  
27              
28             our $VERSION = '0.01';
29              
30 1     1   388 use File::Spec::Functions qw[ splitpath ];
  1         491  
  1         50  
31 1     1   446 use Shell::GetEnv '0.08_03';
  1         18207  
  1         97  
32              
33             sub envs
34             {
35 1     1 0 85 my ( $opt ) = @_;
36              
37 1         3 my %opt = ( Shell => $ENV{SHELL}, %$opt );
38              
39 1         3 my $shell = ( splitpath( $opt{Shell} ) )[-1];
40              
41 1         14 local %ENV = map { $_ => $ENV{$_} } grep { exists $ENV{$_} }qw[ HOME LOGNAME ];
  1         9  
  2         4  
42              
43 1         3 return Shell::GetEnv->new( $shell, { Login => 1 } )->envs;
44             }
45              
46              
47             __END__