Møøse

Flexible type constraint system

First a caveat, this is not proper type system (you have to wait for Perl 6 if you want that).

Type constraints are for when an object is more than you need.

subtype 'UpToEleven' => as 'Int' => where { $_ <= 11 };

has 'volume' => (is => 'rw', isa => 'UpToEleven');

subtype 'HTTP-Protocol' => as 'Str' => where { /^HTTP\/[0-9]\.[0-9]$/ }  
...
Copyright © 2006 Stevan Little