March 2010 Archives

DBIx::Class cache quiz

Assume 'Artist' is a table with 10 rows

# http://search.cpan.org/perldoc?DBIx::Class::ResultSet#cache
my $rs = $schema->resultset('Artist')->search(
{},
{ cache => 1 },
);
my @artists = $rs->all;
pop (@artists);
$rs->set_cache(\@artists);

my $count1 = $rs->count;
my $count2 = scalar $rs->all;
my $count3 = scalar $rs->get_column('id')->all;

Q1: What are the values of $count1, $count2 …

About minty

user-pic I blog about Perl.