File Coverage

blib/lib/IO/Async/Loop/linux.pm
Criterion Covered Total %
statement 6 12 50.0
branch 0 4 0.0
condition n/a
subroutine 2 3 66.6
pod 0 1 0.0
total 8 20 40.0


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2009 -- leonerd@leonerd.org.uk
5              
6             package IO::Async::Loop::linux;
7              
8 1     1   679 use strict;
  1         2  
  1         29  
9 1     1   4 use warnings;
  1         1  
  1         125  
10              
11             our $VERSION = '0.04';
12              
13             =head1 NAME
14              
15             C - pick the best Loop implementation on Linux
16              
17             =head1 DESCRIPTION
18              
19             If this module is installed, then the best Loop implementation will
20             automatically be picked when C<< IO::Async::Loop->new() >> is called on a
21             Linux machine. It will attempt to use either of the following, in order, if
22             they are available
23              
24             =over 4
25              
26             =item *
27              
28             L
29              
30             =item *
31              
32             L
33              
34             =back
35              
36             The end application using L does not need to make any special
37             effort to use these; the magic constructor in L will
38             automatically find and use it if it is installed.
39              
40             $ perl -MIO::Async::Loop -E 'say ref IO::Async::Loop->new'
41             IO::Async::Loop::Epoll
42              
43             =cut
44              
45             sub new
46             {
47 0     0 0   shift;
48 0 0         eval { require IO::Async::Loop::Epoll } and return IO::Async::Loop::Epoll->new;
  0            
49 0 0         eval { require IO::Async::Loop::Ppoll } and return IO::Async::Loop::Ppoll->new;
  0            
50 0           die;
51             }
52              
53             # Keep perl happy; keep Britain tidy
54             1;
55              
56             __END__