[Dbix-class] resultset from perl list of rows/results?

Bob MacCallum uncoolbob at gmail.com
Tue Jun 11 16:48:50 GMT 2013


I've only briefly Googled this...

Is there a simple way to do get a resultset from a perl list of result

my $cd1 =3D $cds->find(1);
my $cd2 =3D $cds->find(44);
my $cd3 =3D $cds->find(101);

my $cds_rs =3D something_here($cd1, $cd2, $cd3); # ?

my $tracks =3D $cds_rs->tracks;
while (my $track =3D $tracks->next) {

I know it can be done with

$tracks =3D $cds->search({ 'id' =3D> { -in =3D> [1,44,101] } })->tracks

but I have some custom code for the "find" which I'd rather not have to
write again as a search.

Actually I think I have a usable answer already.  Because my $cd1 .. $cd3
will be hard-coded in my script, I can do this

my $tracks1 =3D $cd1->tracks;
my $tracks2 =3D $cd2->tracks;
my $tracks3 =3D $cd3->tracks;

while (my $track =3D ($tracks1->next || $tracks2->next || $tracks3->next)) {

That's good enough for me, but maybe it's worth posting my question

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130611/c3e=

More information about the DBIx-Class mailing list