6 use Test::More tests => 14;
12 has bar => ( is => "rw" );
13 has baz => ( is => "rw" );
16 my ( $self, @args ) = @_;
17 unshift @args, "bar" if @args % 2 == 1;
27 foreach my $class qw(Foo Bar) {
28 is( $class->new->bar, undef, "no args" );
29 is( $class->new( bar => 42 )->bar, 42, "normal args" );
30 is( $class->new( 37 )->bar, 37, "single arg" );
32 my $o = $class->new(bar => 42, baz => 47);
33 is($o->bar, 42, '... got the right bar');
34 is($o->baz, 47, '... got the right bar');
37 my $o = $class->new(42, baz => 47);
38 is($o->bar, 42, '... got the right bar');
39 is($o->baz, 47, '... got the right bar');