Promiser/IOAsync.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 20 CC 1 SCAR 6.9
CC
1
Cov
0%
_INIT
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::Curl::Promiser::IOAsync;
2  
3 use strict;
4 use warnings;
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Net::Curl::Promiser::IOAsync - support for L<IO::Async>
11  
12 =head1 SYNOPSIS
13  
14 my $loop = IO::Async::Loop->new();
15  
16 my $promiser = Net::Curl::Promiser::IOAsync->new($loop);
17  
18 my $handle = Net::Curl::Easy->new();
19 $handle->setopt( CURLOPT_URL() => $url );
20  
21 $promiser->add_handle($handle)->then(
22 sub { print "$url completed.$/" },
23 sub { warn "$url failed: " . shift },
24 )->finally( sub { $loop->stop() } );
25  
26 $loop->run();
27  
28 =head1 DESCRIPTION
29  
30 This module provides an L<IO::Async>-compatible subclass of
31 L<Net::Curl::Promiser>.
32  
33 See F</examples> in the distribution, as well as the tests,
34 for fleshed-out demonstrations.
35  
36 B<NOTE:> This class’s constructor requires an L<IO::Async::Loop> instance.
37  
38 =cut
39  
40 #----------------------------------------------------------------------
41  
42 use parent 'Net::Curl::Promiser::LoopBase';
43  
44 use Net::Curl::Promiser::Backend::IOAsync;
45  
46 #----------------------------------------------------------------------
47  
48 sub _INIT {
49 my ($self, $args_ar) = @_;
50  
51 return Net::Curl::Promiser::Backend::IOAsync->new($args_ar->[0]);
52 }
53  
54 1;