Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

mod_perl @INC/use base trouble

by Jaap (Curate)
on Aug 13, 2004 at 09:34 UTC ( [id://382589]=perlquestion: print w/replies, xml ) Need Help??

Jaap has asked for the wisdom of the Perl Monks concerning the following question:

Greetings wise Monks,

Today my sysadmin managed to get mod_perl working for my Perl scripts. This introduced the following error:
[Fri Aug 13 11:27:11 2004] [error] 815: ModPerl::Registry: Can't locat +e object method "table" via package "Doc::User" (perhaps you forgot t +o load "Doc::User"?) at /home/hive/25167/cgi-bin/Doc/User.pm line 4.\ +nCompilation failed in require at /home/hive/25167/cgi-bin/doc.pl lin +e 21.\nBEGIN failed--compilation aborted at /home/hive/25167/cgi-bin/ +doc.pl line 21.\n
My Doc/NodeVersion.pm looks like this:
package Doc::NodeVersion; use base 'Doc::DBI'; __PACKAGE__->table('nodeversions'); __PACKAGE__->columns(Primary => qw/vid/); __PACKAGE__->columns(Essential => qw/nid date author source mimetype e +xtension/); __PACKAGE__->columns(Others => qw/content/); ### Make sure the content + is not retrieved unneccessary __PACKAGE__->has_a(author => 'Doc::User'); __PACKAGE__->has_a(nid => 'Doc::Node'); __PACKAGE__->autoupdate(1); ... 1;
I have no clue what to do now. The script runs fine from the command line, but not from mod_perl. Any ideas?

Replies are listed 'Best First'.
Re: mod_perl @INC/use base trouble
by Gilimanjaro (Hermit) on Aug 13, 2004 at 10:55 UTC
    Ehm... Why are you posting Doc/NodeVersion.pm if the error is is Doc/User.pm?

    The error sais Doc::User doesn't define a ->table method... Does it?
      Hmmm... you sure are awake.
      The User.pm is similar to NodeVersion.pm:
      package Doc::User; use base 'Doc::DBI'; __PACKAGE__->table('users'); __PACKAGE__->columns(All => qw/uid email employee/); __PACKAGE__->has_many(accessrights => 'Doc::AccessRight'); __PACKAGE__->autoupdate(1); 1;
        Try adding an explicit
        use Doc::DBI;
        before your 'use base'. If I remember correctly some perl/base versions just modified @ISA with 'use base', while newer ones actually use'd it when it wasn't loaded yet.

        Your mod_perl was probably compiled with an older perl version than the command line version you're running. If so, you'll want to fix that or the version difference will pop up on a regular basis to bite your rearend...
Re: mod_perl @INC/use base trouble
by perrin (Chancellor) on Aug 13, 2004 at 16:51 UTC
    This probably means that Doc::DBI either doesn't have a "use base Class::DBI" in it, or some modules are not loading. Modules can fail to load either because you are setting @INC to something different on your command-line (try printing @INC out under mod_perl can comparing it to your command-line) or because the user that your web server runs as (usually "nobody") doesn't have permission to read the files.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://382589]
Approved by gellyfish
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-29 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found