Stream/Noop.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 63 CC 5 SCAR 26.1
CC
5
Cov
0%
EVENT
30.0
new
2.0
PREPARE
2.0
CRAP 13.7
1 # No-op plugin example.
2 package IO::Stream::Noop;
3 use warnings;
4 use strict;
5  
6 use version; our $VERSION = qv('1.0.10');
7  
8 use IO::Stream::const;
9  
10 sub new {
11 my ($class) = @_;
12 my $self = bless {
13 out_buf => q{}, # modified on: OUT
14 out_pos => undef, # modified on: OUT
15 out_bytes => 0, # modified on: OUT
16 in_buf => q{}, # modified on: IN
17 in_bytes => 0, # modified on: IN
18 ip => undef, # modified on: RESOLVED
19 is_eof => undef, # modified on: EOF
20 }, $class;
21 return $self;
22 }
23  
24 sub PREPARE {
25 my ($self, $fh, $host, $port) = @_;
26 $self->{_slave}->PREPARE($fh, $host, $port);
27 return;
28 }
29  
30 sub WRITE {
31 my ($self) = @_;
32 my $m = $self->{_master};
33 $self->{out_buf} = $m->{out_buf};
34 $self->{out_pos} = $m->{out_pos};
35 $self->{out_bytes} = $m->{out_bytes};
36 $self->{_slave}->WRITE();
37 return;
38 }
39  
40 sub EVENT {
41 my ($self, $e, $err) = @_;
42 my $m = $self->{_master};
43 if ($e & OUT) {
44 $m->{out_buf} = $self->{out_buf};
45 $m->{out_pos} = $self->{out_pos};
46 $m->{out_bytes} = $self->{out_bytes};
47 }
48 if ($e & IN) {
49 $m->{in_buf} .= $self->{in_buf};
50 $m->{in_bytes} += $self->{in_bytes};
51 $self->{in_buf} = q{};
52 $self->{in_bytes}= 0;
53 }
54 if ($e & RESOLVED) {
55 $m->{ip} = $self->{ip};
56 }
57 if ($e & EOF) {
58 $m->{is_eof} = $self->{is_eof};
59 }
60 $m->EVENT($e, $err);
61 return;
62 }
63  
64  
65 1;