ariel2 has asked for the wisdom of the Perl Monks concerning the following question:
...So I finally decided to read up on Class::DBI to see what all the chatter is about. On the whole, I liked it and find it to be a time-saver for a variety of situations. Unfortunately, after compiling my new (and too hefty to show here) application with perlapp, I get the following error when running my program:
Can't locate object method "__hasa_rels" via package "BEAMS::Admin::Cl +ientLink" at /PerlApp/Class/DBI.pm line 1200. BEGIN failed--compilation aborted at admin.pl line 14.
(where BEAMS::Admin::ClientLink is my subclass of CDBI.
line 14 of admin.pl is: use BEAMS::Admin::Client;)
The ClientLink package is pretty straightforward:
package BEAMS::Admin::ClientLink; use strict; use base 'BEAMS::Admin::DB'; BEAMS::Admin::ClientLink->table('client_links'); BEAMS::Admin::ClientLink->columns(All => qw/client_link_id client_id link_id sort_order/); BEAMS::Admin::ClientLink->has_a(client_id => 'BEAMS::Admin::Client'); BEAMS::Admin::ClientLink->has_a(link_id => 'BEAMS::Admin::Link');
This doesn't seem to be a problem with modules being bundled into the exe because the error takes place in Class::DBI. The weird thing is that everything works perfectly when I run the original script from the command line. Just in case, I tried manually adding CDBI and its relatives to the exe to no avail.
The problem seems to lie in the code that handles the has_a business, since I have sucessfully compiled another CDBI application in which the objects don't has_a anything.
Has anyone had encountered this before? Is there something about the compiled environment that could cause this sort of a problem?
Any advice would be graciously welcomed.
Update
I have resolved this problem, though I couldn't tell you what is the cause. It has something to do with the dynamic method generation that happens in CDBI. In my case, BEAMS::Admin::ClientLink was being found by the app, but the auto generated methods weren't being found. Putting an explicit use statement in for that module fixed the problem. (as opposed to just making sure that it was in the bundle so that it could be found at runtime.) - Ariel
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perlapp and Class::DBI woes
by FitTrend (Pilgrim) on Feb 10, 2005 at 22:08 UTC |