Re: [CDBI] How to Query Relationships programatically?

Bill Moseley <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
On Sun, Mar 11, 2007 at 06:33:43AM +0000, Praveen Hombaiah wrote:
> Hi,
>   Is there a way to programatically find out the relationships a class
> has?  i.e. are there methods which can tell what other classes a given class
> has relationships with and the nature of the relationship( has_a, has_many
> etc )

It's stored in the class' meta_info hash.

Try dumping it:

    print Dumper My::CDBI::Class->meta_info;

or for just the has_many relationships, for example:

    print Dumper My::CDBI::Class->meta_info( 'has_many' );


-- 
Bill Moseley
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.