Skip to content

Instantly share code, notes, and snippets.

@motemen
Created November 25, 2010 03:39
Show Gist options
  • Save motemen/714859 to your computer and use it in GitHub Desktop.
Save motemen/714859 to your computer and use it in GitHub Desktop.
package A;
use Moo;
use Mouse::Util::TypeConstraints ();
sub mouse_isa ($) {
my $t = Mouse::Util::TypeConstraints::find_or_create_isa_type_constraint($_[0]);
return sub { $t->assert_valid($_[0]) };
}
has foo => (
is => 'rw',
isa => mouse_isa('Int'),
);
has ua => (
is => 'rw',
isa => mouse_isa('LWP::UserAgent'),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment