X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FTypeConstraint.pm;h=ab6e6e7e1fc3f1b5e765aeb7ec6e41ea50e032fe;hb=9c44971f087c3b69a46685ba068b2f1f42120935;hp=caf0ef8ef552e5ac7fb57642ed5ff530b916c4a3;hpb=eb4cc222991e509161ef9e03735ba26848d1ed17;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/TypeConstraint.pm b/lib/Moose/Meta/TypeConstraint.pm index caf0ef8..ab6e6e7 100644 --- a/lib/Moose/Meta/TypeConstraint.pm +++ b/lib/Moose/Meta/TypeConstraint.pm @@ -50,6 +50,12 @@ __PACKAGE__->meta->add_attribute('inlined' => ( predicate => '_has_inlined_type_constraint', )); +__PACKAGE__->meta->add_attribute('inline_environment' => ( + init_arg => 'inline_environment', + accessor => 'inline_environment', + default => sub { {} }, +)); + sub parents { my $self; $self->parent; @@ -252,7 +258,8 @@ sub _actually_compile_type_constraint { if ( $self->has_inlined_type_constraint ) { return eval_closure( - source => 'sub { ' . $self->_inline_check('$_[0]') . ' }', + source => 'sub { ' . $self->_inline_check('$_[0]') . ' }', + environment => $self->inline_environment, ); }