| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # No-op plugin example. | 
| 2 |  |  |  |  |  |  | package IO::Stream::Noop; | 
| 3 | 1 |  |  | 1 |  | 1503 | use 5.010001; | 
|  | 1 |  |  |  |  | 3 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 28 |  | 
| 5 | 1 |  |  | 1 |  | 3 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 15 |  | 
| 6 | 1 |  |  | 1 |  | 11 | use utf8; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 7 | 1 |  |  | 1 |  | 26 | use Carp; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 68 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our $VERSION = 'v2.0.3'; | 
| 10 |  |  |  |  |  |  |  | 
| 11 | 1 |  |  | 1 |  | 6 | use IO::Stream::const; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub new { | 
| 14 | 2 |  |  | 2 | 0 | 921 | my ($class) = @_; | 
| 15 | 2 |  |  |  |  | 11 | my $self = bless { | 
| 16 |  |  |  |  |  |  | out_buf     => q{},                 # modified on: OUT | 
| 17 |  |  |  |  |  |  | out_pos     => undef,               # modified on: OUT | 
| 18 |  |  |  |  |  |  | out_bytes   => 0,                   # modified on: OUT | 
| 19 |  |  |  |  |  |  | in_buf      => q{},                 # modified on: IN | 
| 20 |  |  |  |  |  |  | in_bytes    => 0,                   # modified on: IN | 
| 21 |  |  |  |  |  |  | ip          => undef,               # modified on: RESOLVED | 
| 22 |  |  |  |  |  |  | is_eof      => undef,               # modified on: EOF | 
| 23 |  |  |  |  |  |  | }, $class; | 
| 24 | 2 |  |  |  |  | 15 | return $self; | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | sub PREPARE { | 
| 28 | 2 |  |  | 2 | 0 | 3 | my ($self, $fh, $host, $port) = @_; | 
| 29 | 2 |  |  |  |  | 11 | $self->{_slave}->PREPARE($fh, $host, $port); | 
| 30 | 2 |  |  |  |  | 3 | return; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub WRITE { | 
| 34 | 2 |  |  | 2 |  | 762 | my ($self) = @_; | 
| 35 | 2 |  |  |  |  | 5 | my $m = $self->{_master}; | 
| 36 | 2 |  |  |  |  | 3 | $self->{out_buf}    = $m->{out_buf}; | 
| 37 | 2 |  |  |  |  | 4 | $self->{out_pos}    = $m->{out_pos}; | 
| 38 | 2 |  |  |  |  | 3 | $self->{out_bytes}  = $m->{out_bytes}; | 
| 39 | 2 |  |  |  |  | 6 | $self->{_slave}->WRITE(); | 
| 40 | 2 |  |  |  |  | 3 | return; | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | sub EVENT { | 
| 44 | 8 |  |  | 8 | 0 | 3917 | my ($self, $e, $err) = @_; | 
| 45 | 8 |  |  |  |  | 13 | my $m = $self->{_master}; | 
| 46 | 8 | 100 |  |  |  | 15 | if ($e & OUT) { | 
| 47 | 2 |  |  |  |  | 6 | $m->{out_buf}   = $self->{out_buf}; | 
| 48 | 2 |  |  |  |  | 4 | $m->{out_pos}   = $self->{out_pos}; | 
| 49 | 2 |  |  |  |  | 2 | $m->{out_bytes} = $self->{out_bytes}; | 
| 50 |  |  |  |  |  |  | } | 
| 51 | 8 | 100 |  |  |  | 14 | if ($e & IN) { | 
| 52 | 2 |  |  |  |  | 4 | $m->{in_buf}    .= $self->{in_buf}; | 
| 53 | 2 |  |  |  |  | 5 | $m->{in_bytes}  += $self->{in_bytes}; | 
| 54 | 2 |  |  |  |  | 3 | $self->{in_buf}  = q{}; | 
| 55 | 2 |  |  |  |  | 3 | $self->{in_bytes}= 0; | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 8 | 100 |  |  |  | 13 | if ($e & RESOLVED) { | 
| 58 | 2 |  |  |  |  | 3 | $m->{ip} = $self->{ip}; | 
| 59 |  |  |  |  |  |  | } | 
| 60 | 8 | 100 |  |  |  | 11 | if ($e & EOF) { | 
| 61 | 2 |  |  |  |  | 3 | $m->{is_eof} = $self->{is_eof}; | 
| 62 |  |  |  |  |  |  | } | 
| 63 | 8 |  |  |  |  | 21 | $m->EVENT($e, $err); | 
| 64 | 8 |  |  |  |  | 14 | return; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | 1; |