6 use Test::More tests => 7;
16 has string_ref => ( is => 'rw', default => sub { my $x = "moose fruit"; \$x } );
17 has x => ( is => 'rw', default => 0 );
19 sub inc { $_[0]->x( 1 + $_[0]->x ) }
22 wantarray ? (qw/a b c/) : "x";
26 split(/\s+/,"foo bar gorch baz la");
30 die "this must be void context" if defined wantarray;
33 sub substr_lvalue : lvalue {
35 my $string_ref = $self->string_ref;
36 my $lvalue_ref = \substr($$string_ref, 0, 5);
45 after qw/scalar_or_array array_arity void substr_lvalue/ => sub {
51 my $base = TouchyBase->new;
52 my $after = AfterSub->new;
54 foreach my $obj ( $base, $after ) {
56 my @array = $obj->scalar_or_array;
57 my $scalar = $obj->scalar_or_array;
59 is_deeply(\@array, [qw/a b c/], "array context ($class)");
60 is($scalar, "x", "scalar context ($class)");
65 ok( !$@, "void context ($class)" );