Creating a nearly empty warnings.pm works, but I had to define the package
namespace and create the unimport method as an empty subroutine like:

######################
package warnings;

sub unimport {}

1;
######################

If this is done, then you need to change the following lines in PerlRun:

######################
BEGIN {
    if ($] < 5.006) {
        $INC{'warnings.pm'} = __FILE__;
        *warnings::unimport = sub {};
    }
}
######################

to the following (after creating warnings.pm, of course):

######################
BEGIN {
    if ($] < 5.006) {
        require warnings;
    }
}
######################

This works (as does my solution of deleting and manually setting
$INC{'warnings.pm'} in a PerlInitHandler).  I'm not sure which is more
elegant, but I lean toward yours since anonymous subroutines in apache
configuration files add to clutter.

Thanks.

Chris

My hack:

>
> PerlModule              Apache::StatINC
>
> #
> # hack to keep $INC{'warnings.pm'} defined. PerlRun includes a
> # workaround for perl<5.6 which defines $INC{'warnings.pm'} and
> # ties the warnings::unimport function to an anonymous sub-routine.
> #
> PerlInitHandler "sub {delete $INC{'warnings.pm'};
> $INC{'warnings.pm'='/usr/local/lib/perl/site_perl/Apache/PerlRun.pm';}"
>
> PerlInitHandler         Apache::StatINC
> PerlSetVar StatINC_UndefOnReload On
> PerlSetVar StatINC_Debug 1
> PerlWarn On
>
> PerlTaintCheck On
>
> It's not the prettiest thing, but it does what's needed.
>

Reply via email to