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 2     2   1169 use strict;
  2         5  
  2         62  
35 2     2   10 use warnings;
  2         3  
  2         57  
36              
37 2     2   10 use parent qw( IO::Framed::X::Base );
  2         4  
  2         15  
38              
39             sub _new {
40 2     2   445 my ($class) = @_;
41              
42 2         14 return $class->SUPER::_new( 'Got empty read; EOF?' );
43             }
44              
45             1;