File Coverage

blib/lib/IO/All/String.pm
Criterion Covered Total %
statement 29 29 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 3 3 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1 3     3   1594 use strict; use warnings;
  3     3   6  
  3         92  
  3         15  
  3         7  
  3         148  
2             package IO::All::String;
3              
4 3     3   23 use IO::All -base;
  3         8  
  3         27  
5              
6             const type => 'string';
7              
8             sub string_ref {
9 3     3 1 12 my ($self, $ref) = @_;
10              
11 3     3   22 no strict 'refs';
  3         8  
  3         467  
12 3 100       8 *$self->{ref} = $ref if exists $_[1];
13              
14             return *$self->{ref}
15 3         11 }
16              
17             sub string {
18 1     1 1 1 my $self = shift;
19 1         2 bless $self, __PACKAGE__;
20 1         6 $self->_init;
21             }
22              
23             sub open {
24 1     1 1 2 my $self = shift;
25 1         2 my $str = '';
26 1         2 my $ref = \$str;
27 1         17 $self->string_ref($ref);
28 1     1   24 open my $fh, '+<', $ref;
  1         6  
  1         1  
  1         7  
29 1         614 $self->io_handle($fh);
30 1         10 $self->_set_binmode;
31 1         3 $self->is_open(1);
32             }
33              
34             1;