[Dbix-class] DBIx::Class::Relationship issue

abhijith abhijithg at deeproot.co.in
Wed Mar 21 04:37:02 GMT 2007


On Tue, 2007-03-20 at 14:30 +0100, Michele Beltrame wrote:

> while( my $artist = $rs->next) {
>      my $cds = $artist->cds;
>      while ( my $cd = $cds->next ) {
>          print $cd->title . "\n\n";
>      }
> }
Hi again Michele ... 

I would like to improve upon your solution before we close the
discussion on the issue... Please feel free to correct me if I am wrong.

I dont think there is a necessity for the first 'while' loop because we
are just  querying on a single artist ... 
this piece of code below seems to work fine. 

    my $cds = $rs->first->cds;
    while ( my $cd = $cds->next ) 
    {
	print $cd->title . "\n";
    }






More information about the Dbix-class mailing list