In the latest development releases of Types::Standard, you can do this:
use Types::Standard is_InstanceOf => { of => "FishTaco::Topping", -as +=> "is_Topping" }; is_Topping( $something ); # returns a boolean
If you've got Type::Tiny::XS installed, this will be an XS function, so pretty darn fast to call. I haven't done a lot of benchmarking on it, but I'd wager a lot faster than a blessed+isa check. If you don't, then it's still not going to be slow.
(Older versions, you can do something like this for the same effect...
BEGIN { require Types::Standard; *is_Topping = Types::Standard::InstanceOf->parameterize("FishTaco::T +opping")->compiled_check; };
Newer versions just provide support for of in the import method.)
In reply to Re^3: Trouble with, or misunderstanding of, Types::Standard ArrayRef[elements] enforcement in Moo
by tobyink
in thread Trouble with, or misunderstanding of, Types::Standard ArrayRef[elements] enforcement in Moo
by Your Mother
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |