[Catalyst-dev] Re: Bug in Catalyst::Model::DBI .15

A. Pagaltzis pagaltzis at gmx.de
Sun May 6 10:29:48 GMT 2007


* Evan Carroll <lists at evancarroll.com> [2007-05-06 10:55]:
> With that said, the patch provided has no drawbacks, and even
> if you only use the most minimal functionality of M::DBI, with
> the current code, you don't have a connection until the first
> ->dbh is called, which is no bueno. (work that is better
> handled at compile-time)

That is precisely the patch’s drawback. Connecting lazily rather
than eagerly is a feature.

However, that’s not hard to correct, although the patch would be
larger: rather than squirreling away a connection in `new`,
squirrel away a reference to an undef scalar. Then you can assign
the handle to that scalar, and it will be shared among everyone
who kept a copy of the same reference.

-- 
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1}
&Just->another->Perl->hack;
#Aristotle



More information about the Catalyst-dev mailing list