sub base :Chained('/') :PathPart('author') :CaptureArgs(0) { my ($self, $c) = @_; my $someclass = $c->model('DB_APPLICATION'); my $schema = $someclass->connect( 'dbi:mysql:'.$c->session->{username}, $c->session->{username}, $c->session->{password}, { AutoCommit => 1 }, ); $c->stash(schema => $schema); } sub object :Chained('base') :PathPart('id') :CaptureArgs(1) { my ($self, $c, $id) = @_; # Find the period record and store it in the stash $c->stash(rs => $c->stash->{schema}->resultset('Author')->find($id)); }