Type-Tie

 view release on metacpan or  search on metacpan

lib/Type/Nano.pm  view on Meta::CPAN

	my ($role) = @_;
	return !!1 if {
		'Type::API::Constraint'              => 1,
		'Type::API::Constraint::Constructor' => 1,
	}->{$role};
	"UNIVERSAL"->can("DOES") ? $proto->SUPER::DOES(@_) : $proto->isa(@_);
}

sub new { # Type::API::Constraint::Constructor
	my $class = ref($_[0]) ? ref(shift) : shift;
	my $self  = bless { @_ == 1 ? %{+shift} : @_ } => $class;
	
	$self->{constraint} ||= sub { !!1 };
	unless ($self->{name}) {
		require Carp;
		Carp::croak("Requires both `name` and `constraint`");
	}
	
	$self;
}

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.460 second using v1.00-cache-2.02-grep-82fe00e-cpan-48ebf85a1963 )