Setting cookies Help!

Discussion in 'Perl' started by Mark Buck, Aug 16, 2021.

  1. Mark Buck

    Mark Buck New Member

    Joined:
    Aug 15, 2021
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Hi guys:

    I'm not a seasoned programmer, but I get the job done eventually

    The problem I'm having is that I can't get this script to set cookie

    I tried misc java cookie scripts and they set very well, but not with perl

    anyone have any idea what might be wrong? thanks


    the script: (test script )

    Code:
    #!/usr/bin/perl
    
    
    use CGI qw/:standard/;
    use CGI::Carp qw/fatalsToBrowser/;
    use DBI;
    
    
    print "Content-type: text/html\n\n";
    
      
                $q = new CGI;
    
                $action = $q->param('action');
                $alias = $q->param('loginalias');
                $pw = $q->param('loginpassword');
          
          
                my $query = new CGI;
      
                                  
                                      
                my $cookie = $query->cookie(-name=>'BIZARRE',
                                                                        -value=>'this is a new cookie - chocolate Chip',
                                                                        -expires=>'+4h',
                                                                        -path=>'/');  
                                                                      
                                      
                          print $q->header(-cookie=>$cookie);
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice