Can I use isa in Moose with a regex as a parameter ? If not possible can I achieve the same thing with someothing other than ->isa
?
ok, having the following types Animal::Giraffe
, Animal::Carnivore::Crocodile
, I want to do ->isa(/^Animal::/)
, can I do that ? if I can't, what can I use to reach the desired effect ?
These related types should all "do" the same role, Animal. Then you can write:
has 'animal' => (
is => 'ro',
does => 'Animal',
required => 1,
);
Now you have something much more reliable than a regex to ensure the consistency of your program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With