Posted on 2005-11-03 04:04:39-08 by danilche
Weird has_many problem
Hi,

I am using Class::DBI under Mason/mod_perl2, with MySQL. 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 get the following exception message:

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?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.