http://www.perlmonks.org?node_id=254173

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

Hello fellow Monks and Monkesses. I am attempting to use a child module of XML::Sablotron with mod_perl. When using it in mod_perl mode, I seem to be breaking DynaLoader, and get the error: Can't locate auto/XML/Sablotron/new.al in @INC (@INC contains: (etc...)) Due to the following code:
package My::Groovy::Module; use strict; use XML::Sablotron; use vars qw(@ISA, $VERSION); @ISA = qw(XML::Sablotron); ... sub new { my $proto = shift; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(); ... }
The error occurs on the line where I call the super-class constructor. Oddly, this code works perfectly when running via normal Perl, but dies with that error when running via mod_perl. I have checked mod_perl's @INC and confirmed that the right directories are there, and have Dumper()ed %INC and seen that XML::Sablotron is indeed loaded. I have tried loading XML::Sablotron in my Apache startup file before my child module gets loaded, I have tried hardcoding the class name in my constructor, and a lot of other things I can't remember, all with the same result. The environment is perl 5.005_03 and mod_perl 1.25, running on FreeBSD. Any help would be greatly, greatly appreciated. Thanks. :)

Replies are listed 'Best First'.
Re: DynaLoader errors with mod_perl
by perrin (Chancellor) on Apr 30, 2003 at 05:17 UTC
    Check the permissions.
      All of the module files involved are readable by everyone. Do you have any other ideas?
        Compare your @INC when running under mod_perl to when you run from command-line. There's probably something different there.
Re: DynaLoader errors with mod_perl
by gmpassos (Priest) on May 01, 2003 at 03:47 UTC
    Well, what handler are you using to load your code inside mod_perl?!

    Have you tested the code in the same machine and Perl without mod_perl? (Probably yes, just to check). Flush the variable $^X when running with/without mod_perl to compare too.

    But probably the problem is when XML::Sablotron try to load the XS, and look for the load of new() at new.al! See if the ./auto dir exist in the same path of @INC, for example, @INC has the dir /usr/local/lib/perl5/lib, auto need to exist just after it: /usr/local/lib/perl5/lib/auto.

    Graciliano M. P.
    "The creativity is the expression of the liberty".