Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to print out the value of a Cookie?

Reply
Thread Tools

How to print out the value of a Cookie?

 
 
marmot101
Guest
Posts: n/a
 
      07-29-2003
Hi, All,

Using CGI, I get a response from server which plant a Cookie in client
machine. Now I can get this Cookie, but I don't know how to print out the
value of this Cookie? I checked online manual, but seems none method works.
Can anyone help me?

Many thanks!

marmot101

############## My Source Code ####################
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;
use HTTP::Request::Common qw(POST);

my $agent = LWP::UserAgent->new();

my $url = 'http://***';
my $content = [ 'UserName' => '***', 'Password' => '***' ];
my $request = POST $url, $content;

my $response = $agent->request($request);

if ($response->is_success) {
print "Yes, it is success\n";
print $response->content;

$cookie_jar = new HTTP::Cookies->new;
$cookie_jar->extract_cookies($response);

# How to print out value of Cookie here?
# print "Cookie = ", $cookie_jar{'Stamp'}->value; # doesn't work
}


 
Reply With Quote
 
 
 
 
Charles DeRykus
Guest
Posts: n/a
 
      08-18-2003
In article <BVzVa.78$(E-Mail Removed)>,
marmot101 <(E-Mail Removed)> wrote:
>Hi, All,
>
>Using CGI, I get a response from server which plant a Cookie in client
>machine. Now I can get this Cookie, but I don't know how to print out the
>value of this Cookie? I checked online manual, but seems none method works.
>....
># How to print out value of Cookie here?
># print "Cookie = ", $cookie_jar{'Stamp'}->value; # doesn't work
>}


Perhaps the as_string method...?

print $cookie_jar->as_string

--
Charles DeRykus
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM
sort multi-key hash by value and print out with key value pairs Antonio Quinonez Perl Misc 2 08-14-2003 10:56 PM



Advertisments