[CDBI] Problem using has_many relations under Mason

Victor Danilchenko danilche at cs.umass.edu
Thu Nov 3 04:17:50 GMT 2005


	Hi,

	I am using Class::DBI under Mason/mod_perl2, with MySQL and 
Apache::DBI. I am defining a has_many relationship, but it doesn't work 
under Mason, though the very same code works fine in a regular perl 
script running from a shell.

	My definitions, in separate files:

Ask::History->has_a( user => 'Ask::User' );

Ask::User->has_many(history => 'Ask::History');

	The has_a call defines the corresponding method correctly, but the 
has_many doesn't -- under Mason. I also tried explicitly specifying the 
foreign key, but it didn't help. I get the following exception message 
when trying to call $user_obj->history under Mason:

Can't locate object method "history" via package "Ask::User"

	The very same code works correctly when I call it from a command-line 
Perl script.

	Does anyone have any idea what could be wrong?




More information about the ClassDBI mailing list