6 use Test::More tests => 8;
16 has x => ( is => 'rw', default => 0 );
18 sub inc { $_[0]->x( 1 + $_[0]->x ) }
21 wantarray ? (qw/a b c/) : "x";
25 die "this must be void context" if defined wantarray;
33 after qw/scalar_or_array void/ => sub {
39 my $base = TouchyBase->new;
40 my $after = AfterSub->new;
42 foreach my $obj ( $base, $after ) {
44 my @array = $obj->scalar_or_array;
45 my $scalar = $obj->scalar_or_array;
47 is_deeply(\@array, [qw/a b c/], "array context ($class)");
48 is($scalar, "x", "scalar context ($class)");
53 ok( !$@, "void context ($class)" );
56 if ( $obj->isa("AfterSub") ) {
57 is( $obj->x, 3, "methods were wrapped" );