Created
April 23, 2010 19:23
-
-
Save preaction/377031 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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