HTTP::Cookies::PhantomJS - read and write PhantomJS cookies file
use strict; use HTTP::Cookies::PhantomJS; use WWW::Mechanize::PhantomJS; use LWP::UserAgent; my $phantom = WWW::Mechanize::PhantomJS->new(cookie_file => 'cookies.txt'); $phantom->get('https://www.google.com/'); my $lwp = LWP::UserAgent->new(cookie_jar => HTTP::Cookies::PhantomJS->new(file => 'cookies.txt')); # will reuse cookies received by PhantomJS! $lwp->get('https://www.google.com/');
This is just HTTP::Cookies subclass, so it has all same methods, but reloads load() and save() to make available reading and writing of PhantomJS cookies file. You can easily transform (if you need) HTTP::Cookies object to HTTP::Cookies::PhantomJS or vice versa by reblessing (dirty way) or with code like this:
load()
save()
HTTP::Cookies
HTTP::Cookies::PhantomJS
use strict; use HTTP::Cookies; use HTTP::Cookies::PhantomJS; my $plain_cookies = HTTP::Cookies->new; # fill it with LWP or other way .... # transform my $phantom_cookies = HTTP::Cookies::PhantomJS->new; $plain_cookies->scan(sub { $phantom_cookies->set_cookie(@_); });
Oleg G, <oleg@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself
To install HTTP::Cookies::PhantomJS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::Cookies::PhantomJS
CPAN shell
perl -MCPAN -e shell install HTTP::Cookies::PhantomJS
For more information on module installation, please visit the detailed CPAN module installation guide.