use Regexp::Common 'zip';
my $STATES = Locale::US->new;
- subtype USState
+ subtype 'USState'
=> as Str
=> where {
( exists $STATES->{code2state}{ uc($_) }
|| exists $STATES->{state2code}{ uc($_) } );
};
- subtype USZipCode
+ subtype 'USZipCode'
=> as Value
=> where {
/^$RE{zip}{US}{-extended => 'allow'}$/;
module, and perfect for use in a C<subtype> constraint.
my $STATES = Locale::US->new;
- subtype USState
+ subtype 'USState'
=> as Str
=> where {
( exists $STATES->{code2state}{ uc($_) }
The next C<subtype> does pretty much the same thing using the L<Regexp::Common>
module, and is used as the constraint for the C<zip_code> slot.
- subtype USZipCode
+ subtype 'USZipCode'
=> as Value
=> where {
/^$RE{zip}{US}{-extended => 'allow'}$/;