in reply to cookie using cgi.pm

why wouldn't you be able to create the cookie, and display it all on one line.. ?? There is no reason why this wouldn't work: print "Set-Cookie: ", cookie(-name=>'login',-value=>'bliz'), "\n"; But, to go one more step.. you are using the CGI package, let it handle the work of the headers... print header( -type => 'text/html', -cookie => cookie(-name=>'ident',-value=>'eatit200') );

Replies are listed 'Best First'.
RE: RE: cookie using cgi.pm
by csorensen (Beadle) on Jun 30, 2000 at 22:02 UTC
    actually .. setting the cookie and defining it all on the same line has never worked for me ..
    that's why I wrote the cookie this way .. I have tried both of the methods you suggested (they are what I meant by a more perl'ish way) but they didn't work.

      they both worked fine for me?!? I tested them before posting them, and don't see a problem with them... ?!? Just for a cut and paste example,
      #!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header( -type => 'text/plain', -cookie => cookie( -name=>'ident', -value=>'eatit200') ); print <<END_BLOCK; Eat it 200 my friend! Your cookie is now set! END_BLOCK 1;
        I just did a cut and paste ... I get a cgiwrap error every time ..