W32Perl.pm

filter: Statementstmt 55.1% 27 / 49 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 2 totaltotal 45.4% 35 / 77 CC 7 SCAR 20.3
CC
7
Cov
44%
_connect
20.0
protocol_class
12.0
_init
6.0
CRAP 7.6
↑ Summary W32Perl/SSH2.pm »
1 package Net::SSH::W32Perl;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Net::SSH::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Net::SSH::Perl::Constants qw( :protocol );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use constant DEFAULT_SSH_PORT => '22';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use constant IS_WIN32 => ($^O =~ /MSWin32/i);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use vars qw/ $VERSION @ISA/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 $VERSION = '0.05';
15  
16 1 @ISA = qw/Net::SSH::Perl/;
17  
18 0 ▶sub _init {
Subroutine _init: not called CC=2 SCAR=17.9
19 0 my $ssh = shift;
20 0 my %arg = @_;
21  
22 0 ▶ $arg{protocol} = 2 unless exists $arg{protocol};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg{"protocol"} 0 0 0
23  
24 0 $ssh->SUPER::_init(%arg);
25 }
26  
27 0 ▶sub _connect {
Subroutine _connect: not called CC=4 SCAR=30.0
28 0 my $ssh = shift;
29 0 ▶ return $ssh->SUPER::_connect(@_) unless IS_WIN32;
Branch: 1 branch
BranchTrueFalseTotal
unless &IS_WIN32() 0 0 0
30  
31 0 ▶ my $rport = $ssh->{config}->get('port') || DEFAULT_SSH_PORT;
Condition0%0/2
$ssh->{'config'}->get('port') || '22'
l!l
00
MC/DC0%0/1
$ssh->{'config'}->get('port') || '22'
$ssh->{'config'}->get('port')
Truth table0%0/2
A
A= $ssh->{'config'}->get('port')
Aresult
11
00
32 0 my $rhost = $ssh->{host};
33  
34 0 $ssh->debug("Connecting to $ssh->{host}, port $rport.");
35 0 ▶ my $sock = IO::Socket::INET->new(
Condition0%0/2
'IO::Socket::INET'->new('PeerAddr', $rhost, 'PeerPort', $rport, 'Proto', 'tcp') || die("Can't connect to ${rhost}: $!\n")
l!l
00
MC/DC0%0/1
'IO::Socket::INET'->new('PeerAddr', $rhost, 'PeerPort', $rport, 'Proto', 'tcp') || die("Can't connect to ${rhost}: $!\n")
'IO::Socket::INET'->new('PeerAddr', $rhost, 'PeerPort', $rport, 'Proto', 'tcp')
Truth table0%0/2
A
A= 'IO::Socket::INET'->new('PeerAddr', $rhost, 'PeerPort', $rport, 'Proto', 'tcp')
Aresult
11
00
36 PeerAddr => $rhost,
37 PeerPort => $rport,
38 Proto => 'tcp'
39 ) || die "Can't connect to $rhost: $!\n";
40
41 0 $ssh->{session}{sock} = $sock;
42  
43 0 my $t = $|;
44 0 $| = 0;
45 0 $ssh->debug("Socket created, turning on blocking...");
46 0 $sock->blocking(1);
47 0 $ssh->_exchange_identification;
48 0 $sock->blocking(0);
49 0 $| = $t;
50  
51 0 $ssh->debug("Connection established.");
52 }
53  
54 0 ▶sub protocol_class {
Subroutine protocol_class: not called CC=3 SCAR=24.8
Pod undocumented
55 0 ▶ return shift->SUPER::protocol_class(@_) unless IS_WIN32;
Branch: 1 branch
BranchTrueFalseTotal
unless &IS_WIN32() 0 0 0
56
57 0 ▶ die "SSH2 is the only supported protocol under MSWin32!"
Branch: 1 branch
BranchTrueFalseTotal
unless &PROTOCOL_SSH2() == $_[1] 0 0 0
58 unless (PROTOCOL_SSH2 == $_[1]);
59
60 0 return 'Net::SSH::W32Perl::SSH2';
61 }
62  
63 0 ▶sub Close {}
Subroutine Close: not called CC=1 SCAR=0.0
Pod undocumented
64  
65 1 1;
66 __END__
↑ Summary W32Perl/SSH2.pm »