12 has bar => ( is => "rw" );
13 has baz => ( is => "rw" );
16 my ( $self, @args ) = @_;
17 unshift @args, "bar" if @args % 2 == 1;
21 __PACKAGE__->meta->make_immutable;
28 __PACKAGE__->meta->make_immutable;
31 foreach my $class qw(Foo Bar) {
32 is( $class->new->bar, undef, "no args" );
33 is( $class->new( bar => 42 )->bar, 42, "normal args" );
34 is( $class->new( 37 )->bar, 37, "single arg" );
36 my $o = $class->new(bar => 42, baz => 47);
37 is($o->bar, 42, '... got the right bar');
38 is($o->baz, 47, '... got the right bar');
41 my $o = $class->new(42, baz => 47);
42 is($o->bar, 42, '... got the right bar');
43 is($o->baz, 47, '... got the right bar');