FSP/Util.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 55.8% 19 / 34 CC 4 SCAR 17.7
CC
4
Cov
52%
get_envs
12.0
get_local_dir
6.0
get_host
2.0
CRAP 5.9
« FSP/Dir.pm ↑ Summary FSP/Handle.pm »
1 package Net::FSP::Util;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Exporter qw/import/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our $VERSION = $NET::FSP::VERSION;
6 1 our @EXPORT_OK = qw/get_envs get_host get_local_dir/;
7  
8 1 my %key_for = (
9 FSP_PORT => 'remote_port',
10 FSP_LOCALIP => 'local_address',
11 FSP_LOCALPORT => 'local_port',
12 FSP_PASSWORD => 'password',
13 FSP_BUF_SIZE => 'max_payload_size',
14 FSP_DIR => 'current_dir',
15 FSP_DELAY => 'min_delay',
16 FSP_MAXDELAY => 'max_delay',
17 FSP_DIR => 'current_dir',
18  
19 # My own invention
20 FSP_DELAYFACT => 'delay_factor',
21 );
22  
23 0 ▶sub get_envs {
Subroutine get_envs: not called CC=3 SCAR=24.8
Pod documented
24 0 my %ret;
25 0 for my $env_key (keys %key_for) {
26 0 ▶ $ret{ $key_for{$env_key} } = $ENV{$env_key} if defined $ENV{$env_key};
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{$env_key} 0 0 0
27 }
28 0 return %ret;
29 }
30  
31 0 ▶sub get_host {
Subroutine get_host: not called CC=1 SCAR=6.9
Pod documented
32 0 return $ENV{FSP_HOST};
33 }
34  
35 0 ▶sub get_local_dir {
Subroutine get_local_dir: not called CC=2 SCAR=17.9
Pod documented
36 0 ▶ my $ret = defined $ENV{FSP_LOCAL_DIR} ? $ENV{FSP_LOCAL_DIR} : './';
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'FSP_LOCAL_DIR'} ? : 0 0 0
37 0 $ret =~ s{ (?<= [^/] ) \z }{/}mx;
38 0 return $ret;
39 }
40  
41 1 1;
42  
43 __END__
« FSP/Dir.pm ↑ Summary FSP/Handle.pm »