HTTP::Tiny now with cookies

In early March, the NY Perl Mongers hosted the first NY.pm hackathon in a space generously provided by the Rubenstein Technology Group.

One of the projects I was pleased to see completed was adding cookie jar support to HTTP::Tiny. A few weeks prior, I had released HTTP::CookieJar in preparation. At the event, Edward Zborowski from Rubenstein volunteered to bring the two together.

Thank you, Edward!

Now, persistent cookie support for HTTP::Tiny is as easy as this:

use HTTP::Tiny;
use HTTP::CookieJar;
use Path::Tiny;

my $jar_file = path("jar.txt");

$jar_file->touch;

my $jar = HTTP::CookieJar->new->load_cookies( $jar_file->lines );

my $ua = HTTP::Tiny->new( cookie_jar => $jar );

# ... do stuff that needs cookies ...

$jar_file->spew( join "\n", $jar->dump_cookies( {persistent => 1} ) );