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 should probably always trap this error so you can cleanly shut things
29             down.
30              
31             =cut
32              
33 1     1   349 use strict;
  1         3  
  1         37  
34 1     1   5 use warnings;
  1         2  
  1         27  
35              
36 1     1   3 use parent qw( X::Tiny::Base );
  1         2  
  1         4  
37              
38             sub _new {
39 1     1   163 my ($class) = @_;
40              
41 1         6 return $class->SUPER::_new( 'Got empty read; EOF?' );
42             }
43              
44             1;