[Dbix-class] getting a connection in a static method with no args ...

Matt S Trout dbix-class at trout.me.uk
Sun Aug 13 15:23:44 CEST 2006


Daniel McBrearty wrote:
> i'm actually using "MySchema->connection($dsn)"
> 
> then MySchema->resultset( ... )
> 
> but i seem to remember someone telling someone they oughtn't ....

Weeeel ... I'm not amazingly fond of that usage but it works by design, not by 
accident and it isn't going away. It may cause you all sorts of fun if you 
ever need multiple connections at once.

Why not just make it a method on the schema so you call

$schema->methodname

and then that can access the schema as $self ?



More information about the Dbix-class mailing list