http://www.perlmonks.org?node_id=994165

neilwatson has asked for the wisdom of the Perl Monks concerning the following question:

Greetings Sisters and Brothers, I'm learning Moose. I'm trying to set a subtype type but, having trouble. Please consider the following:
subtype 'cf_class', => as 'Str', => where { m/a-zA-Z0-9/ }, => message { 'Not a valid cf class' }; has 'class' => { is => 'rw', isa => 'cf_class' };
I'm getting this error:
Usage: has 'name' => ( key => value, ... ) at /home/neil/perl5/lib/per +l5/x86_64-linux-thread-multi/Moose.pm line 74. Moose::has('Moose::Meta::Class=HASH(0x2b9fe98)', 'class', 'HAS +H(0x2a9ef98)') called at /home/neil/perl5/lib/perl5/x86_64-linux-thre +ad-multi/Moose/Exporter.pm line 382
My desire is to ensure that the parameter 'class' is limited to /a-zA-Z0-9/. What have I done wrong?

Neil Watson
watson-wilson.ca