File Coverage

blib/lib/PerlIO/via/chop.pm
Criterion Covered Total %
statement 10 17 58.8
branch 1 2 50.0
condition n/a
subroutine 3 4 75.0
pod 0 2 0.0
total 14 25 56.0


line stmt bran cond sub pod time code
1             package PerlIO::via::chop;
2              
3             # Set the version info
4             # Make sure we do things by the book from now on
5              
6             $VERSION = '0.01';
7              
8 1     1   972 use strict;
  1         2  
  1         272  
9              
10             # Make sure the encoding/decoding stuff is available
11              
12             1;
13              
14 1     1 0 3212 sub PUSHED { bless \*PUSHED,$_[0] }
15 0     0 0 0 sub FILL { readline( $_[1] ) }
16              
17             my %buffer;
18             sub WRITE {
19 1     1   16 my $buffer = $buffer{$_[2]};
20 1 50       4 if (defined $buffer) {
21 0         0 print {$_[2]} $buffer;
  0         0  
22 0         0 print {$_[2]} substr($_[1], 0, -1);
  0         0  
23 0         0 $buffer{$_[2]} = substr($_[1], -1);
24 0         0 return length($_[1]);
25             }
26             else {
27 1         2 print {$_[2]} substr($_[1], 0, -1);
  1         4  
28 1         6 $buffer{$_[2]} = substr($_[1], -1);
29 1         8 return length($_[1]) - 1;
30             }
31             } #WRITE
32              
33              
34             1;
35             __END__