You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Philip M. Gollucci" <pg...@p6m7g8.com> on 2005/10/11 05:05:22 UTC
Re: *nix distro compatibility (was Re: survey)
David Christensen wrote:
> Carl Johnstone wrote:
>>option of using the version in Sarge, and figuring our where I differ
What version of mp2 comes with Sarge packages ?
1.9922 or higher I hope.
> When I try to port my Eagle book modules to mod_perl2, I trip over the very
> first step:
>
> dpchrist@p166v:~$ perl -e "use EagleBook2::Hello"
> Can't locate Apache/Constants.pm in @INC ...
use Apache2::Const -compile qw(OK) or similiar
see
http://perl.apache.org/docs/2.0/rename.html
I assume you are using
http://modperl.com/book/source/apachemod-code-1.02/lib/Apache/Hello.pm
So here it is ported to mp2 RC5+
Its running at
http://p6m7g8.net/hello
package Apache::Hello;
use strict;
use Apache2::Const -compile => qw (OK);
use Apache2::RequestIO ();
use Apache2::RequestRec ();
use Apache2::Connection ();
sub handler {
my $r = shift;
$r->content_type('text/html');
return Apache2::Const::OK if $r->header_only;
my $host = $r->connection->get_remote_host();
$r->print(<<END);
<HTML>
<HEADER>
<TITLE>Hello There</TITLE>
</HEADER>
<BODY>
<H1>Hello $host</H1>
Who would take this book seriously if the first example didn't
say "hello world"?
</BODY>
</HTML>
END
return Apache2::Const::OK;
}
1;
> dpchrist@p166v:~$ grep Method .bashrc
> alias lookup="perl -MModPerl::MethodLookup -e print_method"
hmm.... I'll bet you are using something PRE RC5 (i.e. 1.9921 or before)
Likely, you're not missing it, but its not in your @INC.
> Has anyone had success using Debian 3.1 with Apache2 and mod_perl2?
Haven't tried yet, but I'll have a test bed sometime next week.
> Someone mentioned FreeBSD -- which version? 5.4? Are there "ports" for CPAN
> modules, or does the user go to CPAN directly?
I'm biased to FreeBSD so I won't comment. However, to answer your question.
ports/packages are at 2.0.54 and 2.0.1.
Should work on almost all versions. If you wanted threaded environments use
5.3+ with libpthread.so instead of the older libc_r.so
I'll vouch vor 4.11, 5.3, 5.4, 6.0-BETA2, 7.0-current.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com
Re: *nix distro compatibility (was Re: survey)
Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
> dpchrist@p166v:~$ apt-cache showpkg libapache2-mod-perl2 | head -n 3
> Package: libapache2-mod-perl2
> Versions:
> 1.999.21-1(/var/lib/apt/lists/ftp.us.debian.org_debian_dists_stable_
> main_binary-i386_Packages)(/var/lib/dpkg/status)
EW!
I'd recompile and update... using the unsupported API is going to drive you and us crazy.
> dpchrist@p166v:~$ perl -e 'print join("\n", @INC), "\n";'
if you stay on the old version of mp2, try
dpchrist@p166v:~$ perl -MApache2 -e 'print join("\n", @INC), "\n";'
> dpchrist@p166v:~$ perl -e 'use Apache2::ModPerl::MethodLookup;'
again on the old version, try
> dpchrist@p166v:~$ perl -MApache2 -e 'ModPerl::MethodLookup;
> dpchrist@p166v:~$ perl -MApache2::ModPerl::MethodLookup -e print_method
> content_type
close but not quite
> dpchrist@p166v:~$ perl -MApache2 -MModPerl::MethodLookup -e 'print_method "content_type"'
The method call name is a string arugment to print_method.
> I guess I'm missing libraries, or mine are out of date/ broken (?).
Out of date
> Okay. I'll be interested to hear your findings.
Well, based on your info above, they'd be the same. I however, plan to recompile from source :
)
> I downloaded and burned ISO's for FreeBSD 5.4, but my vintage hardware won't
> boot the CD and segfaults when I insert the boot floppy the second time. I
> downloaded 4.11 ISO's just now, and will try those next.
What hardware are you using specifically?
You can check the supported list here:
http://www.freebsd.org/releases/5.4R/hardware.html
I should warn you 6.0 is weeks if not days from official release.
> Any other suggestions/ comments/ recommendations?
Upgrade to the latest mp2 and httpd. i.e. 2.0.1 mp2 and 2.0.54 httpd
> package Apache::Hello;
> use strict;
> use warnings;
>
> use Apache::Constants qw(:common);
> sub handler
> {
> my $r = shift;
>
> my $retval = OK; ##### optimistic
>
> $r->content_type('text/html');
> $r->send_http_header;
> goto done if $r->header_only;
> my $host = $r->get_remote_host;
> $r->print(<<END);
> HTML
> done:
> return $retval;
> }
> 1;
>
> __END__
As written thats for mp1.
I ported this for you in the previous e-mail. That port is functionally equivalent in mp2.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com
RE: *nix distro compatibility (was Re: survey)
Posted by David Christensen <dp...@holgerdanske.com>.
Philip M. Gollucci wrote:
> What version of mp2 comes with Sarge packages ?
> 1.9922 or higher I hope.
Thanks for your reply. :-)
dpchrist@p166v:~$ apt-cache showpkg libapache2-mod-perl2 | head -n 3
Package: libapache2-mod-perl2
Versions:
1.999.21-1(/var/lib/apt/lists/ftp.us.debian.org_debian_dists_stable_
main_binary-i386_Packages)(/var/lib/dpkg/status)
> use Apache2::Const -compile qw(OK) or similiar see
> http://perl.apache.org/docs/2.0/rename.html
Okay. I have a bunch more reading to do:
http://perl.apache.org/docs/index.html
> I assume you are using
> http://modperl.com/book/source/apachemod-code-1.02/lib/Apache/Hello.pm
No. When I work my way through a book, I learn best if I write functionally
similar code from scratch. My code follows at the end.
>> dpchrist@p166v:~$ grep Method .bashrc
>> alias lookup="perl -MModPerl::MethodLookup -e print_method"
> hmm.... I'll bet you are using something PRE RC5 (i.e. 1.9921 or
> before) Likely, you're not missing it, but its not in your @INC.
dpchrist@p166v:~$ locate MethodLookup.pm
/usr/lib/perl5/Apache2/ModPerl/MethodLookup.pm
dpchrist@p166v:~$ perl -e 'print join("\n", @INC), "\n";'
/home/dpchrist/perl/lib/perl/5.8
/home/dpchrist/perl/lib/perl/5.8.4
/home/dpchrist/perl/share/perl/5.8
/home/dpchrist/perl/share/perl/5.8.4
/etc/perl
/usr/local/lib/perl/5.8.4
/usr/local/share/perl/5.8.4
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
Looking at the porting guidelines again:
http://winnipeg.pm.org/modperl/docs/2.0/user/porting/porting.html
and changing the alias:
dpchrist@p166v:~$ perl -e 'use Apache2::ModPerl::MethodLookup;'
removes the Perl error, but doesn't provide any useful information:
dpchrist@p166v:~$ lookup content_type
dpchrist@p166v:~$
dpchrist@p166v:~$ perl -MApache2::ModPerl::MethodLookup -e print_method
content_type
I guess I'm missing libraries, or mine are out of date/ broken (?).
>> Has anyone had success using Debian 3.1 with Apache2 and mod_perl2?
> Haven't tried yet, but I'll have a test bed sometime next week.
Okay. I'll be interested to hear your findings.
>> Someone mentioned FreeBSD -- which version? 5.4? Are there "ports"
>> for CPAN modules, or does the user go to CPAN directly?
> I'm biased to FreeBSD so I won't comment. However, to answer your
> question. ports/packages are at 2.0.54 and 2.0.1.
> Should work on almost all versions. If you wanted threaded
> environments use 5.3+ with libpthread.so instead of the older
> libc_r.so
> I'll vouch vor 4.11, 5.3, 5.4, 6.0-BETA2, 7.0-current.
I downloaded and burned ISO's for FreeBSD 5.4, but my vintage hardware won't
boot the CD and segfaults when I insert the boot floppy the second time. I
downloaded 4.11 ISO's just now, and will try those next.
Any other suggestions/ comments/ recommendations?
David
#######################################################################
# $Id: Hello.pm,v 1.8 2005/07/20 23:53:48 dpchrist Exp $
#
# "hello, world!" using mod_perl per [1] pp. 30, 123.
#
# Copyright 2005 by David Christensen <dp...@holgerdanske.com>
#
# References:
#
# [1] Lincoln Stein & Doug MacEachern, 1999, "Writing Apache Modules
# with Perl and C", O'Reilly, ISBN 1-56592-567-X.
#######################################################################
# package:
#----------------------------------------------------------------------
package Apache::Hello;
#######################################################################
# uses:
#----------------------------------------------------------------------
use strict;
use warnings;
use Apache::Constants qw(:common);
#######################################################################
# Apache mod_perl handler:
#----------------------------------------------------------------------
sub handler
{
my $r = shift;
my $retval = OK; ##### optimistic
$r->content_type('text/html');
$r->send_http_header;
goto done if $r->header_only;
my $host = $r->get_remote_host;
$r->print(<<END);
<HTML>
<HEAD>
</HEAD>
<BODY>
<H1>hello, $host!</H1>
Who would take this book seriously if the first example didn't say
"hello, world!"?
</BODY>
</HTML>
END
done:
return $retval;
}
#######################################################################
# end of code:
#----------------------------------------------------------------------
1;
__END__
#######################################################################