[CDBI] CDBI Newbie Question

Todd W trwww at sbcglobal.net
Wed Sep 28 03:21:58 BST 2005


> > Because I'm starting a Big Project, I'm trying to keep my modules tidy,
> > and have defined a hierarchy, with all my modules below ANPerl/; for
> > example, one of my DB table classes is
> >
ANPerl::AnalysisFramework::ResourceStore::Metadata::DBDiscoverySetResources
> >
> > Unfortunately now in my client code I have lines like
> >  $current_dsr_row =
> >
ANPerl::AnalysisFramework::ResourceStore::Metadata::DBDiscoverySetResources-
>create(
> >
> >       {RetrievalUrl => $retrieval_url} );
> >
> Maybe I'm misunderstanding, but have you looked at
>
> use lib qw/.../
>
> or export a PERL5LIB environmental var?
>
> Just because you stick a .pm somewhere down in a directory structure
> doesn't mean you have to have the package name refer to each directory
> above, especially if those parent dirs have nothing to do with perl
>

Thats what I was thinking when I read the post. You have your file:

ANPerl/AnalysisFramework/ResourceStore/Metadata/DBDiscoverySetResources.pm

and in that file declare the package like so:

package DBDiscoverySetResources;

> > Then [YOU] could just write
> >   $current_dsr_row = DBDiscoverySetResources->create( {RetrievalUrl =>
> > $retrieval_url} );

Whatever loaded the module before will load it the exact same way and you'll
have your CDBI stuff in a programmer friendly namespace.

Todd W.





More information about the ClassDBI mailing list