App-CmdDispatch
view release on metacpan or search on metacpan
t/lib/Test/IO.pm view on Meta::CPAN
package Test::IO;
use warnings;
use strict;
sub new
{
my ($class, $input) = (@_, '');
my $self = {
output => '',
input => [ map { "$_\n" } split /\n/, $input ],
};
return bless $self, $class;
}
sub print
{
my $self = shift;
$self->{output} .= join( '', @_ );
return 1;
}
sub readline
{
my ($self) = @_;
return shift @{$self->{input}};
}
sub prompt
{
my $self = shift;
$self->print( @_ );
return $self->readline();
}
sub output
{
my ($self) = @_;
return $self->{output};
}
sub clear
{
my ($self) = @_;
$self->{output} = '';
return;
}
1;
( run in 0.818 second using v1.01-cache-2.11-cpan-0b5f733616e )