File Coverage

blib/lib/Rex/JobControl/Helper/Chdir.pm
Criterion Covered Total %
statement 6 11 54.5
branch n/a
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 15 53.3


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4             # vim: set ts=2 sw=2 tw=0:
5             # vim: set expandtab:
6              
7             package Rex::JobControl::Helper::Chdir;
8             $Rex::JobControl::Helper::Chdir::VERSION = '0.18.0';
9 1     1   4 use Cwd;
  1         2  
  1         76  
10             require Exporter;
11             our @EXPORT;
12             @EXPORT = qw(chwd);
13 1     1   5 use base qw(Exporter);
  1         1  
  1         129  
14              
15             sub chwd {
16 0     0 0   my ( $path, $code ) = @_;
17              
18 0           my $cwd = getcwd;
19              
20 0           chdir $path;
21              
22 0           $code->();
23              
24 0           chdir $cwd;
25             }
26              
27             1;