summaryrefslogtreecommitdiff
path: root/ext/XS-APItest/t/Hoisted.pm
blob: a92e26ec635b7b55363e78df9cdb3fb8904c7558 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package Hoisted;
use XS::APItest;
use Carp;

XS::APItest::create_hoisted_subs(<<'CODE');
sub getline {
    @_ == 1 or croak 'usage: $io->getline()';
    my $this = shift;
    return scalar <$this>;
}

sub getlines {
    @_ == 1 or croak 'usage: $io->getlines()';
    wantarray or
	croak 'Can\'t call $io->getlines in a scalar context, use $io->getline';
    my $this = shift;
    return <$this>;
}

1;
CODE

1;