HTTP-CookieMonster-0.09/000755 000765 000024 00000000000 12434646611 015073 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/Build.PL000644 000765 000024 00000002603 12434646611 016370 0ustar00olafstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.021. use strict; use warnings; use Module::Build 0.28; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.28" }, "configure_requires" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "dist_abstract" => "Easy read/write access to your jar of HTTP::Cookies", "dist_author" => [ "Olaf Alders " ], "dist_name" => "HTTP-CookieMonster", "dist_version" => "0.09", "license" => "perl", "module_name" => "HTTP::CookieMonster", "recommends" => {}, "recursive_test_files" => 1, "requires" => { "Carp" => 0, "HTTP::Cookies" => 0, "Moo" => "1.000003", "Safe::Isa" => 0, "Scalar::Util" => 0, "Sub::Exporter" => 0, "URI::Escape" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0 }, "script_files" => [], "test_requires" => { "Data::Serializer" => 0, "Test::More" => 0, "Test::Most" => 0 } ); my %fallback_build_requires = ( "Data::Serializer" => 0, "Module::Build" => "0.28", "Test::More" => 0, "Test::Most" => 0 ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = Module::Build->new(%module_build_args); $build->create_build_script; HTTP-CookieMonster-0.09/Changes000644 000765 000024 00000001732 12434646611 016371 0ustar00olafstaff000000 000000 Revision history for HTTP-CookieMonster 0.09 2014-11-24 10:23:51 America/Toronto - Removes the BETA warning - Fixes some Pod typos 0.08 2014-10-22 13:47:09 America/Toronto - Cookie values are now unescaped before reading and escaped before writing. 0.07 2014-02-04 10:50:27 America/Toronto - Adds local to MANIFEST.SKIP 0.06 2014-02-04 10:42:31 America/Toronto - Adds delete_cookie() method 0.05 2012-09-28 - Fixes typo in SYNOPSIS 0.04 2012-09-19 - Now using BUILDARGS to accept just one argument when creating new HTTP::CookieMonster object - Adds cookies() function for quick read-only cookie access 0.03 2012-08-23 - all_cookies() now returns an ARRAY rather than ARRAYREF, but will still return the reference if not called in list context - all_cookies() is now a regular method rather than an accessor 0.02 2012-08-21 - Fixes errors in Pod - Fixes internal cookie setting 0.01 2012-08-21 - Initial release HTTP-CookieMonster-0.09/cpanfile000644 000765 000024 00000001277 12434646611 016606 0ustar00olafstaff000000 000000 requires "Carp" => "0"; requires "HTTP::Cookies" => "0"; requires "Moo" => "1.000003"; requires "Safe::Isa" => "0"; requires "Scalar::Util" => "0"; requires "Sub::Exporter" => "0"; requires "URI::Escape" => "0"; requires "perl" => "5.006"; requires "strict" => "0"; requires "warnings" => "0"; on 'build' => sub { requires "Module::Build" => "0.28"; }; on 'test' => sub { requires "Data::Serializer" => "0"; requires "Test::More" => "0"; requires "Test::Most" => "0"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "Module::Build" => "0.28"; }; on 'develop' => sub { requires "Pod::Coverage::TrustPod" => "0"; requires "Test::Pod::Coverage" => "1.08"; }; HTTP-CookieMonster-0.09/dist.ini000644 000765 000024 00000001541 12434646611 016540 0ustar00olafstaff000000 000000 name = HTTP-CookieMonster author = Olaf Alders license = Perl_5 copyright_holder = Olaf Alders copyright_year = 2012 [VersionFromModule] [GatherDir] exclude_filename = cpanfile exclude_filename = README [PruneCruft] [ManifestSkip] [License] [PodCoverageTests] [ExtraTests] [ExecDir] [ShareDir] [PkgVersion] [MakeMaker] [Manifest] [NextRelease] format = %-1v %{yyyy-MM-dd HH:mm:ss VVVV}d [TestRelease] [ConfirmRelease] [UploadToCPAN] [MetaResources] [MetaJSON] [MetaYAML] [Bugtracker] web = http://github.com/oalders/%s/issues [GithubMeta] [AutoPrereqs] [Prereqs] Moo = 1.000003 [PrePAN] author = http://prepan.org/user/3Yz7PYrBzQ module = http://prepan.org/module/429En4oFdi [Test::Perl::Critic] [ReadmeFromPod] [InstallGuide] [ModuleBuild] [PodWeaver] [CPANFile] [CopyFilesFromBuild] copy = cpanfile copy = README [@Git] HTTP-CookieMonster-0.09/examples/000755 000765 000024 00000000000 12434646611 016711 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/INSTALL000644 000765 000024 00000001755 12434646611 016134 0ustar00olafstaff000000 000000 This is the Perl distribution HTTP-CookieMonster. Installing HTTP-CookieMonster is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm HTTP::CookieMonster If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S HTTP::CookieMonster ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan HTTP::CookieMonster ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Build.PL % ./Build && ./Build test Then install it: % ./Build install If you are installing into a system-wide directory, you may need to run: % sudo ./Build install ## Documentation HTTP-CookieMonster documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc HTTP::CookieMonster HTTP-CookieMonster-0.09/lib/000755 000765 000024 00000000000 12434646611 015641 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/LICENSE000644 000765 000024 00000043652 12434646611 016112 0ustar00olafstaff000000 000000 This software is copyright (c) 2012 by Olaf Alders. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2012 by Olaf Alders. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2012 by Olaf Alders. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End HTTP-CookieMonster-0.09/Makefile.PL000644 000765 000024 00000003251 12434646611 017046 0ustar00olafstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.021. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Easy read/write access to your jar of HTTP::Cookies", "AUTHOR" => "Olaf Alders ", "BUILD_REQUIRES" => { "Module::Build" => "0.28" }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "DISTNAME" => "HTTP-CookieMonster", "EXE_FILES" => [], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "HTTP::CookieMonster", "PREREQ_PM" => { "Carp" => 0, "HTTP::Cookies" => 0, "Moo" => "1.000003", "Safe::Isa" => 0, "Scalar::Util" => 0, "Sub::Exporter" => 0, "URI::Escape" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Data::Serializer" => 0, "Test::More" => 0, "Test::Most" => 0 }, "VERSION" => "0.09", "test" => { "TESTS" => "t/*.t t/cookie/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "Data::Serializer" => 0, "ExtUtils::MakeMaker" => 0, "HTTP::Cookies" => 0, "Module::Build" => "0.28", "Moo" => "1.000003", "Safe::Isa" => 0, "Scalar::Util" => 0, "Sub::Exporter" => 0, "Test::More" => 0, "Test::Most" => 0, "URI::Escape" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); HTTP-CookieMonster-0.09/MANIFEST000644 000765 000024 00000000553 12434646611 016227 0ustar00olafstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.021. Build.PL Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini examples/read_cookies.pl lib/HTTP/CookieMonster.pm lib/HTTP/CookieMonster/Cookie.pm t/author-critic.t t/cookie/load.t t/cookie_jar.txt t/load.t t/procedural.t t/release-pod-coverage.t HTTP-CookieMonster-0.09/META.json000644 000765 000024 00000003656 12434646611 016526 0ustar00olafstaff000000 000000 { "abstract" : "Easy read/write access to your jar of HTTP::Cookies", "author" : [ "Olaf Alders " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.021, CPAN::Meta::Converter version 2.142060", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "HTTP-CookieMonster", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.28" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Module::Build" : "0.28" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Carp" : "0", "HTTP::Cookies" : "0", "Moo" : "1.000003", "Safe::Isa" : "0", "Scalar::Util" : "0", "Sub::Exporter" : "0", "URI::Escape" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Data::Serializer" : "0", "Test::More" : "0", "Test::Most" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://github.com/oalders/HTTP-CookieMonster/issues" }, "homepage" : "https://github.com/oalders/http-cookiemonster", "repository" : { "type" : "git", "url" : "https://github.com/oalders/http-cookiemonster.git", "web" : "https://github.com/oalders/http-cookiemonster" }, "x_prepan_author" : "http://prepan.org/user/3Yz7PYrBzQ", "x_prepan_module" : "http://prepan.org/module/429En4oFdi" }, "version" : "0.09" } HTTP-CookieMonster-0.09/META.yml000644 000765 000024 00000001777 12434646611 016360 0ustar00olafstaff000000 000000 --- abstract: 'Easy read/write access to your jar of HTTP::Cookies' author: - 'Olaf Alders ' build_requires: Data::Serializer: '0' Module::Build: '0.28' Test::More: '0' Test::Most: '0' configure_requires: ExtUtils::MakeMaker: '0' Module::Build: '0.28' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.021, CPAN::Meta::Converter version 2.142060' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: HTTP-CookieMonster requires: Carp: '0' HTTP::Cookies: '0' Moo: '1.000003' Safe::Isa: '0' Scalar::Util: '0' Sub::Exporter: '0' URI::Escape: '0' perl: '5.006' strict: '0' warnings: '0' resources: Prepan_author: http://prepan.org/user/3Yz7PYrBzQ Prepan_module: http://prepan.org/module/429En4oFdi bugtracker: http://github.com/oalders/HTTP-CookieMonster/issues homepage: https://github.com/oalders/http-cookiemonster repository: https://github.com/oalders/http-cookiemonster.git version: '0.09' HTTP-CookieMonster-0.09/README000644 000765 000024 00000014756 12434646611 015770 0ustar00olafstaff000000 000000 NAME HTTP::CookieMonster - Easy read/write access to your jar of HTTP::Cookies VERSION version 0.09 SYNOPSIS # Use the functional interface for quick read-only access use HTTP::CookieMonster qw( cookies ); use WWW::Mechanize; my $mech = WWW::Mechanize->new; my $url = 'http://www.nytimes.com'; $mech->get( $url ); my @cookies = cookies( $mech->cookie_jar ); my $cookie = cookies( $mech->cookie_jar, 'RMID' ); print $cookie->val; # Use the OO interface for read/write access use HTTP::CookieMonster; my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); my $cookie = $monster->get_cookie('RMID'); print $cookie->val; $cookie->val('random stuff'); $monster->set_cookie( $cookie ); # now fetch page using mangled cookie $mech->get( $url ); DESCRIPTION This module was created because messing around with HTTP::Cookies is non-trivial. HTTP::Cookies a very useful module, but using it is not always as easy and clean as it could be. For instance, if you want to find a particular cookie, you can't just ask for it by name. Instead, you have to use a callback: $cookie_jar->scan( \&callback ) The callback will be invoked with 11 positional parameters: 0 version 1 key 2 val 3 path 4 domain 5 port 6 path_spec 7 secure 8 expires 9 discard 10 hash That's a lot to remember and it doesn't make for very readable code. Now, let's say you want to save or update a cookie. Now you're back to the many positional params yet again: $cookie_jar->set_cookie( $version, $key, $val, $path, $domain, $port, $path_spec, $secure, $maxage, $discard, \%rest ) Also not readable. Unless you have an amazing memory, you may find yourself checking the docs regularly to see if you did, in fact, get all those params in the correct order etc. HTTP::CookieMonster gives you a simple interface for getting and setting cookies. You can fetch an ARRAY of all your cookies: my @all_cookies = $monster->all_cookies; foreach my $cookie ( @all_cookies ) { print $cookie->key; print $cookie->val; print $cookie->secure; print $cookie->domain; # etc } Or, if you know for a fact exactly what will be in your cookie jar, you can fetch a cookie by name. my $cookie = $monster->get_cookie( 'plack_session' ); This gives you fast access to a cookie without a callback, iterating over a list etc. It's good for quick hacks and you can dump the cookie quite easily to inspect its contents in a highly readable way: use Data::Printer; p $cookie; If you want to mangle the cookie before the next request, that's easy too. $cookie->val('woohoo'); $monster->set_cookie( $cookie ); $mech->get( $url ); Or, add an entirely new cookie to the jar: use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( key => 'cookie-name', val => 'cookie-val', path => '/', domain => '.somedomain.org', path_spec => 1, secure => 0, expires => 1376081877 ); $monster->set_cookie( $cookie ); $mech->get( $url ); new new() takes just one required parameter, which is cookie_jar, a valid HTTP::Cookies object. my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); cookie_jar A reader which returns an HTTP::Cookies object. all_cookies Returns an ARRAY of all cookies in the cookie jar, represented as HTTP::CookieMonster::Cookie objects. my @cookies = $monster->all_cookies; foreach my $cookie ( @cookies ) { print $cookie->key; } set_cookie( $cookie ) Sets a cookie and updates the cookie jar. Requires a HTTP::CookieMonster::Cookie object. my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); my $s = $monster->get_cookie('session'); $s->val('random_string'); $monster->set_cookie( $s ); # You can also add an entirely new cookie to the jar via this method use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( key => 'cookie-name', val => 'cookie-val', path => '/', domain => '.somedomain.org', path_spec => 1, secure => 0, expires => 1376081877 ); $monster->set_cookie( $cookie ); delete_cookie( $cookie ) Deletes a cookie and updates the cookie jar. Requires a HTTP::CookieMonster::Cookie object. get_cookie( $name ) Be aware that this method may surprise you by what it returns. When called in scalar context, get_cookie() returns the first cookie which exactly matches the name supplied. In many cases this will be exactly what you want, but that won't always be the case. If you are spidering multiple web sites with the same UserAgent object, be aware that you'll likely have cookies from multiple sites in your cookie jar. In this case asking for get_cookie('session') in scalar context may not return the cookie which you were expecting. You will be safer calling get_cookie() in list context: $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); # first cookie with this name my $first_session = $monster->get_cookie('session'); # all cookies with this name my @all_sessions = $monster->get_cookie('session'); FUNCTIONAL/PROCEDURAL INTERFACE cookies This function will DWIM. Here are some examples: use HTTP::CookieMonster qw( cookies ); # get all cookies in your jar my @cookies = cookies( $mech->cookie_jar ); # get all cookies of a certain name/key my @session_cookies = cookies( $mech->cookie_jar, 'session_cookie_name' ); # get the first cookie of a certain name/key my $first_session_cookie = cookies( $mech->cookie_jar, 'session_cookie_name' ); AUTHOR Olaf Alders COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Olaf Alders. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. HTTP-CookieMonster-0.09/t/000755 000765 000024 00000000000 12434646611 015336 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/t/author-critic.t000644 000765 000024 00000000666 12434646611 020310 0ustar00olafstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); HTTP-CookieMonster-0.09/t/cookie/000755 000765 000024 00000000000 12434646611 016607 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/t/cookie_jar.txt000644 000765 000024 00000000616 12434646611 020207 0ustar00olafstaff000000 000000 ^Data::Dumper|||hex|^626c65737328207b27434f4f4b49455327203d3e207b272e6e7974696d65732e636f6d27203d3e207b272f27203d3e207b27616478637327203d3e205b302c27732a32643764373d303a31272c756e6465662c312c756e6465662c756e6465662c315d2c27524d494427203d3e205b302c27303763356233323334393731353033326132633235663161272c756e6465662c312c756e6465662c313337373033313734365d7d7d7d7d2c2027485454503a3a436f6f6b696573272029 HTTP-CookieMonster-0.09/t/load.t000644 000765 000024 00000003727 12434646611 016453 0ustar00olafstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use Test::More; use Data::Serializer; use HTTP::CookieMonster; use Scalar::Util qw( reftype ); my $serializer = Data::Serializer->new; my $jar = $serializer->retrieve( 't/cookie_jar.txt' ); my $obj = HTTP::CookieMonster->new( cookie_jar => $jar ); ok( $obj, "can create object with 2 args" ); my $monster = HTTP::CookieMonster->new( $jar ); ok( $monster, "got a monster" ); ok( $monster->all_cookies, "all cookies" ); is( reftype $monster->all_cookies, 'ARRAY', "all cookies returns arrayref in scalar context" ); my @all_cookies = $monster->all_cookies; is( scalar @all_cookies, 2, "all cookies returns array in list context" ); my $all_cookies = $monster->all_cookies; ok( $monster->get_cookie( 'RMID' ), "got a single cookie" ); my $rmid = $monster->get_cookie( 'RMID' ); $rmid->val( 'random' ); is $monster->set_cookie( $rmid ), 1, "can set cookie"; # try adding a new cookie to the jar my %args = ( version => 0, key => 'foo', val => 'bar', path => '/', domain => '.metacpan.org', port => 80, path_spec => 1, secure => 1, expires => 1376081877, discard => undef, hash => {}, ); my $cookie = HTTP::CookieMonster::Cookie->new( %args ); ok( $monster->set_cookie( $cookie ), "can set a cookie" ); my $cookie2 = HTTP::CookieMonster::Cookie->new( %args, domain => 'foo.metacpan.org' ); ok( $monster->set_cookie( $cookie2 ), "can set a second cookie" ); my $first_cookie = $monster->get_cookie( 'foo' ); isa_ok( $first_cookie, 'HTTP::CookieMonster::Cookie' ); my @all_foo_cookies = $monster->get_cookie( 'foo' ); my $count = @all_foo_cookies; is( $count, 2, "there are 2 foo cookies" ); ok( $monster->delete_cookie( $cookie ), 'delete returns true' ); { my @all_foo_cookies = $monster->get_cookie( 'foo' ); my $count = @all_foo_cookies; is( $count, 1, '1 foo cookie deleted' ); } done_testing(); HTTP-CookieMonster-0.09/t/procedural.t000644 000765 000024 00000003027 12434646611 017665 0ustar00olafstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use Test::Most; use Data::Serializer; use HTTP::CookieMonster qw( cookies ); # 1) my $cookie = cookies( $jar ); -- first cookie (makes no sense) # 2) my $session = cookies( $jar, 'session' ); # 3) my @cookies = cookies( $jar ); # 4) my @sessions = cookies( $jar, 'session' ); my $serializer = Data::Serializer->new; my $jar = $serializer->retrieve( 't/cookie_jar.txt' ); # case 1 dies_ok { my $cookies = cookies( $jar ) } 'cookie name required in scalar context'; # case 2 my $rmid = cookies( $jar, 'RMID' ); isa_ok( $rmid, 'HTTP::CookieMonster::Cookie' ); # case 3 my @all_cookies = cookies( $jar ); is( scalar @all_cookies, 2, "all cookies returns array in list context" ); # case 4 my @sessions = cookies( $jar, 'RMID' ); is( scalar @sessions, 1, "returns one RMID in array context" ); isa_ok( $sessions[0], 'HTTP::CookieMonster::Cookie' ); # now let's try 2 RMID cookies my $new_cookie = HTTP::CookieMonster::Cookie->new( version => 0, key => 'RMID', val => 'bar', path => '/', domain => '.metacpan.org', port => 80, path_spec => 1, secure => 1, expires => 1376081877, discard => undef, hash => {}, ); my $monster = HTTP::CookieMonster->new( $jar ); $monster->set_cookie( $new_cookie ); @sessions = cookies( $jar, 'RMID' ); is( scalar @sessions, 2, "returns two RMIDs in array context" ); foreach my $session ( @sessions ) { isa_ok( $sessions[0], 'HTTP::CookieMonster::Cookie' ); } done_testing(); HTTP-CookieMonster-0.09/t/release-pod-coverage.t000644 000765 000024 00000000572 12434646611 021520 0ustar00olafstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); HTTP-CookieMonster-0.09/t/cookie/load.t000644 000765 000024 00000001027 12434646611 017713 0ustar00olafstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use Test::More; use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( version => 0, key => 'foo', val => 'bar', path => '/', domain => '.metacpan.org', port => 80, path_spec => 1, secure => 1, expires => 1376081877, discard => undef, hash => {}, ); isa_ok( $cookie, "HTTP::CookieMonster::Cookie" ); diag "val: " . $cookie->val; diag "key: " . $cookie->key; done_testing(); HTTP-CookieMonster-0.09/lib/HTTP/000755 000765 000024 00000000000 12434646611 016420 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/lib/HTTP/CookieMonster/000755 000765 000024 00000000000 12434646611 021201 5ustar00olafstaff000000 000000 HTTP-CookieMonster-0.09/lib/HTTP/CookieMonster.pm000644 000765 000024 00000023271 12434646611 021544 0ustar00olafstaff000000 000000 use strict; use warnings; package HTTP::CookieMonster; $HTTP::CookieMonster::VERSION = '0.09'; $HTTP::CookieMonster::VERSION = '0.09'; use 5.006; use Moo; use Carp qw( croak ); use HTTP::Cookies; use HTTP::CookieMonster::Cookie; use Safe::Isa; use Scalar::Util qw( reftype ); use Sub::Exporter -setup => { exports => ['cookies'] }; use URI::Escape qw( uri_escape uri_unescape ); my @_cookies = (); has 'cookie_jar' => ( required => 1, is => 'ro', isa => sub { croak 'HTTP::Cookies object expected' if !$_[0]->$_isa( 'HTTP::Cookies' ); } ); sub BUILDARGS { my ( $class, @args ) = @_; return { cookie_jar => shift @args } if @args == 1; return {@args}; } # all_cookies() is now a straight method rather than a Moo accessor in order to # prevent the all_cookies list from getting out of sync with changes to the # cookie_jar which happen outside of this module. Rather than trying to detect # changes, we'll just create a fresh list each time. Performance penalties # should be minimal and this keeps things simple. sub all_cookies { my $self = shift; @_cookies = (); $self->cookie_jar->scan( \&_check_cookies ); wantarray ? return @_cookies : return \@_cookies; } # my $cookie = cookies( $jar ); -- first cookie (makes no sense) # my $session = cookies( $jar, 'session' ); # my @cookies = cookies( $jar ); # my @sessions = cookies( $jar, 'session' ); sub cookies { my ( $cookie_jar, $name ) = @_; croak 'This function is not part of the OO interface' if $cookie_jar->$_isa( 'HTTP::CookieMonster' ); my $monster = HTTP::CookieMonster->new( $cookie_jar ); if ( !$name ) { if ( !wantarray ) { croak 'Please specify a cookie name when asking for a single cookie'; } return @{ $monster->all_cookies }; } return $monster->get_cookie( $name ); } sub get_cookie { my $self = shift; my $name = shift; my @cookies = (); foreach my $cookie ( $self->all_cookies ) { if ( $cookie->key eq $name ) { return $cookie if !wantarray; push @cookies, $cookie; } } return shift @cookies if !wantarray; return @cookies; } sub set_cookie { my $self = shift; my $cookie = shift; if ( !$cookie->$_isa( 'HTTP::CookieMonster::Cookie' ) ) { croak "$cookie is not a HTTP::CookieMonster::Cookie object"; } return $self->cookie_jar->set_cookie( $cookie->version, $cookie->key, uri_escape( $cookie->val ), $cookie->path, $cookie->domain, $cookie->port, $cookie->path_spec, $cookie->secure, $cookie->expires, $cookie->discard, $cookie->hash ) ? 1 : 0; } sub delete_cookie { my $self = shift; my $cookie = shift; if ( !$cookie->$_isa( 'HTTP::CookieMonster::Cookie' ) ) { croak "$cookie is not a HTTP::CookieMonster::Cookie object"; } $cookie->expires( -1 ); return $self->set_cookie( $cookie ); } sub _check_cookies { my @args = @_; push @_cookies, HTTP::CookieMonster::Cookie->new( version => $args[0], key => $args[1], val => uri_unescape( $args[2] ), path => $args[3], domain => $args[4], port => $args[5], path_spec => $args[6], secure => $args[7], expires => $args[8], discard => $args[9], hash => $args[10], ); return; } 1; # ABSTRACT: Easy read/write access to your jar of HTTP::Cookies # __END__ =pod =encoding UTF-8 =head1 NAME HTTP::CookieMonster - Easy read/write access to your jar of HTTP::Cookies =head1 VERSION version 0.09 =head1 SYNOPSIS # Use the functional interface for quick read-only access use HTTP::CookieMonster qw( cookies ); use WWW::Mechanize; my $mech = WWW::Mechanize->new; my $url = 'http://www.nytimes.com'; $mech->get( $url ); my @cookies = cookies( $mech->cookie_jar ); my $cookie = cookies( $mech->cookie_jar, 'RMID' ); print $cookie->val; # Use the OO interface for read/write access use HTTP::CookieMonster; my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); my $cookie = $monster->get_cookie('RMID'); print $cookie->val; $cookie->val('random stuff'); $monster->set_cookie( $cookie ); # now fetch page using mangled cookie $mech->get( $url ); =head1 DESCRIPTION This module was created because messing around with L is non-trivial. L a very useful module, but using it is not always as easy and clean as it could be. For instance, if you want to find a particular cookie, you can't just ask for it by name. Instead, you have to use a callback: $cookie_jar->scan( \&callback ) The callback will be invoked with 11 positional parameters: 0 version 1 key 2 val 3 path 4 domain 5 port 6 path_spec 7 secure 8 expires 9 discard 10 hash That's a lot to remember and it doesn't make for very readable code. Now, let's say you want to save or update a cookie. Now you're back to the many positional params yet again: $cookie_jar->set_cookie( $version, $key, $val, $path, $domain, $port, $path_spec, $secure, $maxage, $discard, \%rest ) Also not readable. Unless you have an amazing memory, you may find yourself checking the docs regularly to see if you did, in fact, get all those params in the correct order etc. HTTP::CookieMonster gives you a simple interface for getting and setting cookies. You can fetch an ARRAY of all your cookies: my @all_cookies = $monster->all_cookies; foreach my $cookie ( @all_cookies ) { print $cookie->key; print $cookie->val; print $cookie->secure; print $cookie->domain; # etc } Or, if you know for a fact exactly what will be in your cookie jar, you can fetch a cookie by name. my $cookie = $monster->get_cookie( 'plack_session' ); This gives you fast access to a cookie without a callback, iterating over a list etc. It's good for quick hacks and you can dump the cookie quite easily to inspect its contents in a highly readable way: use Data::Printer; p $cookie; If you want to mangle the cookie before the next request, that's easy too. $cookie->val('woohoo'); $monster->set_cookie( $cookie ); $mech->get( $url ); Or, add an entirely new cookie to the jar: use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( key => 'cookie-name', val => 'cookie-val', path => '/', domain => '.somedomain.org', path_spec => 1, secure => 0, expires => 1376081877 ); $monster->set_cookie( $cookie ); $mech->get( $url ); =head2 new new() takes just one required parameter, which is cookie_jar, a valid L object. my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); =head2 cookie_jar A reader which returns an L object. =head2 all_cookies Returns an ARRAY of all cookies in the cookie jar, represented as L objects. my @cookies = $monster->all_cookies; foreach my $cookie ( @cookies ) { print $cookie->key; } =head2 set_cookie( $cookie ) Sets a cookie and updates the cookie jar. Requires a L object. my $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); my $s = $monster->get_cookie('session'); $s->val('random_string'); $monster->set_cookie( $s ); # You can also add an entirely new cookie to the jar via this method use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( key => 'cookie-name', val => 'cookie-val', path => '/', domain => '.somedomain.org', path_spec => 1, secure => 0, expires => 1376081877 ); $monster->set_cookie( $cookie ); =head2 delete_cookie( $cookie ) Deletes a cookie and updates the cookie jar. Requires a L object. =head2 get_cookie( $name ) Be aware that this method may surprise you by what it returns. When called in scalar context, get_cookie() returns the first cookie which exactly matches the name supplied. In many cases this will be exactly what you want, but that won't always be the case. If you are spidering multiple web sites with the same UserAgent object, be aware that you'll likely have cookies from multiple sites in your cookie jar. In this case asking for get_cookie('session') in scalar context may not return the cookie which you were expecting. You will be safer calling get_cookie() in list context: $monster = HTTP::CookieMonster->new( $mech->cookie_jar ); # first cookie with this name my $first_session = $monster->get_cookie('session'); # all cookies with this name my @all_sessions = $monster->get_cookie('session'); =head1 FUNCTIONAL/PROCEDURAL INTERFACE =head2 cookies This function will DWIM. Here are some examples: use HTTP::CookieMonster qw( cookies ); # get all cookies in your jar my @cookies = cookies( $mech->cookie_jar ); # get all cookies of a certain name/key my @session_cookies = cookies( $mech->cookie_jar, 'session_cookie_name' ); # get the first cookie of a certain name/key my $first_session_cookie = cookies( $mech->cookie_jar, 'session_cookie_name' ); =for Pod::Coverage BUILDARGS =head1 AUTHOR Olaf Alders =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Olaf Alders. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut HTTP-CookieMonster-0.09/lib/HTTP/CookieMonster/Cookie.pm000644 000765 000024 00000006565 12434646611 022764 0ustar00olafstaff000000 000000 use strict; use warnings; package HTTP::CookieMonster::Cookie; $HTTP::CookieMonster::Cookie::VERSION = '0.09'; use Moo; # in order of args required in $cookie_jar->scan callback has 'version' => ( is => 'rw', ); has 'key' => ( is => 'rw', ); has 'val' => ( is => 'rw', ); has 'path' => ( is => 'rw', ); has 'domain' => ( is => 'rw', ); has 'port' => ( is => 'rw', ); has 'path_spec' => ( is => 'rw', ); has 'secure' => ( is => 'rw', ); has 'expires' => ( is => 'rw', ); has 'discard' => ( is => 'rw', ); has 'hash' => ( is => 'rw', ); 1; # ABSTRACT: Cookie representation used by HTTP::CookieMonster __END__ =pod =encoding UTF-8 =head1 NAME HTTP::CookieMonster::Cookie - Cookie representation used by HTTP::CookieMonster =head1 VERSION version 0.09 =head1 SYNOPSIS use HTTP::CookieMonster::Cookie; my $cookie = HTTP::CookieMonster::Cookie->new( key => 'cookie-name', val => 'cookie-val', path => '/', domain => '.somedomain.org', path_spec => 1, secure => 0, expires => 1376081877 ); use WWW::Mechanize; use HTTP::CookieMonster; my $mech = WWW::Mechanize->new; my $monster = HTTP::CookieMonster->new( cookie_jar => $mech->cookie_jar ); $monster->set_cookie( $cookie ); $mech->get( $url ); # passes $cookie in request =head1 DESCRIPTION This module is intended to be used by L to represent cookies found in an L cookie_jar. To keep things familiar, I have chosen method names which reflect the positional parameter names laid out in the $cookie_jar->scan( \&callback ) documentation. Not being intimately familiar with the HTTP cookie spec, I haven't forced validation or default values on any attributes, so please be aware that the burden is on the user to provide "correct" data if you are using this module directly. I have provided some sample values below. To get a better idea of what is required, try visiting a few sites and dumping their cookies. use Data::Printer; my $mech = WWW::Mechanize->new; $mech->get( 'http://www.google.ca' ); my $monster = HTTP::CookieMonster->new( cookie_jar => $mech->cookie_jar ); p $monster->all_cookies; =head2 version $cookie->version( 0 ); =head2 key The name of the cookie. $cookie->key( "session_id" ); =head2 val The value of the cookie. $cookie->val( "random_stuff" ); If you are creating a new cookie, you should escape the value first. use URI::Escape qw( uri_escape ); $cookie->value( uri_escape( 'random_stuff' ) ); =head2 path $cookie->path( "/" ); =head2 domain $cookie->domain( ".google.ca" ); =head2 port =head2 path_spec $cookie->path_spec( 1 ); =head2 secure $cookie->secure( 1 ); =head2 expires $cookie->expires( 1407696193 ); =head2 discard =head2 hash $cookie->hash( { HttpOnly => undef } ); =head1 SEE ALSO This is mainly useful for creating cookies to be used by L and L. If you need to create cookies to set via headers, have a look at L. =head1 AUTHOR Olaf Alders =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Olaf Alders. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut HTTP-CookieMonster-0.09/examples/read_cookies.pl000644 000765 000024 00000000710 12434646611 021673 0ustar00olafstaff000000 000000 #!/usr/bin/env perl use strict; use warnings; use HTTP::CookieMonster qw( cookies ); use URI::Heuristic qw(uf_uristr); use WWW::Mechanize; die "usage perl examples/read_cookies.pl http://www.nytimes.com" if !@ARGV; my $url = uf_uristr( shift @ARGV ); my $mech = WWW::Mechanize->new; $mech->get( $url ); my @cookies = cookies( $mech->cookie_jar ); foreach my $cookie ( @cookies ) { printf( "name: %s\tvalue: %s\n", $cookie->key, $cookie->val ); }