| 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
| |||||||||||
| 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
| |||||||||||
| 37 | 0 | $ret =~ s{ (?<= [^/] ) \z }{/}mx; | |||||||||
| 38 | 0 | return $ret; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 1 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||