xref: /unit/test/perl/body_io_fake/IOFake.pm (revision 916:a7034804fe9c)
1package IOFake;
2
3sub new {
4    my $class = shift;
5    my $errors = shift;
6    my $self = {};
7
8    $self->{_count} = 2;
9    $self->{_errors} = $errors;
10
11    bless $self, $class;
12    return $self;
13}
14
15sub getline() {
16    my $self = shift;
17
18    if ($self->{_count} > 0) {
19        return $self->{_count}--;
20    }
21
22    $self->{_errors}->print('IOFake getline() $/ is ' . ${ $/ });
23
24    return;
25}
26
27sub close() {
28    my $self = shift;
29
30    $self->{_errors}->print('IOFake close() called');
31};
32
331;
34