[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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:




per the included comments regarding libapache-request-perl, and restarted

When I browse to:


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
    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"'

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!  :-)



(note: lines wrapped at 72 columns)

root@p41300:~# cat /etc/apache-perl/conf.d/libhtml-mason-perl-examples.c
# 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
#   You should also replace the above two "PerlModule CGI" and "PerlModu
le CGI::Cookie" lines with
#PerlModule Apache::Request

# 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=
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 
# 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 !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
# mod_actions.c

# !mod_perl.c

# 2004-03-04 araqnid

Reply to: