[cgiapp] Using CGI::Cookie from inside CGI::Application
CGI User
cgiapp at mailswamp.com
Wed May 21 17:11:43 EDT 2008
Hi Sasha,
Thanks for the hints.
However, even if I replace '+1H' with '+1h' and don't set secure flag
the cookie still doesn't show up in the browser.
Do you have any other ideas?
Thanks in advance,
Alex
Alexandr Ciornii wrote:
> Hello!
>
> 1. Replace '+1H' with '+1h'
> 2. Are you using https connection? You need to, if you are using
> 'secure' cookie.
>
> You can see which headers are sent with 'Live HTTP headers' extension
> for Firefox.
>
> As for retrieving cookie values, look at CGI.pm documentation: "To
> retrieve a cookie, request it by name by calling cookie() method
> without the -value parameter". Use my $value=$q->cookie('some_name'
> );
>
> 2008/5/21 CGI User <cgiapp at mailswamp.com>:
>> I'm trying to use CGI::Cookie module calling it from CGI::Application
>> environment in cgiapp_prerun like this:
>>
>> sub cgiapp_prerun {
>> my $self = shift;
>>
>> my $cookie = CGI::Cookie->new(
>> -name => 'some_name',
>> -value => '12345',
>> -domain => '.come_domain.com',
>> -path => '/',
>> -expires => '+1H',
>> -secure => 1,
>> );
>>
>> $self->header_add(-cookie => [$cookie]);
>>
>> return $self;
>> }
>>
>> But nothing is happening, and this test cookie is not being set in the
>> browser (Firefox).
>
>> My question are:
>> 1. Why it didn't work in the first case.
>> 2. If the first case won't work, then how I can set all the cookie
>> parameters
>> e.g. domain, path, expires, secure using the second case.
>> 3. How I can retrieve my cookie from the browser is the recommended first
>> case to set cookie is not working, and the second case is working but I
>> cannot see any method to retrieve my own cookie?
>
More information about the cgiapp
mailing list