On 10/28/2007 05:11 PM, John Siracusa wrote:
> + > + my $db = $class->new(%args); > + $class->db_cache->{$key} = $db; > > Is this how we want to handle new() with args beyond type and domain? Or is > this more appropriate? > > + if (exists $class->db_cache->{$key}) > + { > + my $db = $class->db_cache->{$key}; > + $db->init(%args); > + return $db; > + } > > Or maybe it croaks if additional args are present instead? Opinions? > calling init() on the cached $db is the behaviour I would init[ially] expect. Not sure, though, if it's really a set-up for user disaster. I can easily imagine being tripped by unexpected behaviour in getting cached $db objects if, for example, I set one option in %args in one call to new_or_cached() and then forget it was set the next time I called new_or_cached(). Caveat User. But there's really no sane way to key the cache on anything beyond type+domain since any given $db flag could be set after retrieving it from the cache. "Action at a distance" kind of behaviour which can be both useful and error-prone depending on how it gets [ab]used. In that sense, I can see why croak() would be a safer default behaviour. I vote for croak(). -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object