File Coverage

blib/lib/IO/Select/SSL.pm
Criterion Covered Total %
statement 11 28 39.2
branch 0 10 0.0
condition 0 6 0.0
subroutine 4 7 57.1
pod 3 3 100.0
total 18 54 33.3


line stmt bran cond sub pod time code
1             package IO::Select::SSL;
2              
3 1     1   8432 use 5.006;
  1         6  
4 1     1   4 use strict;
  1         1  
  1         16  
5 1     1   3 use warnings;
  1         1  
  1         36  
6 1     1   3 use base qw(IO::Select);
  1         1  
  1         487  
7              
8             our $VERSION = '0.03';
9              
10             # can_read( [ $timeout ] )
11             # Assume pending SSL handles have priority since no select() syscall is required
12             sub can_read {
13 0     0 1   my $self = shift;
14 0 0         if (my @ssl = $self->pending_handles) {
15 0           return @ssl;
16             }
17 0           return $self->SUPER::can_read(@_);
18             }
19              
20             # select ( READ, WRITE, ERROR [, TIMEOUT ] )
21             # Assume pending SSL read handles have priority since no select() syscall is required
22             sub select {
23 0     0 1   my $class = shift;
24 0 0         if (my $reader = $_[0]) {
25 0 0         if (my @ssl = $reader->pending_handles) {
26 0           return (\@ssl, [], []);
27             }
28             }
29 0           return $class->SUPER::select(@_);
30             }
31              
32             # pending_handles
33             # Return a list of handles that already have pending but unread data in its INPUT buffer.
34             sub pending_handles {
35 0     0 1   my $self = shift;
36 0           my @ssl = ();
37 0           foreach my $handle ($self->handles) {
38 0 0 0       if (ref($handle) =~ /::/ and
      0        
39             $handle->can("pending") and
40             $handle->pending) {
41 0           push @ssl, $handle;
42             }
43             }
44 0 0         if (@ssl) {
45 0           return @ssl;
46             }
47 0           return ();
48             }
49              
50             # Autoload methods go after =cut, and are processed by the autosplit program.
51              
52             1;
53             __END__