[Dbix-class] Share data between DBIx::Class::Core and MyLib

Arthur Rance arthur_rance at hotmail.com
Fri Jan 18 11:03:59 GMT 2013


Hello,

What's the right way to design this library ?

my $lib = new MyLib;
$lib->init_cd_burner;
my $schema = $lib->get_schema;
my $rs = $schema->resultset('CD')->search( $search_params );
while( my $cd = $rs->next )
{
  $cd->set_cd_burner( $lib->get_cd_burner );
  $cd->burn_this_cd;
}

or else :

my $lib = new MyLib;
$lib->init_cd_burner;
my $cds = $lib->search_cds( $search_params );
while( my $cd = $cds->next )
{
  $cd->burn_this_cd;
}

or else :

my $lib = new MyLib;
$lib->init_cd_burner;
my $schema = $lib->get_schema;
my $rs = $schema->resultset('CD')->search( $search_params );
while( my $cd = $rs->next )
{
  $lib->burn_this_cd( $cd );
}

anything else ? 		 	   		  


More information about the DBIx-Class mailing list