Ok. I finally got it to glue together with apache 2.2.22, perl
5.14.2, and mod_perl 2.0.7. The perl can probably be upgraded to newest.


However, mod_perl 2.0.7 will NOT do a static build (as daniel states
below, tho that looks real good otherwise) with large file support
enabled and no perl thread support enabled. It throws constant errors in
various places -> error: unknown type name 'off64_t'. 

So it appears it
has to be built as a dso under those circumstances, and that goes pretty
smoothly with httpd installed first, --with-mpm=prefork and any other
apache options enabled, as a dso it or something else can be unloaded
anyway if memory issues with ssl, for instance, are an issue as the
mod_perl (1) docs state. 

Fred's patch is a lifesaver, so patch first:


Index:
lib/Apache/TestRun.pm
===================================================================
---
lib/Apache/TestRun.pm(revision 1359945)
+++
lib/Apache/TestRun.pm(working copy)
@@ -1097,6 +1097,9 @@

 my %args =
@Apache::TestMM::Argv;
 while (my($k, $v) = each %args) {
+ unless
(defined $v) {
+ die "key $k has no value";
+ }
 $v =~ s/|/\|/g;
 $body
.= "n$Apache::TestConfig::Argv{'$k'} = q|$v|;n";
 } 

and the makefile
cmd I used is: 

[mod_perl-2.0.7 ]# perl Makefile.PL MP_USE_DSO=1
MP_APR_CONFIG=/usr/local/bin/apr-1-config MP_APXS=/srv/httpd/sbin/apxs


configures without error, 'make' without error, 'make test' without
error, and then 'make install'. 

thanks for your help! 

Susan


============================================================= 

On
2012-07-15 09:40, Daniel Boerner wrote: 

> Hi Fred, Hi Todd
> I just
subscribed to this list and still don't know how to link my message to
your thread from July 10th. Sorry.
> I just want to show you my
workaround of the same problem: "Install error with Makefile.PL -
uninitialized value at TestRun.pm"
> 
> Here my proceedings aiming at a
statically mod_perl Apache with Perl 5.14.2 on Debian "squeeze" Linux:
>

