blib/lib/Net/SSH/Perl/Util.pm

filter: Statementstmt 100% 31 / 31 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 95.2% 40 / 42 SCAR 17.9
CC
6
Cov
95%
import
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.0
« blib/lib/Net/SSH/Perl/Kex/DH.pm ↑ Summary blib/lib/Net/SSH/Perl/Cipher/CTR.pm »
1 package Net::SSH::Perl::Util;
2 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶use vars qw( %FUNC_TO_MOD %EXPORT_TAGS );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 5 %FUNC_TO_MOD = (
8 _crc32 => 'SSH1Misc',
9 _compute_session_id => 'SSH1MP',
10 _mp_linearize => 'SSH1MP',
11 _check_host_in_hostfile => 'Hosts',
12 _all_keys_for_host => 'Hosts',
13 _add_host_to_hostfile => 'Hosts',
14 _remove_host_from_hostfile=> 'Hosts',
15 _load_private_key => 'Authfile',
16 _load_public_key => 'Authfile',
17 _save_private_key => 'Authfile',
18 _respond_to_rsa_challenge => 'RSA',
19 _rsa_public_encrypt => 'RSA',
20 _rsa_private_decrypt => 'RSA',
21 _prompt => 'Term',
22 _read_passphrase => 'Term',
23 _read_yes_or_no => 'Term',
24 _current_user_win32 => 'Win32',
25 _socketpair => 'Win32',
26 );
27  
28 5 %EXPORT_TAGS = (
29 hosts => [ qw( _check_host_in_hostfile _all_keys_for_host
30 _add_host_to_hostfile _remove_host_from_hostfile ) ],
31 rsa => [ qw( _rsa_public_encrypt _rsa_private_decrypt
32 _respond_to_rsa_challenge ) ],
33 ssh1mp => [ qw( _compute_session_id _mp_linearize ) ],
34 authfile => [ qw( _load_public_key _load_private_key _save_private_key ) ],
35 win32 => [ qw( _current_user_win32 _socketpair ) ],
36 all => [ keys %FUNC_TO_MOD ],
37 );
38  
39 sub import {
40 9 ▶ my $class = shift;
Subroutine import: called CC=6 SCAR=17.9
41 9 my $callpack = caller;
42  
43 9 my @to_export;
44 9 my @args = @_;
45 9 for my $item (@args) {
46 push @to_export,
47 22 ▶ $item =~ s/^:// ? @{ $EXPORT_TAGS{$item} || [] } : $item;
Branch: 2 branches
BranchTrueFalseTotal
$item =~ s/^:// ? : 9 13 22
$Net::SSH::Perl::Util::EXPORT_TAGS{$item} or [] 0 9 9
48 }
49  
50 9 my %loaded;
51 5 ▶ no strict 'refs'; ## no critic
Subroutine BEGIN: called CC=1 SCAR=0.0
52 9 for my $func (@to_export) {
53 44 my $mod = join '::', __PACKAGE__, $FUNC_TO_MOD{$func};
54 44 ▶ unless ($loaded{$mod}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($loaded{$mod}) 44 0 44
55 44 (my $lib = $mod . ".pm") =~ s!::!/!g;
56 44 require $lib;
57 }
58 44 *{"${callpack}::$func"} = \&{"${mod}::$func"};
59 }
60 }
61  
62 5 1;
63 __END__
« blib/lib/Net/SSH/Perl/Kex/DH.pm ↑ Summary blib/lib/Net/SSH/Perl/Cipher/CTR.pm »