Re: [CDBI] Problem using has_many relations under Mason

[prev] [thread] [next] [Date index for 2005/11/03]

From: Victor Danilchenko
Subject: Re: [CDBI] Problem using has_many relations under Mason
Date: 14:02 on 03 Nov 2005
On Thu, 3 Nov 2005, David Baird wrote:

> On 11/3/05, Victor Danilchenko <danilche@xx.xxxxx.xxx> wrote:
>>         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?
>
> Is the code setting up the relationships being called in the parent
> process, before Apache forks?

 	After. It's loaded via 'use' from regular run-time Mason 
components, after the Apache stuff is all forked and set up.

 	Also, another has_many relationship in that same module, does 
work under Mason. It was written before i took over the code, but I 
ensured that exactly the same configuration is set up for both 
relationships in each requisite Class::DBI subclass -- that is, there's 
a corresponding has_a and has_many for each relationship.

        -- 
        |  Victor  Danilchenko  +---------------------+
| danilche@xx.xxxxx.xxx | He who laughs last, |
|   CSCF   |   5-4231   | thinks slowest.     |

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] Problem using has_many relations under Mason
Victor Danilchenko 04:17 on 03 Nov 2005

Re: [CDBI] Problem using has_many relations under Mason
Victor Danilchenko 14:02 on 03 Nov 2005

Re: [CDBI] Problem using has_many relations under Mason
Victor Danilchenko 16:16 on 03 Nov 2005

Generated at 20:55 on 09 Nov 2005 by mariachi v0.52