Promiser/LoopBase.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 28 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
_SETOPT_FORBIDDEN
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::Curl::Promiser::LoopBase;
2  
3 use strict;
4 use warnings;
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Net::Curl::Promiser::LoopBase - Base class for event-loop-based implementations
11  
12 =head1 DESCRIPTION
13  
14 This subclass of L<Net::Curl::Promiser> provides abstract behaviors for
15 event loops. It doesn’t change the interface.
16  
17 =cut
18  
19 #----------------------------------------------------------------------
20  
21 use parent qw( Net::Curl::Promiser );
22  
23 use Net::Curl::Multi ();
24  
25 #----------------------------------------------------------------------
26  
27 sub new {
28 my $self = shift()->SUPER::new(@_);
29  
30 my ($backend, $multi) = @{$self}{'backend', 'multi'};
31  
32 $multi->setopt(
33 Net::Curl::Multi::CURLMOPT_TIMERDATA(),
34 $backend,
35 );
36  
37 $multi->setopt(
38 Net::Curl::Multi::CURLMOPT_TIMERFUNCTION(),
39 $backend->can('_CB_TIMER'),
40 );
41  
42 return $self;
43 }
44  
45 sub _SETOPT_FORBIDDEN {
46 my ($self_or_class) = @_;
47  
48 return (
49 $self_or_class->SUPER::_SETOPT_FORBIDDEN(),
50 qw( TIMERFUNCTION TIMERDATA ),
51 );
52 }
53  
54 1;