Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Saving HTTP::Cookies into Netscape format using bless/re-bless

by tangent (Parson)
on May 11, 2021 at 15:57 UTC ( #11132410=note: print w/replies, xml ) Need Help??


in reply to Saving HTTP::Cookies into Netscape format using bless/re-bless

You could also use the scan() method to duplicate the stored cookies. It takes a callback which is invoked for each cookie and given arguments in the same order needed for set_cookie()
my $cookie_jar = HTTP::Cookies->new(); # ... my $netscape_cookie_jar = HTTP::Cookies::Netscape->new(); my $callback = sub { $netscape_cookie_jar->set_cookie(@_); }; $cookie_jar->scan( $callback ); $netscape_cookie_jar->save("mycookies.txt");

Replies are listed 'Best First'.
Re^2: Saving HTTP::Cookies into Netscape format using bless/re-bless
by bliako (Monsignor) on May 19, 2021 at 07:32 UTC

    Your approach looks to me to be the safest way for the particular case of cookie-transformation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11132410]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2023-09-29 14:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?