[Dbix-class] dynamic class requires

Lawrence Hochberg lmh at intex.com
Thu Dec 27 22:39:08 GMT 2007


We currently loaded hundreds of classes in our load_classes 
statement.  These classes in turn have many dependencies.  The end 
result is that the load_classes statement takes over a second to 
execute.  This would not be a problem for a long running perl 
program, but we use the schema functionality to handle short lived 
requests on a webserver.  Most of these requests only need to access 
a handful of tables, so it seems wasteful (read slow) to load all of 
the classes for every table in our database when only a couple are 
needed.  One possibility is to break up our tables into logical 
groups, but because of cross dependencies, this is not optimal from a 
maintenance point of view.  I am currently trying to hack in AUTOLOAD 
functionality, but if such a feature already exists, or there is a 
better approach, I'd appreciate the feedback.

thank you for your help!

Regards,
lmh


At 05:22 PM 12/27/2007, Ash Berlin wrote:

>On 27 Dec 2007, at 20:37, Lawrence Hochberg wrote:
>
>>Hi
>>
>>Is there a way to dynamically require a class at the first
>>instantiation of an instance as opposed to loading all classes
>>upfront via load_classes?
>>
>>I am looking for similar functionality to the Class::Factory module
>>methods add_factory_type and register_factory_type.
>>
>>Regards,
>>lmh
>
>First things first: Why?
>
>_______________________________________________
>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/dbix-class@lists.rawmode.org
>






More information about the DBIx-Class mailing list