SPUG: RE: HTTP::Cookies question

Dan Ebert mathin at mathin.com
Thu Feb 28 15:42:25 CST 2002


I have used something like this in the past.

This is just with 'use CGI'

my $cookie = $cgi->cookie(-name=>'name',-value=>\%hash);

then when you print the header ...

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

to retrieve:
my %scores = $cgi->cookie(-name=>'name');

Hope it helps.

Dan.
----------------------------------------------------------
Immigration is the sincerest form of flattery.
	- Unknown
----------------------------------------------------------


On Thu, 28 Feb 2002, S Bullo wrote:

> Ok, I changed it to the following:
> 
> my $url =
> "http://$row[0]$row[1]$row[2]$row[3]$row[4]$row[5]$row[6]&subject=$row[7]&me
> ssage=$row[8]";
> $row[6] =~ s|'s|s|g;
> $row[7] =~ s|#| |g;
> $row[8] =~ s|#| |g;
> my $sec_file_path = "members/data/$row[9]";
> my $data = "members/data/$row[9]/$row[10].html";
> if (! -d "$sec_file_path") { system "mkdir -p $sec_file_path" }
> my $req = HTTP::Request->new(GET=>$url);
> my $domain = $cookie_jar->add_cookie_header($req);
> my $resp = $ua->request($req, $data);
> my $domain2 = $cookie_jar->extract_cookies($resp);
> my $outfile = "index.html";
> my $filename = "$sec_file_path/$outfile";
> open (FILE,">>$filename") or die "Error opening $filename: $!";
> { print FILE "<a href='$row[10].html'>Report on $date for
> '$row[10]'</a><br>"; }
> close (FILE);
> }
> 
> Doesn't give me an error but it doesn't seem to be passing any cookies
> through - I am still getting incorrect, correct?
> 
> 
> Susanne Bullo
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>      POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
>       Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
>   Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
>  For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
>      Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
> 
> 
> 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org





More information about the spug-list mailing list