barrycarlyon has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monks
After seeking advice in the CB on baking cookies, i need some information eating them (ie fetching values), as the CPAN page is'nt really clear
I can fecth the value from a cookie which has only one value, but I am now using a cookie which has two values
$admincookie = new CGI::Cookie(-name=>'LSRfm_admin', -value=>{ username => barrycarlyon, password => md5_hex_value } );
Using the fetch script I wrote which finds the cookie of the given name and returns the value, i get:
Using: my $cookie = LSRfm::Application::Cookie->_cookie('_admin'); to fetch the cookie, I dont think you need the Cookie Create Script it is the same as that in CPAN, except the relevant items of date are swapped for $whatever, fetched using my $whatever = shift;, but I can add it if people want it#fetch the (cgi)type cookie sub _cookie { #read in the lsrfm cookie to test my $self = shift; # my $cgi = CGI->new; # my $type = $cgi->param('type'); my $type = shift; #lets check to see if the lsrfm cookie exits #fecth the domains cookie my %cookies = fetch CGI::Cookie; my $cookies; my $lsrfm_cookie; if (!%cookies) { #a domain cookie doesnt exist #leave as blank } else { #a domain cookie exists #fetch the type value my $n = 0; my $this_cookie; my @cookies = (keys %cookies); foreach (keys %cookies) { $this_cookie = $cookies[$n]; if ($this_cookie eq ('LSRfm'.$type)) { $lsrfm_cookie = $cookies{'LSRfm'.$type}->value; } $n ++; } } return $lsrfm_cookie; }
{ username => barrycarlyon, password => 025a38ae929ace0637824f7728da371d }
So i would like to put the username into $username and the password md5_hex hash into $password
Hope you can help
Bazza
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Baking Cookies and Eating them
by merlyn (Sage) on Sep 30, 2006 at 23:38 UTC | |
|
Re: Baking Cookies and Eating them
by grep (Monsignor) on Sep 30, 2006 at 21:10 UTC | |
| |
|
Re: Baking Cookies and Eating them
by Cody Pendant (Prior) on Sep 30, 2006 at 22:45 UTC |