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:

#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; }
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

{ 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
Barry Carlyon barry@barrycarlyon.co.uk

In reply to Baking Cookies and Eating them by barrycarlyon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.