[interchange] Add utility function cookies_hash to return all current cookies as a hashref
David Christensen <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 78543c56c97c3119cd3761c5e4e80bad4150111b Author: David Christensen <[email protected]> Date: Sat Jun 18 18:51:29 2011 -0500 Add utility function cookies_hash to return all current cookies as a hashref lib/Vend/Util.pm | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) --- diff --git a/lib/Vend/Util.pm b/lib/Vend/Util.pm index e152786..1f711a1 100644 --- a/lib/Vend/Util.pm +++ b/lib/Vend/Util.pm @@ -2010,6 +2010,15 @@ sub read_cookie { return unescape_chars($1); } +sub cookies_hash { + my $string = shift || $CGI::cookie; + my %cookies = map { + my ($k,$v) = split '=', $_, 2; + $k => unescape_chars($v) + } split(/;\s*/, $string); + return \%cookies; +} + sub send_mail { my($to, $subject, $body, $reply, $use_mime, @extra_headers) = @_;