File Coverage

blib/lib/Sys/Async/Virt/Connection/Local.pm
Criterion Covered Total %
statement 32 55 58.1
branch 0 2 0.0
condition 0 3 0.0
subroutine 11 15 73.3
pod 2 4 50.0
total 45 79 56.9


line stmt bran cond sub pod time code
1             ####################################################################
2             #
3             # This file was generated using XDR::Parse version v1.0.1
4             # and LibVirt version v12.1.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     1   2026 use v5.26;
  1         4  
14 1     1   8 use warnings;
  1         2  
  1         82  
15 1     1   6 use experimental 'signatures';
  1         2  
  1         9  
16 1     1   200 use Future::AsyncAwait;
  1         2  
  1         10  
17 1     1   95 use Object::Pad ':experimental(inherit_field)';
  1         4  
  1         12  
18              
19             class Sys::Async::Virt::Connection::Local v0.6.1;
20              
21 1     1   1229 inherit Sys::Async::Virt::Connection '$_in', '$_out';
  1         4  
  1         149  
22              
23 1     1   11 use Carp qw(croak);
  1         2  
  1         79  
24 1     1   9 use Future::IO;
  1         2  
  1         48  
25 1     1   795 use IO::Socket;
  1         13380  
  1         4  
26 1     1   409 use IO::Socket::UNIX;
  1         2  
  1         7  
27 1     1   2782 use Log::Any qw($log);
  1         2  
  1         11  
28              
29 0     0 0   field $_url :param :reader;
  0            
30             field $_readonly :param = undef;
31             field $_socket :param = undef;
32              
33 0     0 0   async method close() {
  0            
  0            
  0            
34             # Work around for Future::IO which doesn't
35             # like handles being closed when there are
36             # outstanding read/write requests (causing
37             # warnings of undefined values)
38 0           $self->_finalize_io();
39             # When Future::IO and/or IO::Async are changed
40             # (ready_for_input() is where this happens),
41             # the handle *can* be closed.
42             # $_in->close;
43 0           return;
44             }
45              
46 0     0 1   async method connect() {
  0            
  0            
  0            
47             # disect URL
48 0 0 0       $_socket //=
49             '/run/libvirt/libvirt-sock' . ($_readonly ? '-ro' : '');
50              
51 0           my $sock = IO::Socket->new(
52             Domain => AF_UNIX,
53             Type => SOCK_STREAM,
54             );
55 0           binmode $sock, ':bytes';
56 0           $sock->blocking( 0 );
57              
58 0           $_in = $_out = $sock;
59 0           my $addr = sockaddr_un( $_socket );
60 0           await Future::IO->connect( $sock, $addr );
61             }
62              
63 0     0 1   method is_secure() {
  0            
  0            
64 0           return 1;
65             }
66              
67             1;
68              
69              
70             __END__