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

[MacPerl] MacPerl, CGI, Cookies



I have attempted to create a MacPerl CGI script that uses HTTP cookies,
but it appears that the environment variable(s) that provide the cookies
to the CGI script are not present to allow me to retrieve the cookie.

Is this a limitation in MacPerl, the Apple Event CGI interface, or the
web server (Apple's Personal Web Sharing)?

Here is my test script:

#!perl -w

use CGI;
use Data::Dumper;

$q = new CGI;
$userid = $q->cookie(-name=>'msgboarduserid');
$newid = rand;

$cookie = $q->cookie(
  -name  => "msgboarduserid",
  -value => $newid,
  -path  => $q->script_name,
  -domain => $q->server_name,
);

print $q->header(-cookie => $cookie);

print <<"END"

<HTML>
  <BODY>
    Cookie: $userid<BR>
    Setting: $newid<BR>
    Raw: @{[$q->raw_cookie]}<BR>
    Env: <PRE>@{[Dumper \%ENV]}</PRE>
  </BODY>
<HTML>

END

-- 
   Kevin Reid.  |     Macintosh.
    "I'm me."   |  Think different.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch