Created
July 6, 2009 00:36
-
-
Save ikolar/141195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl -W | |
use strict; | |
use HTTP::Response; | |
use HTTP::Request; | |
use HTTP::Cookies; | |
=pod | |
construct a cookie jar from a "Cookie: .." string you retrieve from LiveHttpHeaders or elsewhere | |
this should have been available out of the box :/ | |
=cut | |
sub get_cookie_jar() { | |
my $r = HTTP::Response->new(200, "Crooked as a hooker's smile", | |
HTTP::Headers->new("Set-Cookie" => 'Cookie string'); | |
$r->request(HTTP::Request->new("GET" => "http://www.facebook.com")); # enter domain | |
my $cookie_jar = HTTP::Cookies->new(); | |
$cookie_jar->extract_cookies($r); | |
return $cookie_jar; | |
} | |
print &get_cookie_jar()->as_string; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment