Skip to content

Instantly share code, notes, and snippets.

@preaction
Created April 23, 2010 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save preaction/377031 to your computer and use it in GitHub Desktop.
Save preaction/377031 to your computer and use it in GitHub Desktop.
package WhatsMyName;
use Moose;
extends 'WebGUI::Wizard';
# Define our steps
has '+steps' => {
default => [qw( askForName respond )],
};
# Show a form in our wizard
sub www_askForName {
my ( $self ) = @_;
return '<input name="name" /><input type="submit"/>'; # outer bits of form are automatically handled
}
# Validate the form and return any errors
sub www_askForNameSave {
my ( $self, $form ) = @_;
if ( $form->{name} eq "doug" ) {
return "WRONG!";
}
}
# All steps prior to this have validated successfully
sub www_respond {
return "That's right! And don't you forget it!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment