6 use Test::More tests => 7;
14 has x => ( is => 'rw', default => 0 );
16 sub inc { $_[0]->x( 1 + $_[0]->x ) }
19 wantarray ? (qw/a b c/) : "x";
23 die "this must be void context" if defined wantarray;
31 after qw/scalar_or_array void/ => sub {
37 my $base = TouchyBase->new;
38 my $after = AfterSub->new;
40 foreach my $obj ( $base, $after ) {
42 my @array = $obj->scalar_or_array;
43 my $scalar = $obj->scalar_or_array;
45 is_deeply(\@array, [qw/a b c/], "array context ($class)");
46 is($scalar, "x", "scalar context ($class)");
51 ok( !$@, "void context ($class)" );
54 if ( $obj->isa("AfterSub") ) {
55 is( $obj->x, 3, "methods were wrapped" );