setting cookies (mod_perl)

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to learn mod_perl 2

I've created the following script:
package smmod;

use strict;
use warnings;

use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::Const -compile => qw(OK);

sub handler {
  my $r = shift;
  $r->headers_out->add('Set-Cookie' => 'myCookie=vanilla'); # BUG ?
  return Apache::OK;

And I've added the following to my apache conf file:
PerlModule smmod
<Location /sm>
  SetHandler modperl
  PerlResponseHandler smmod

Yet I keep getting this error when I use the script:
[Thu Oct 14 19:42:56 2004] [error] [client XXXX] Can't locate object method
"add" via package "APR::Table" at C:/Program Files/Apache
Group/Apache2/lib/perl/ line 13.\n

It's probably simple, but I'm not able to figure out what's wrong. Anybody?

Thanks in advance

Re: setting cookies (mod_perl)

un wrote:

Quoted text here. Click to load it


  require APR::Table;


  use APR::Table ();

The mod_perl module often creates objects of classes for which it has
not (full) loaded the methods.

I've never really know why the mod_perl docs use use() rather then

Re: setting cookies (mod_perl)

That worked! I thought I'd tried that one already... Anyway, thanks a lot!

Re: setting cookies (mod_perl)

Quoted text here. Click to load it

Packages with all-lowercase names are reserved for Perl pragmas. I would
suggest using something else; I would also suggest not using a
top-level namespace but putting it somewhere appropriate ('Writing
modules is easy. Naming modules is hard' [Anno Siegel, c.l.p.m])


And if you wanna make sense / Whatcha looking at me for?          (Fiona Apple)
                            * *

Site Timeline