Skip to content

Instantly share code, notes, and snippets.

@leedo
Created December 4, 2009 00:51
Show Gist options
  • Save leedo/248744 to your computer and use it in GitHub Desktop.
Save leedo/248744 to your computer and use it in GitHub Desktop.
package Joe::Registration::Form;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
has '+item_class' => ( default => 'Registration' );
has_field username => (
type => 'Username',
label => 'Username',
required => 1,
);
has_field email => (
type => 'Email',
label => 'Email Address',
required => 1,
);
has_field password => (
type => 'Password',
label => 'Password',
required => 1,
);
subtype 'Username'
=> as 'Str'
=> where {$_ =~ /[\d\w]{1,16}/}
=> message { "Can only contain letters and numbers" };
no HTML::FormHandler::Moose;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment