[Catalyst] Form handling, urls and web design
Brandon Black
blblack at gmail.com
Mon Jan 23 23:26:25 CET 2006
On 1/23/06, Alex Kavanagh <alex at tinwood.homelinux.org> wrote:
> Hi
>
> Yes, another post, but I'm beginning to get into this and questions
> just keep popping up.
>
> Currently, I'm wondering what the best way of handling forms is in the
> context of urls and what to do with error messages.
>
> I have a system going, but I'm curious as to what others have done in
> solving this particular design problem.
>
You could also consider changing your url layout to be more like:
URLs:
/myapp/users/list
/myapp/users/add
/myapp/users/add_confirm
/myapp/users/view[/username]
myapp::users.pm:
sub default ( redirects to users/list )
sub list/add/add_confirm ( do the obvious )
sub view : Local {
my ($self, $c) = @_;
my $username = $c->req->args->[0];
$c->res->redirect('list') if !$username;
......
}
Now the usernames and the other actions are not stepping in the same
URI path-space, the username is a simple $c->req->args thing, and no
regexes or magic selectors involved. Basically, the extra path
information on the end of view is PATH_INFO, which becomes the
$c->req->args arrayref.
-- Brandon
More information about the Catalyst
mailing list