+ - throw an error on non-string builder (RT#78479)
- require D::GD 0.07 to avoid prototype mismatch errors
- fix stupid typo in new Sub::Quote section
die "Unknown is ${is}";
}
$spec->{builder} = '_build_'.$name if ($spec->{builder}||0) eq 1;
+ die "Invalid builder for $into->$name - not a string"
+ if exists $spec->{builder} and ref $spec->{builder};
if (($spec->{predicate}||0) eq 1) {
$spec->{predicate} = $name =~ /^_/ ? "_has${name}" : "has_${name}";
}
);
}
+is(
+ exception { $gen->generate_method('Foo' => 'ten' => { is => 'ro', builder => '_build_ten' }) },
+ undef, 'builder - string accepted',
+);
+
+like(
+ exception { $gen->generate_method('Foo' => 'eleven' => { is => 'ro', builder => sub {} }) },
+ qr/Invalid builder/, 'builder - coderef rejected'
+);
+
my $foo = Foo->new(one => 1);
is($foo->one, 1, 'ro reads');