I have $cookie_jar which created using HTTP::Cookies:
$cookie_jar = HTTP::Cookies->new(
file => "my$path/my_cookies.dat",
autosave => 1,
);
I want to use this $cookie_jar using Mojo::UserAgent but didn't find an option, the only option I see is parsing raw string:
my $cookies = $cookie->parse($str);
I've uploaded a new version of HTTP::Cookies::Mozilla and it includes a sample program that solves this issue.
Load your data using
HTTP::Cookiethen convert it whatever format that you like by callingscanwith a callback:Inside that callback, convert it to the
Mojo::Cookie::Responseobject:Alternately, write a subclass of
HTTP::Cookiesthat reads your format theHTTP::Cookiesway but populates aMojo::CookieJarinstead. It's not that hard (and I've written several such things, some of which are on CPAN).HTTP::Cookiesalso has theas_stringmethod which makes a multi-line string with one cookie per string. You can use those lines to feed intoMojo::Cookieto re-parse them, but that's not as appealing to me.