13 has x => ( is => 'rw', default => 0 );
15 sub inc { $_[0]->x( 1 + $_[0]->x ) }
18 wantarray ? (qw/a b c/) : "x";
22 die "this must be void context" if defined wantarray;
30 after qw/scalar_or_array void/ => sub {
36 my $base = TouchyBase->new;
37 my $after = AfterSub->new;
39 foreach my $obj ( $base, $after ) {
41 my @array = $obj->scalar_or_array;
42 my $scalar = $obj->scalar_or_array;
44 is_deeply(\@array, [qw/a b c/], "array context ($class)");
45 is($scalar, "x", "scalar context ($class)");
50 ok( !$@, "void context ($class)" );
53 if ( $obj->isa("AfterSub") ) {
54 is( $obj->x, 3, "methods were wrapped" );