Devel/IPerl/ReadLine/String.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
ReadLine
2.0
readline
2.0
cmd
2.0
CRAP 2.0
1 package Devel::IPerl::ReadLine::String;
2 $Devel::IPerl::ReadLine::String::VERSION = '0.012';
3 # This implements a mocked up version of the ReadLine interface.
4  
5 use strict;
6 use warnings;
7  
8 sub ReadLine { __PACKAGE__ };
9 sub readline { $_[0]->{cmd} }
10 sub cmd { $_[0]->{cmd} = $_[1] }
11 sub new {
12 my $string;
13  
14 my $self = bless {
15 cmd => $_[1]->{cmd},
16 string => \$string,
17 }, __PACKAGE__;
18  
19 open($self->{OUT}, '>', \${$self->{string}})
20 or die "Could not open string for writing";
21  
22 $self;
23 }
24  
25 sub string {
26 my ($self) = @_;
27 $self->{string};
28 }
29 sub clear_output {
30 my ($self) = @_;
31 ${$self->{string}} = "";
32 seek $self->{OUT}, 0, 0;
33 }
34 sub OUT {
35 my ($self) = @_;
36 $self->{OUT};
37 }
38  
39 1;
40  
41 __END__