Creates a new code reference for each of the attribute's handles methods.
+=head2 find_type_constraint -> CODE
+
+Returns a code reference which can be used to check that a given value passes
+this attribute's type constraint;
+
+=head2 verify_type_constraint Item -> 1 | ERROR
+
+Checks that the given value passes this attribute's type constraint. Returns 1
+on success, otherwise C<confess>es.
+
=cut
if (!exists($args{$key})) {
if ($attribute->has_default || $attribute->has_builder) {
- my $default = $attribute->default;
-
unless ($attribute->is_lazy) {
+ my $default = $attribute->default;
my $builder = $attribute->builder;
my $value = $attribute->has_builder
? $instance->$builder
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More tests => 10;
use Test::Exception;
do {
is($attr->predicate, 'has_pawn', 'predicate');
is($attr->clearer, 'clear_pawn', 'clearer');
is(ref($attr->default), 'CODE', 'default is a coderef');
-
+ok($attr->verify_type_constraint(1), 'verify_type_constraint works even without isa');