Hi,

our apache web server must run on a HP-UX system, so we are not able
to switch to perl 5.6 (core dump by any %SIG access in mod_perl context).

So we use perl 5.00503 and mod_perl-1.25. Now we wont update to mod_perl-1.26
but where are some real problems:

1.  test 4 (file upload) fails in modules/cgi.t because CGI.pm uses
    read("main::STDIN", ...) and main::STDIN is not defined in
    mod_perl 1.26 context

2.  test 2 of internal/auth.t and the internal/dirmagic.t test
    fails because the

        use Apache::Constants ':common'
    and
        use Apache::Constants qw(DECLINED DIR_MAGIC_TYPE);

    does not import the Apache constants in package name space of
    My::DirIndex and Apache::AuthenTest. One solution is the attached
    patch an other to use Apache::Constants::OK and so on in the handler
    subroutines.

3.  CGI.pm can not proper detect that it is running in mod_perl context.
    It uses the following code (it is the newest version and the warn()
    calls are added by me):

        # Turn on special checking for Doug MacEachern's modperl
        warn "GATEWAY_INTERFACE: $ENV{'GATEWAY_INTERFACE'}\n";
        if (exists $ENV{'GATEWAY_INTERFACE'}
            &&
            ($MOD_PERL = $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl\//))
        {
            $| = 1;
            require Apache;
        warn "MOD_PERL: $MOD_PERL\n";
        }

    and 'make test' shows the following:

        cp t/conf/mod_perl_srm.conf t/conf/srm.conf
        /var/tmp/apache_1.3.22/src/httpd -f `pwd`/t/conf/httpd.conf -X -d `pwd`/t &
        httpd listening on port 8529
        will write error_log to: t/logs/error_log
        letting apache warm up...GATEWAY_INTERFACE: CGI-Perl/1.1
        MOD_PERL: 1
        done
        /opt/perl5/005003/hppa1.1-hp-hpux10.20/bin/perl t/TEST 0
        modules/actions.....ok
        modules/cgi.........Use of uninitialized value at ../blib/lib/CGI.pm line 153.
        GATEWAY_INTERFACE:
        FAILED test 4
                Failed 1/5 tests, 80.00% okay
        modules/constants...ok
        modules/cookie......ok
        modules/file........ok
        modules/httpdconf...ok
        modules/include.....ok
        modules/log.........ok
        modules/module......skipping test on this platform
        modules/perlrun.....ok
        modules/psections...ok
        modules/request.....Use of uninitialized value
                                at ../blib/lib/CGI.pm line 153.
        GATEWAY_INTERFACE:
        ok
        modules/src.........ok
        modules/ssi.........skipping test on this platform
        modules/stage.......skipping test on this platform
        modules/status......ok
        modules/symbol......ok
        modules/uri.........ok
        modules/util........ok
        internal/api........ok
        internal/auth.......ok
        internal/croak......ok
        internal/dirmagic...ok
        internal/error......ok
        internal/headers....Use of uninitialized value
                                at ../blib/lib/CGI.pm line 153.
        GATEWAY_INTERFACE:
        ok
        internal/hooks......ok
        internal/http-get...ok
        internal/http-post..ok
        internal/proxy......ok
        internal/redirect...Use of uninitialized value
                                at ../blib/lib/CGI.pm line 153.
        GATEWAY_INTERFACE:
        ok
        internal/rwrite.....ok
        internal/stacked....ok
        internal/table......ok
        internal/taint......ok
        Failed Test  Status Wstat Total Fail  Failed  List of failed
        ------------------------------------------------------------------
        modules/cgi.t                 5    1  20.00%  4
        3 tests skipped.
        httpd terminated
        httpd terminated
        gmake: *** [run_tests] Error 9

    that means that during compile time of the test CGI scripts
    GATEWAY_INTERFACE is not set. During runtime the environment
    variable is set. I have also added an

        warn "$ENV{'GATEWAY_INTERFACE'}, $MOD_PERL\n";

    to MultipartBuffer->new, because I wont change the CGI.pm code

        $IN = "main::STDIN" unless $IN;
    to
        $IN = $MOD_PERL ? \*STDIN : "main::STDIN"
            unless $IN;

    and the output in t/logs/error_log is:

        CGI-Perl/1.1,

4.  the main name space is empty, so  Apache::Status does not proper
    work for 'ISA Tree', 'Inheritance Tree' and 'Symbol Table Dump'.
    the trees are always empty, because Devel::Symdump->inh_tree and
    Devel::Symdump->isa_tree uses

            grep /\bISA$/, Devel::Symdump->rnew->arrays;

    and Devel::Symdump->rnew without any argument uses the 'main'
    name space which is empty. This shows the output of 'Symbol
    Table Dump', in mod_perl-1.25 it shows:

        Embedded Perl version 5.00503 for Apache/1.3.22
        (Unix) mod_perl/1.25 process 13395, 
        running since Wed Oct 31 12:17:04 2001

         packages
                  Access, Apache, ApacheReadConfig, AutoLoader,
                  B, BaseClass, Benchmark, CGI, CGITempFile, CORE,
                  Carp, Config, DB, Data, Date, Destruction,
                  Devel, DirHandle, DynaLoader, Exporter, ExtUtils,
                  Fcntl, Fh, File, FileHandle, HTML, HTTP, IO,
                  LWP, LoadClass, MIME, MacPerl, MultipartBuffer,
                  My, MyClass, Outside, PerlTransHandler,
                  SelectSaver, Stacked, Symbol, Term, Test, Time,
                  UNIVERSAL, URI, VMS, constant, lib, mod_perl,
                  mod_perl_hooks, net, overload, re, strict, vars
         arrays
                  main::ARGV, main::INC, main::_
         functions
                  main::access, main::dummy_sub, main::pid
         hashes
                  main::@, main::ENV, main::INC, main::SIG
         ios
                  main::ARGV, main::STDERR, main::STDIN,
                  main::STDOUT, main::_, main::_GEN_27,
                  main::_GEN_28, main::_GEN_29, 
                  main::stderr, main::stdin, main::stdout
         scalars
                  main::!, main::", main::$, main::%, main::-,
                  main::/, main::0, main:::, main::<, main::=,
                  main::@, main::], main::^,
                  main::_, main::|, main::~
         unknowns


    but mod_perl-1.26 shows:

        Embedded Perl version 5.00503 for Perl/5.00503 Apache/1.3.22
        (Unix) mod_perl/1.26 process 13349, 
        running since Wed Oct 31 12:12:49 2001

         packages
         arrays
         functions
                  main::access, main::dummy_sub, main::pid
         hashes
         ios
                  main::_GEN_27, main::_GEN_28, main::_GEN_29
         scalars
         unknowns

    both are started with 'make start_httpd' and except the 'Apache/1.3.22'
    in the header it is the same with Apache/1.3.19.

I hope this is enough input and that the problems can be fixed.
Currently we do not upgrade because we have old scripts which uses
the main name space and if CGI.pm does not determine that it is running
as Apache::Registry::handler then it does not the right things and
we use always CGI.pm. Off course CGI.pm should be also changed to
use $ENV{MOD_PERL} instead $ENV{GATEWAY_INTERFACE} =~ .. and *STDIN{IO}
instead "main::STDIN".

Kind regards and TIA, Silvio

--
All opinions are mine.

---------------------------------------------------------------------------

--- t/docs/startup.pl~  Fri Jul  6 22:20:27 2001
+++ t/docs/startup.pl   Tue Oct 30 17:51:40 2001
@@ -167,8 +167,12 @@
     HTTP::Status->undef_functions;
 }
 
-sub Apache::AuthenTest::handler {
+{
+    package Apache::AuthenTest;
+
     use Apache::Constants ':common';
+
+    sub handler {
     my $r = shift;
 
     $r->custom_response(AUTH_REQUIRED, "/error.txt");
@@ -186,10 +190,14 @@
 
     return OK;                       
 }
+}
+
+{
+    package My::DirIndex;
 
 use Apache::Constants qw(DECLINED DIR_MAGIC_TYPE);
 
-sub My::DirIndex::handler {
+    sub handler {
     my $r = shift;
     return DECLINED unless $r->content_type and 
        $r->content_type eq DIR_MAGIC_TYPE;
@@ -205,6 +213,7 @@
        ++$i;
     }
     1;
+    }
 }
 
 sub My::ProxyTest::handler {

Reply via email to