[Dbix-class] Useless uses of search
jon at jrock.us
Tue Mar 25 02:26:16 GMT 2008
In the last few days, I've noticed people posting code examples like:
my $count = $schema->resultset('Foo')->search->count;
my @all = $schema->resultset('Foo')->search(
I don't think there's any reason to do this. $schema->resultset('Foo')
returns the same resultset that the empty search does, so you could have
just called "count" or "all" without having done the search.
Finally, for those using Catalyst, keep in mind that
$c->model('DBIC::Foo') is basically the same as
$c->model('DBIC')->resultset('Foo'), so there's no need to add an extra
search in this case either.
print just => another => perl => hacker => if $,=$"
More information about the DBIx-Class