Guillaume,
Take a look at how the Maybe[`a] type is implemented (on line 615 of
Moose::Util::TypeConstraints) and use that as a guide.
Currently there is no clean, or easy way to do this though, you are
stepping into new territory.
- Stevan
On Jul 14, 2008, at 5:16 PM, Guillaume Rousse wrote:
Hello list.
I'd like to define my own parameterized ClassName subtype, to
enforce inheritance from a given class. Something more generic than
subtype 'FooClassName'
=> as 'ClassName'
=> where { $_->isa('Foo') };
subtype 'BarClassName'
=> as 'ClassName'
=> where { $_->isa('Bar') };
etc...
I found a 'add_parameterizable_type' method in
Moose::Util::TypeConstraints, but not much details about to
retrieve the parameter in the constraint clause.
--
Guillaume Rousse
Moyens Informatiques - INRIA Futurs
Tel: 01 69 35 69 62