Debian Sarge, apache-perl, libhtml-mason-perl-examples, Apache::Cookie needs to be loaded
hello, world!
I have a Debian Sarge (3.1r0a) machine with apache-perl (e.g. Apache 1.3.33 with
mod_perl 1.29 compiled in). Tonight, I installed:
libhtml-mason-perl
libhtml-mason-perl-doc
libhtml-mason-perl-examples
libapache-request-perl
edited
/etc/apache-perl/conf.d/libhtml-mason-perl-examples.conf
per the included comments regarding libapache-request-perl, and restarted
apache-perl.
When I browse to:
http://p41300.holgerdanske.com/mason_example/
I see a page "Index" with eight examples. The first five and the last two work,
but "show-cookies" gives me:
System error
error: Can't locate object method "fetch" via package "Apache::Cook
ie" (perhaps you forgot to load "Apache::Cookie"?) at /var/www/mason_exa
mple/show-cookies line 20.
context: ...
16: if ($m->ah->args_method eq 'CGI') {
17: $cookies = CGI::Cookie->fetch;
18: $loaded_cookies = "mod_perl + CGI";
19: } elsif ($m->ah->args_method eq 'mod_perl') {
20: $cookies = Apache::Cookie->fetch;
21: $loaded_cookies = "mod_perl + Apache::Request";
22: }
23: }
24: elsif (UNIVERSAL::can("CGI::Cookie", "fetch")) {
...
code stack: /var/www/mason_example/show-cookies:20
/var/www/mason_example/autohandler:17
raw error
I believe Mason is complaining about Apache::Cookie.
Doing a simple test from the command line:
dpchrist@p41300:~$ perl -MApache::Cookie -e 'print $Apache::Cookie::
VERSION, "\n"'
1.1
It appears that the Apache::Cookie module is installed. Perhaps I need to tell
apache-perl someplace/somehow to load Apache::Cookie? Let's try putting
"PerlModule Apache::Cookie" into
/etc/apache-perl/conf.d/libhtml-mason-perl-examples.conf (see below). Yup --
show-cookies now works! :-)
HTH,
David
(note: lines wrapped at 72 columns)
root@p41300:~# cat /etc/apache-perl/conf.d/libhtml-mason-perl-examples.c
onf
# This -*- Apache -*- configuration enables the example Mason components
in /var/www/mason_example
<IfModule mod_perl.c>
# We have mod_perl available
#PerlModule CGI
#PerlModule CGI::Cookie
PerlModule Apache::Request
PerlModule Apache::Cookie
<Directory /var/www/mason_example>
SetHandler perl-script
PerlHandler HTML::Mason::ApacheHandler
# We use the CGI args_method to stop this crashing if
# libapache-request-perl is not installed
# PerlSetVar MasonArgsMethod CGI
# If you have install libapache-request-perl, you can delete the above
line.
# You should also replace the above two "PerlModule CGI" and "PerlModu
le CGI::Cookie" lines with
#PerlModule Apache::Request
</Directory>
# This chunk allows concurrent use with mod_perl *or* CGI:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/mason_example_cgi/$ /usr/lib/cgi-bin/mason_example.cgi [E=
PATH_INFO:/mason_example/index.html,T=application/x-httpd-cgi]
RewriteRule ^/mason_example_cgi/(.+)/$ /usr/lib/cgi-bin/mason_example.cg
i [E=PATH_INFO:/mason_example/$1/index.html,T=application/x-httpd-cgi]
RewriteRule ^/mason_example_cgi/(.+) /usr/lib/cgi-bin/mason_example.cgi
[E=PATH_INFO:/mason_example/$1,T=application/x-httpd-cgi]
</IfModule>
# And so http://localhost/mason_example/ uses mod_perl, and
# http://localhost/mason_example_cgi/ uses CGI
# This is *not* the way you would normally use mason-with-cgi, see below for an
easier way!
</IfModule>
<IfModule !mod_perl.c>
# No mod_perl available, just use CGI
# We need wither mod_actions or mod_rewrite enabled to do this. What
# to do if the user has neither enabled?
# (in any case, don't present the user with a broken config)
<IfModule mod_actions.c>
Action mason_example http://localhost/cgi-bin/mason_example.cgi
<Directory /var/www/mason_example>
SetHandler mason_example
</Directory>
</IfModule>
# mod_actions.c
</IfModule>
# !mod_perl.c
# 2004-03-04 araqnid
Reply to: