The business req On Feb 8, 2008 7:59 AM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> On Thu, Feb 07, 2008 at 04:39:05PM +0000, Frazer Irving wrote: > > Hi everybody, > > > > I'm a first time poster to this list. I hope I have the right place to > ask > > this question. > > > > I am currently in the process of setting up DBIx::Class as the ORM for > my > > employer. I have setup the basic structure as so... > > > > package My::DB; > > use base qw/DBIx::Class::Schema/; > > __Package__->load_classes(); > > > > package My::AbstractClass; > > use base qw(DBIx::Class); > > > > package My::DB::Foo; > > use base qw(My::AbstractClass); > > ... > > __PACKAGE__->belongs_to(bar => 'My::DB::Bar'); > > __PACKAGE__->has_many(baz => 'My::DB::Baz'); > > > > That all works great, but the load_classes method is called for every > class > > whenever I 'use My::DB'. I would like the classes to only load when I am > > going to use them. I have experimented with moving the load_classes > > definitions into My::DB::Foo etc, and only specifying the current > > __PACKAGE__ and it's relationships but this results in all relationships > for > > My::DB::Foo being loaded when that class is loaded even if they are not > > going to be used. > > > > Is there some way I can load the relation classes only when a call is > made > > to the accessor for that relation? I have looked for an answer in the > docs > > and in the googles but to no avail. > > Not really. The loading time is fairly low if you either (a) have > Class::C3::XS installed or (b) are on 5.10 (C3 built in) > > What business requirement is leading you to want on-demand loading? > > -- > 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/ > > _______________________________________________ > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class > IRC: irc.perl.org#dbix-class > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ > Searchable Archive: > http://www.grokbase.com/group/[EMAIL PROTECTED] >
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
