[Dbix-class] looking for code suggestion

Matt S Trout dbix-class at trout.me.uk
Mon Jan 28 16:12:30 GMT 2008


On Mon, Jan 28, 2008 at 10:43:42AM +0800, Fayland Lam wrote:
> hmm, basically I'd like to use cache and others in Schema. so I package 
> my own Foorum::Schema like this:
> 
> http://foorum.googlecode.com/svn/trunk/lib/Foorum/Schema.pm
> 
> use Foorum::XUtils ();
> 
> sub base_path {
>    return Foorum::XUtils::base_path();
> }
> sub config {
>    return Foorum::XUtils::config();
> }
> sub cache {
>    return Foorum::XUtils::cache();
> }
> 
> 
> so that in ResultSet or pl.
> 
> we can use $schema->cache() to get the cache object. or 
> $self->schema->cache() in ResultSet pm.
> 
> I'm wondering if it's the correct way to do it?

Given we have no idea what Foorum::XUtils is, "no idea".

Personally I'd be a bit wary of anything that starts making per-schema
things global though ...

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list