Virt/Connection/Process.pm

filter: Statementstmt 56.1% 41 / 73 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 68.7% 11 / 16 Podpod 33.3% 1 / 3 totaltotal 54.0% 53 / 98 CC 4 SCAR 9.7
CC
4
Cov
52%
close
6.0
_command
6.0
connect
6.0
CRAP 2.6
« Virt/Callback.pm ↑ Summary Virt/Connection/TCP.pm »
1 ####################################################################
2 #
3 # This file was generated using XDR::Parse version v1.0.1
4 # and LibVirt version v12.9.0
5 #
6 # Don't edit this file, use the source template instead
7 #
8 # ANY CHANGES HERE WILL BE LOST !
9 #
10 ####################################################################
11  
12  
13 1 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Future::AsyncAwait;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Object::Pad ':experimental(inherit_field)';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 class Sys::Async::Virt::Connection::Process v0.6.9;
20  
21 1 inherit Sys::Async::Virt::Connection '$_in', '$_out';
22  
23 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 1 ▶use Future::IO;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use IO::Handle;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use IPC::Open2;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 1 ▶use Protocol::Sys::Virt::URI v12.9.0; # imports parse_url
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 0 ▶field $_url :param :reader;
Subroutine url: not called CC=1 SCAR=2.6
Pod undocumented
32 1 field $_pid;
33 1 field $_exit_f;
34  
35 0 ▶async method close() {
Subroutine close: not called CC=2 SCAR=17.9
Pod undocumented
36 0 ▶ unless ($_exit_f->is_ready) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_exit_f->is_ready) 0 0 0
37 0 kill 'TERM', $_pid;
38 }
39 ### TODO: log exit status
40 0 await $_exit_f;
41 1 }
42  
43 0 ▶method _command( $url ) {
Subroutine _command: not called CC=2 SCAR=17.9
44 0 my %c = parse_url( $url );
45 0 ▶ if (exists $c{query}->{argv}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $c{'query'}{'argv'}) { } 0 0 0
46 0 return ( $c{query}->{command}, $c{query}->{argv}->@* );
47 }
48 else {
49 0 return ( $c{query}->{command} );
50 }
51 1 }
52  
53 0 ▶async method connect() {
Subroutine connect: not called CC=2 SCAR=17.9
Pod documented
54 0 my @cmd = $self->_command( $_url );
55 0 $log->trace('Connection process command: ' . join(' ', @cmd));
56  
57 0 ▶ $_pid = open2( $_in, $_out, @cmd )
Branch: 1 branch
BranchTrueFalseTotal
$_pid = open2($_in, $_out, @cmd) or die "Unable to open external command: $!" 0 0 0
58 or die "Unable to open external command: $!";
59 0 $_out->autoflush( 1 );
60 0 $_out->blocking( 0 );
61 0 $_in->autoflush( 1 );
62 0 $_in->blocking( 0 );
63 0 $_exit_f = Future::IO->waitpid( $_pid );
64 0 ▶ $_exit_f->on_ready(sub { $self->_finalize_io });
Subroutine __ANON__: not called CC=1 SCAR=6.9
65  
66 0 return;
67 1 }
68  
69 1 1;
70  
71  
72 __END__
« Virt/Callback.pm ↑ Summary Virt/Connection/TCP.pm »