File Coverage

blib/lib/IO/Framed/X/EmptyRead.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package IO::Framed::X::EmptyRead;
2              
3             =encoding utf-8
4              
5             =head1 NAME
6              
7             IO::Framed::X::EmptyRead
8              
9             =head1 SYNOPSIS
10              
11             use Try::Tiny;
12             use IO::Framed::Read;
13              
14             my $iof = IO::Framed::Read->new( $some_socket );
15              
16             try { $iof->read(20) }
17             catch {
18             if ( try { $_->isa('IO::Framed::Read') } ) { ... }
19             };
20              
21             =head1 DESCRIPTION
22              
23             Thrown when a read operation returns empty but without an error from the
24             operating system. This isn’t an *error* so much as just an “exceptional
25             condition” that so radically changes the application state that it’s
26             worth throwing on.
27              
28             You can suppress this error by setting C on the
29             L instance; otherwise, you should probably always trap
30             this error so you can cleanly shut things down.
31              
32             =cut
33              
34 1     1   570 use strict;
  1         2  
  1         30  
35 1     1   5 use warnings;
  1         2  
  1         29  
36              
37 1     1   6 use parent qw( IO::Framed::X::Base );
  1         2  
  1         5  
38              
39             sub _new {
40 1     1   199 my ($class) = @_;
41              
42 1         7 return $class->SUPER::_new( 'Got empty read; EOF?' );
43             }
44              
45             1;