From: Graham Knop Date: Mon, 24 Jun 2013 04:47:24 +0000 (-0400) Subject: validate builder-sub with _validate_codulatable X-Git-Tag: v1.003000~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5d09ae9323f64822da6f6b0ffa5c212b4e34ab74;p=gitmo%2FMoo.git validate builder-sub with _validate_codulatable --- diff --git a/lib/Method/Generate/Accessor.pm b/lib/Method/Generate/Accessor.pm index 7c3cf1f..4cef7d1 100644 --- a/lib/Method/Generate/Accessor.pm +++ b/lib/Method/Generate/Accessor.pm @@ -56,10 +56,8 @@ sub generate_method { } if (exists $spec->{builder}) { if(ref $spec->{builder}) { - die "Invalid builder for $into->$name - not a method name, coderef or" - . " code-convertible object" - unless ref $spec->{builder} eq 'CODE' - or (blessed($spec->{builder}) and eval { \&{$spec->{builder}} }); + $self->_validate_codulatable('builder', $spec->{builder}, + "$into->$name", 'or a method name'); $spec->{builder_sub} = $spec->{builder}; $spec->{builder} = 1; }