Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by tangent (Vicar)
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 (Prior) 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 lurking in the Monastery: (8)
As of 2021-08-03 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (35 votes). Check out past polls.

    Notices?