> cd ~/src
> tar -xvzf perl-5.14.2.tar.gz
> cd perl-5.14.2
> mkdir
"$HOME/perl"
> ./Configure -des -Dprefix="$HOME/perl" -Dusethreads
>
make
> make test
> make install
> 
> Making some symlinks... (basically
appending a '5' to the name of each executable in the newly installed
$HOME/perl/bin).
> su ./perl_version_links.pl [1] /home/dani
/usr/local/bin
> 
> Some prerequisites:
> cpan5
> install CPAN
> reload
cpan5
> exit
> 
> cpan5
> install YAML
> install LWP
> install CGI
>
install Chatbot::Eliza
> install Compress::Zlib
> install
Devel::CoreStack
> install Devel::Symdump
> install Digest::MD5
>
install IPC::Run3
> exit
> 
> And now, making up a statically mod_perl
Apache server:
> 
> cd ~/src
> tar -xvzf httpd-2.2.22.tar.gz
> tar -xvzf
mod_perl-2.0-current.tar.gz
> 
> mkdir "$HOME/apache2"
> cd
mod_perl-2.0.7/
> perl5 Makefile.PL MP_USE_STATIC=1
MP_AP_PREFIX="$HOME/src/httpd-2.2.22"
MP_AP_CONFIGURE="--prefix=$HOME/apache2 --with-mpm=prefork"
MP_COMPAT_1X=0
> 
> Error:
> ERROR from evaluation of
/home/dani/src/mod_perl-2.0.7/Apache-Reload/Makefile.PL: Use of
uninitialized value $v in concatenation (.) or string at
Apache-Test/lib/Apache/TestRun.pm line 1100
> 
> Locating line 1100 and
adding two print statements just before it:
> 
> my %args =
@Apache::TestMM::Argv;
> while (my($k, $v) = each %args) {
> print "-->
$kn";
> print "---> $vn";
> $v =~ s/|/\|/g;
> $body .=
"n$Apache::TestConfig::Argv{'$k'} = q|$v|;n";
> }
> 
> Running again:
>
perl5 Makefile.PL MP_USE_STATIC=1 MP_AP_PREFIX="$HOME/src/httpd-2.2.22"
MP_AP_CONFIGURE="--prefix=$HOME/apache2 --with-mpm=prefork"
MP_COMPAT_1X=0
> 
> Result:
> Configuring Apache/2.2.22 mod_perl/2.0.7
Perl/v5.14.2
> --> httpd
> ---> /home/dani/src/httpd-2.2.22/httpd
> -->
apxs
> ERROR from evaluation of
/home/dani/src/mod_perl-2.0.7/Apache-Reload/Makefile.PL: Use of
uninitialized value $v in concatenation (.) or string at
Apache-Test/lib/Apache/TestRun.pm line 1101.
> 
> Ok. As I'm building
mod_perl statically, I don't need apxs so I apply the following
workaround: enclose lines 1100 and 1101 in an if-block testing if $v is
defined: 
> 
> my %args = @Apache::TestMM::Argv;
> while (my($k, $v) =
each %args) {
> if (defined $v) {
> $v =~ s/|/\|/g;
> $body .=
"n$Apache::TestConfig::Argv{'$k'} = q|$v|;n";
> }
> }
> 
> Now, no error
and I could proceed with make:
> 
> make
> make test
> 
> ...
> All
tests successful.
> Files=242, Tests=2469, 427 wallclock secs ( 4.71 usr
0.94 sys + 372.71 cusr 45.48 csys = 423.84 CPU)
> Result: PASS
>
[warning] server localhost:8529 shutdown
> [warning] port 8529 still in
use...
> done
> cd ModPerl-Registry && make test
> make[1]: se ingresa
al directorio `/home/dani/src/mod_perl-2.0.7/ModPerl-Registry'
>
/home/dani/perl/bin/perl -I../blib/arch -I../blib/lib 
> t/TEST -clean
>
[warning] setting ulimit to allow core files
> ulimit -c unlimited;
/home/dani/perl/bin/perl
/home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/TEST -clean
>
APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT=
APACHE_TEST_USER= APACHE_TEST_APXS= 
> /home/dani/perl/bin/perl
-I../blib/arch -I../blib/lib 
> t/TEST -bugreport -verbose=0 
>
[warning] setting ulimit to allow core files
> ulimit -c unlimited;
/home/dani/perl/bin/perl
/home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/TEST -bugreport
-verbose=0
> /home/dani/src/httpd-2.2.22/httpd -d
/home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t -f
/home/dani/src/mod_perl-2.0.7/ModPerl-Registry/t/conf/httpd.conf -D
APACHE2 -D PERL_USEITHREADS
> using Apache/2.2.22 (prefork MPM)
> 
>
waiting 90 seconds for server to start: ....
> waiting 90 seconds for
server to start: ok (waited 2 secs)
> server localhost:8529 started
>
t/206.t .............. ok
> t/304.t .............. ok
> t/404.t
.............. ok 
> t/500.t .............. ok 
> t/bad_scripts.t ......
ok 
> t/basic.t ............ ok 
> t/bin_resp.t ......... ok 
> t/cgi.t
.............. ok 
> t/closure.t .......... ok 
> t/dirindex.t .........
ok 
> t/fatalstobrowser.t .. skipped: fatalsToBrowser known not to work,
CGI version 99.99 or higher is required
> t/flush.t ............
skipped: cannot find module 'deflate'
> t/ithreads.t ......... ok 
>
t/nph.t .............. ok 
> t/perlrun_extload.t .. ok 
> t/prefork.t
.......... ok 
> t/redirect.t ......... ok
> t/regex.t ............ ok

> t/rewrite_env.t ...... skipped: cannot find module 'mod_rewrite.c'
>
t/special_blocks.t ... ok 
> All tests successful.
> Files=20, Tests=84,
33 wallclock secs ( 0.39 usr 0.09 sys + 26.39 cusr 3.21 csys = 30.08
CPU)
> Result: PASS
> [warning] server localhost:8529 shutdown
>
make[1]: se sale del directorio
`/home/dani/src/mod_perl-2.0.7/ModPerl-Registry'
> cd Apache-Reload &&
make test
> make[1]: se ingresa al directorio
`/home/dani/src/mod_perl-2.0.7/Apache-Reload'
> /home/dani/perl/bin/perl
-I../blib/arch -I../blib/lib 
> t/TEST -clean
> [warning] setting ulimit
to allow core files
> ulimit -c unlimited; /home/dani/perl/bin/perl
/home/dani/src/mod_perl-2.0.7/Apache-Reload/t/TEST -clean
>
APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT=
APACHE_TEST_USER= APACHE_TEST_APXS= 
> /home/dani/perl/bin/perl
-I../blib/arch -I../blib/lib 
> t/TEST -bugreport -verbose=0 
>
[warning] setting ulimit to allow core files
> ulimit -c unlimited;
/home/dani/perl/bin/perl
/home/dani/src/mod_perl-2.0.7/Apache-Reload/t/TEST -bugreport
-verbose=0
> mod_perl 2 was built against Apache sources, we don't know
where httpd/apxs executables are, therefore skipping the test suite
execution at
/home/dani/src/mod_perl-2.0.7/Apache-Test/lib/Apache/TestConfig.pm line
371.
> make[1]: *** [run_tests] Error 2
> make[1]: se sale del
directorio `/home/dani/src/mod_perl-2.0.7/Apache-Reload'
> make: ***
[run_subtests] Error 2
> 
> Again, no apxs needed so I ignore the
failure of this last test and proceed with the install:
> 
> make
install
> 
> Finally, some manual testing (from the mod_perl doc) and
everything seems to work:
> 
> Registry Scripts
> To enable registry
scripts add the following to httpd.conf:
> 
> Alias /perl/
/home/dani/httpd/perl/
> 
> SetHandler perl-script
> PerlResponseHandler
ModPerl::Registry
> PerlOptions +ParseHeaders
> Options +ExecCGI
> Order
allow,deny
> Allow from all 
> 
> and now assuming that we have the
following script:
> 
> #!/usr/local/bin/perl5
> print "Content-type:
text/plainnn";
> print "mod_perl rocks!n";
> 
> saved in
/home/dani/httpd/perl/rock.pl [2]. Make the script executable and
readable by everybody:
> 
> % chmod a+rx /home/dani/httpd/perl/rock.pl
[3]
> 
> Of course the path to the script should be readable by the
server too. In the real world you probably want to have a tighter
permissions, but for the purpose of testing that things are working this
is just fine.
> 
> Now restart the server and issue a request to
http://localhost/perl/rock.pl [4] and you should get the response:
> 
>
mod_perl rocks!
> 
> If that didn't work check the error_log file.
> 
>
For more information on the registry scripts refer to the
ModPerl::Registry manpage. (XXX: one day there will a tutorial on
registry, should port it from 1.0's docs).
> 
> Handler Modules
>
Finally check that you can run mod_perl handlers. Let's write a response
handler similar to the registry script from the previous section:
> 
>
#file:MyApache2/Rocks.pm
> #----------------------
> package
MyApache2::Rocks;
> 
> use strict;
> use warnings;
> 
> use
Apache2::RequestRec ();
> use Apache2::RequestIO ();
> 
> use
Apache2::Const -compile => qw(OK);
> 
> sub handler {
> my $r = shift;
>

> $r->content_type('text/plain');
> print "mod_perl 2.0 rocks!n";
> 
>
return Apache2::Const::OK;
> }
> 1;
> 
> Save the code in the file
MyApache2/Rocks.pm, somewhere where mod_perl can find it. For example
let's put it under /home/dani/httpd/perl/MyApache2/Rocks.pm, and we tell
mod_perl that /home/dani/httpd/perl/ is in @INC, via a startup file
which includes just:
> 
> use lib qw(/home/dani/httpd/perl);
> 1;
> 
>
and loaded from httpd.conf:
> 
> PerlRequire
/home/dani/httpd/perl/startup.pl [5]
> 
> Now we can configure our
module in httpd.conf:
> 
> SetHandler perl-script
> PerlResponseHandler
MyApache2::Rocks
> 
> Now restart the server and issue a request to
http://localhost/rocks [6] and you should get the response:
> 
>
mod_perl 2.0 rocks!
> 
> If that didn't work check the error_log file.
>

> Cheers,
> Dani

 

Links:
------
[1] http://perl_version_links.pl
[2]
http://rock.pl
[3] http://rock.pl
[4] http://localhost/perl/rock.pl
[5]
http://startup.pl
[6] http://localhost/rocks

Reply via email to