[Catalyst] MVC design choices

Bill Moseley moseley at hank.org
Wed Jan 11 22:02:15 CET 2006

On Wed, Jan 11, 2006 at 08:25:56PM +0000, Pedro Melo wrote:
> Going a step further: data validation. Model or controller.
> In the model, you can reuse it in scripts. But in the controller, you  
> can have high level actions across several models.
> In the end, I made my scripts call "webservices" via the  
> controller... But I'm curious about what other people have done.

I have my controller "use" a form module.  So that same module is
usable outside of Catalyst.

Here's one of my "edit" controllers:

sub edit : Local {
    my ( $self, $c, $id ) = @_;

    # Create a new form object
    # redirect to list action if invalid $id is provided

    $c->stash->{form} = App::Form::Admin::Organization->new( $id ) or
        return $c->internal_redirect(
            { message => 'Invalid Organization Selected' },

    # validate and create or update

    $c->stash->{form}->update_from_form( $c->req->parameters )
        if $c->form_posted;

Bill Moseley
moseley at hank.org

More information about the Catalyst mailing list