logo       

load_classes question: msg#00158

Subject: load_classes question
Hi, 

I have different applications that share a set of common features and thus 
tables and DBIC-classes. 
I want to have my common classes and my application specific classes 
in different namespaces so that Application A can use all common and her own, 
and App. B all common and his own. Relations exist in both directions between 
common and A or common and B.

Now I don't know how to set this up properly.

So currently I have:

MySchema::DB::  *   all common classes 
Site::SiteA::DB:: *  classes from SiteA
Site::SiteB::DB:: *  classes from SiteB
...

Along with this I have different schema classes:

Site::SiteA::DB.pm 
Site::SiteB::DB.pm 

Example:
Common class:
MySchema::DB::Users
..
# no belongs_to  defined
;
----------------------------------------
in Site::SiteA::DB::Company.pm:

package Site::SiteA::DB::Company;
...
has_many(users => 'MySchema::DB::Users' );
-----------------------------------------
and my schema class in   Site::SiteA::DB.pm
package Site::SiteA::DB;
...
__PACKAGE__->load_classes ( qw(Company), {MySchema::DB => [qw(Users)]});
---------------------------------------------
Now caling 
my $c = $schema->resultset('Company')->find(1);
my @users = $c->users;

works, but when I add in Users.pm
belongs_to (company , 'MySchema::DB::Company'); 

I get an error : "Can't locate MySchema/DB/Company.pm"
So far I can understand this.

Now I tried it this way:
in Site::SiteA::DB.pm
package MySchema::DB
...
__PACKAGE__->load_classes ( qw(Users), {Site::SiteA::DB => [qw(Comapny)]});
------------------------------------
again it works as far as there is no belongs_to in Users.pm, but as soon as I 
define this I get the same error again.

So how can I get this to work ? 

I tried to understand load_namesaces, but I don't understand the difference 
between  "result class" and result_set class".

-- 
Regards
Rolf Schaufelberger



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe