| 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<allow_empty_read()> on the | ||
| 29 | L<IO::Framed::Read> instance; otherwise, you should probably always trap | ||
| 30 | this error so you can cleanly shut things down. | ||
| 31 | |||
| 32 | =cut | ||
| 33 | |||
| 34 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | 2 | ▶ | use parent qw( IO::Framed::X::Base ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 38 | |||
| 39 | sub _new { | ||
| 40 | 2 | ▶ | my ($class) = @_; |
|
Subroutine
_new: called CC=1 SCAR=0.0
| |||
| 41 | |||
| 42 | 2 | return $class->SUPER::_new( 'Got empty read; EOF?' ); | |
| 43 | } | ||
| 44 | |||
| 45 | 2 | 1; | |