22.2 Code Parsing and Compilation

The following warnings and errors might be reported when the Perl code is compiled. This may be during the server startup phase or, if the code hasn't yet been compiled, at request time.

22.2.1 Value of $x will not stay shared at - line 5

This warning usually happens when scripts are run under Apache::Registry and similar handlers, and some function uses a lexically scoped variable that is defined outside of that function.

This warning is important and should be considered an error in most cases. The explanation of the problem and possible solutions are discussed in Chapter 6.

22.2.2 Value of $x may be unavailable at - line 5

Similar to the previous section, the warning may happen under Apache::Registry and similar handlers, and should be considered an error. The cause is discussed in the perldiag manpage and possible solutions in Chapter 6.

22.2.3 Can't locate loadable object for module ...

Here's an example of the full error report that you might see:

Can't locate loadable object for module Apache::Util in @INC...

In this particular example, it means that there is no object built for Apache::Util. You should build mod_perl with one of these arguments: PERL_UTIL_API=1, EVERYTHING=1, or DYNAMIC=1.

For similar errors, see Chapter 3. Locate the missing module and see what build-time argument enables it.

22.2.4 Can't locate object method "get_handlers" ...

If you see this error:

Can't locate object method "get_handlers" via package "Apache"

you need to rebuild your mod_perl with stacked handlers; that is, with PERL_STACKED_HANDLERS=1 or with EVERYTHING=1.

22.2.5 Missing right bracket at line ...

This error usually means you really do have a syntax error. However, you might also see it because a script running under Apache::Registry is using either the _ _DATA_ _ or _ _END_ _ tokens. In Chapter 6, we explain why this problem arises when a script is run under Apache::Registry.

22.2.6 Can't load `.../auto/DBI/DBI.so' for module DBI

If you have the DBI module installed, this error is usually caused by binary incompatibilities. Check that all your modules were compiled with the same Perl version that mod_perl was built with. For example, Perl 5.005 and 5.004 are not binary compatible by default.

Other known causes of this problem are:

  • OS distributions that ship with a broken binary Perl installation.

  • The perl program and libperl.a library are somehow built with different binary compatibility flags.

The solution to these problems is to rebuild Perl and any extension modules from a fresh source tree. Read Perl's INSTALL document for more details.

On the Solaris OS, if you see the "Can't load DBI" or a similar error for the IO module (or whatever dynamic module mod_perl tries to pull in first), you need to reconfigure, rebuild, and reinstall Perl and any dynamic modules. When Configure asks for "additional LD flags," add the following flags:

-Xlinker --export-dynamic


-Xlinker -E

This problem is known to be caused only by installing GNU ld under Solaris.

    Part I: mod_perl Administration
    Part II: mod_perl Performance
    Part VI: Appendixes