Tests: added test for reading body from IO::Handle-like object.
This commit is contained in:
33
test/perl/body_io_fake/IOFake.pm
Normal file
33
test/perl/body_io_fake/IOFake.pm
Normal file
@@ -0,0 +1,33 @@
|
||||
package IOFake;
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $errors = shift;
|
||||
my $self = {};
|
||||
|
||||
$self->{_count} = 2;
|
||||
$self->{_errors} = $errors;
|
||||
|
||||
bless $self, $class;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub getline() {
|
||||
my $self = shift;
|
||||
|
||||
if ($self->{_count} > 0) {
|
||||
return $self->{_count}--;
|
||||
}
|
||||
|
||||
$self->{_errors}->print('IOFake getline() $/ is ' . ${ $/ });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub close() {
|
||||
my $self = shift;
|
||||
|
||||
$self->{_errors}->print('IOFake close() called');
|
||||
};
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user