On 12/4/05 7:36 PM, John Siracusa wrote:
> sub save
> {
>   my $self = shift;
> 
>   my $db = $self->db;
> 
>   if($db->type ne 'master')
>   {
>     $self->db(My::DB->new('master'));
>   }
> 
>   # XXX: also propagate the new $db to all the sub-objects here
> 
>   $self->SUPER::save(@_);
> }

Oh, and if you want this to be more efficient/stingy with db connections,
you could try to keep both a master and a slave connection around in a class
attribute or other "globally accessible" location (rather than calling
My::DB->new('master') to get your master db).

-John




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to