[vox-tech] Trying to use Apache::Cookie
Darrick Servis
vox-tech@lists.lugod.org
Thu, 22 May 2003 17:51:31 -0700
Have you tried $r->send_http_header() as it looks like bake only adds the
cookie to the request header but you're not sending anything.
Maybe before dealing with cookies you should pile through man Apache and
fiddle with all the functions there. That is if you got time and your
playing with it all.
On Thursday 22 May 2003 04:00 pm, Jay Strauss wrote:
> I thought you guys all said you've used mod_perl. Did everyone ignore this
> post?
>
> Jay
> ----- Original Message -----
> From: "Jay Strauss" <me@heyjay.com>
> To: "vox-tech" <vox-tech@lists.lugod.org>
> Sent: Wednesday, May 21, 2003 11:18 PM
> Subject: [vox-tech] Trying to use Apache::Cookie
>
> > Ok, since it seems mod_perl is an appropriate topic. Here a mod_perl
> > question.
> >
> > I'm trying to use Apache::Cookie. But I'm unable to send the cookie. I
>
> can
>
> > pick it up fine using Apache::Cookie->fetch (if I send it using
> > CGI::Cookie). I must not be doing something, like sending the header, or
>
> I'm
>
> > doing something else wrong. Below are 2 pieces of code the first is
> > supposed to create a cookie, the second fetches it and displays the keys.
> >
> > Thanks
> > Jay
> >
> > package Apache::Init;
> >
> > use strict;
> > use Apache::Constants qw(:common);
> > use Apache::Cookie;
> > use CGI::Cookie;
> > use CGI qw/:standard/;
> >
> > sub handler {
> > my $r = shift;
> >
> > # If I do it like this it works
> > #
> > #my $cookie1 = new CGI::Cookie(-name=>'ID',-value=>123456);
> > #my $cookie2 = new CGI::Cookie(-name=>'preferences',
> > # -value=>{ font => 'Helvetica',
> > # size => 12 }
> > # );
> > #print header(-cookie=>[$cookie1,$cookie2]);
> >
> > my $cookie = Apache::Cookie->new($r,
> > -name => 'foo',
> > -value => 'bar',
> > -expires => '+3M',
> > -domain => '.heyjay.com',
> > -secure => 1
> > );
> >
> > $cookie->bake;
> >
> > return OK;
> >
> > }
> >
> >
> > 1;
> >
> >
> > Second Code
> > ===========
> > package Apache::Catch;
> >
> > use strict;
> > use Apache::Constants qw(:common);
> > use CGI '-autoload';
> > use Apache::Cookie;
> > use CGI::Cookie;
> >
> > sub handler {
> > my $r = shift;
> > my %cookies = Apache::Cookie->fetch;
> >
> > map{$r->log_error($_); print "$_\n"} keys %cookies;
> > return OK;
> >
> > }
> >
> > 1;
> >
> > __END__
> >
> >
> >
> > _______________________________________________
> > vox-tech mailing list
> > vox-tech@lists.lugod.org
> > http://lists.lugod.org/mailman/listinfo/vox-tech
>
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech