/usr/share/doc/libhtml-mason-perl-doc/examples/mason_example/show-cookies.html is in libhtml-mason-perl-doc 1:1.56-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | <%doc>
This is actually more complicated than it needs to be.
You could simply say:
$cookies = UNIVERSAL::can("Apache::Cookie", "fetch") ? Apache::Cookie->fetch : CGI::Cookie->fetch;
on the assumption that at least one method will work.
Examining the value of $m->ah->args_method directory is ugly :)
</%doc>
<h3> Cookies </h3>
<%perl>
my $cookies;
my $loaded_cookies;
if ($m->can("ah")) {
if ($m->ah->args_method eq 'CGI') {
$cookies = CGI::Cookie->fetch;
$loaded_cookies = "mod_perl + CGI";
} elsif ($m->ah->args_method eq 'mod_perl') {
$cookies = Apache::Cookie->fetch;
$loaded_cookies = "mod_perl + Apache::Request";
}
}
elsif (UNIVERSAL::can("CGI::Cookie", "fetch")) {
$cookies = CGI::Cookie->fetch;
$loaded_cookies = "CGI";
}
if ($loaded_cookies) {
</%perl>
<ul>
% foreach my $key (sort keys %$cookies) {
<li><b><% $key %></b>: <% $cookies->{$key}->as_string |h%>
% }
</ul>
<p> Cookies loaded with <% $loaded_cookies |h%> </p>
% } else {
<p> Unable to figure out how to get cookies </p>
% }
<%attr>
title => "Cookies"
</%attr>
|