Zbigniew Lukasiak wrote:
What is the advantage of this over:
sub view : Local {
my ( $self, $c, $id ) = @_;
$self->start( $c, $id );
# do something with $c->stash->{obj}
return 1;
}
For me there are lots of little reasons. I suppose its a personal choice.
I like the URI structure
On Fri, Oct 16, 2009 at 5:24 PM, iain wrote:
> Bill Moseley wrote:
>>
>> I have a number of methods that start something like this:
>>
>> sub view : Local Args(1) {
>> my ( $self, $c, $id ) = @_;
>>
>> my $obj = $c->model( 'DB::Foo' )->find( $id )
>> || return $c->res->status( 404 );
>
On Fri, Oct 16, 2009 at 7:31 AM, J. Shirley wrote:
> What database do you use? In MySQL and SQLite I get no exception at all:
>
Postgresql.
>
> $ perl -Ilib -e 'use MyApp; my $obj =
> MyApp->model('Schema::User')->find("bogus"); print "defined? " . ( defined
> $obj ? "yes" : "no" ) . "\n"';
Bill Moseley wrote:
I have a number of methods that start something like this:
sub view : Local Args(1) {
my ( $self, $c, $id ) = @_;
my $obj = $c->model( 'DB::Foo' )->find( $id )
|| return $c->res->status( 404 );
If $id is not valid then I might, as in that example, return wit
On Fri, Oct 16, 2009 at 7:19 AM, Matt Whipple wrote:
>
>> I would probably avoid potentially hitting the database unnecessarily,
> and only use the exception in the case of complicated validation. In the
> case of simple validation, why not something simple along the lines of:
>
> sub some_acti
On Fri, Oct 16, 2009 at 6:45 AM, Bill Moseley wrote:
>
> I have a number of methods that start something like this:
>
> sub view : Local Args(1) {
> my ( $self, $c, $id ) = @_;
>
> my $obj = $c->model( 'DB::Foo' )->find( $id )
>|| return $c->res->status( 404 );
>
> If $id is not v
Bill Moseley wrote:
I have a number of methods that start something like this:
sub view : Local Args(1) {
my ( $self, $c, $id ) = @_;
my $obj = $c->model( 'DB::Foo' )->find( $id )
|| return $c->res->status( 404 );
If $id is not valid then I might, as in that example, return wit
I have a number of methods that start something like this:
sub view : Local Args(1) {
my ( $self, $c, $id ) = @_;
my $obj = $c->model( 'DB::Foo' )->find( $id )
|| return $c->res->status( 404 );
If $id is not valid then I might, as in that example, return with a 404
status.
Of cou