Import upstream version 0.012+git20210616.1.88d5313
Debian Janitor
2 years ago
0 | autocmd BufWritePre *.pl,*.pm,*.t call DoTidyWrite() |
0 | # DAGOLDEN .perltidyrc file | |
1 | ||
2 | -se # Errors to STDERR | |
3 | ||
4 | -l=85 # Max line width target | |
5 | -vmll # variable maximum line length | |
6 | -wc=10 # depth to reduce indentation levels | |
7 | -i=4 # Indent level | |
8 | -ci=2 # Continuation | |
9 | ||
10 | -vt=0 # vertical tightness | |
11 | -cti=0 # extra indentation for closing brackets | |
12 | -vtc=0 # close parens on own line if possible | |
13 | ||
14 | -nsot # stack opening | |
15 | -nsct # stack closing | |
16 | ||
17 | -notr # opening tokens on right of a line | |
18 | -pt=1 # parenthesis tightness | |
19 | -bt=1 # brace tightness | |
20 | -sbt=1 # square bracket tightness | |
21 | -bbt=0 # block brace tightness | |
22 | #-boc # break at old comma breakpoints | |
23 | -cab=1 | |
24 | ||
25 | -nsfp # no space after function | |
26 | -nsfs # No space before semicolons in for loops | |
27 | ||
28 | -nolq # Don't outdent long quoted strings | |
29 | -nola # Don't outdent labels | |
30 | -nolc # Don't outdent long comments | |
31 | -nokw # Don't outdent keywords | |
32 | -nhsc # Don't expect hanging side comments | |
33 | -nbbc # No blank before comments | |
34 | -tso # Tight secret operators | |
35 | ||
36 | -msc=1 # Space to side comment | |
37 | ||
38 | #-wbb="% + - * / x != == >= <= =~ !~ < > | & = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=" | |
39 | -wbb="% + - * / x != == >= <= =~ !~ < > | &" | |
40 | # Break before all operators except assignment | |
41 | ||
42 | -ole=unix # line endings | |
43 |
0 | 0 | Revision history for HTTP-CookieJar |
1 | ||
2 | {{$NEXT}} | |
3 | ||
4 | 0.012 2021-06-16 05:34:31-04:00 America/New_York | |
5 | ||
6 | - No changes from 0.011 | |
7 | ||
8 | 0.011 2021-06-15 19:29:51-04:00 America/New_York (TRIAL RELEASE) | |
9 | ||
10 | [FIXED] | |
11 | ||
12 | - Pushed test cookie expiration dates from 2021 to 2041. | |
13 | If I'm still maintaining this module in 2041, I'll bump | |
14 | them again then. | |
1 | 15 | |
2 | 16 | 0.010 2020-09-20 11:28:49-04:00 America/New_York |
3 | 17 |
0 | This software is Copyright (c) 2013 by David Golden. | |
1 | ||
2 | This is free software, licensed under: | |
3 | ||
4 | The Apache License, Version 2.0, January 2004 | |
5 | ||
6 | Apache License | |
7 | Version 2.0, January 2004 | |
8 | http://www.apache.org/licenses/ | |
9 | ||
10 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION | |
11 | ||
12 | 1. Definitions. | |
13 | ||
14 | "License" shall mean the terms and conditions for use, reproduction, | |
15 | and distribution as defined by Sections 1 through 9 of this document. | |
16 | ||
17 | "Licensor" shall mean the copyright owner or entity authorized by | |
18 | the copyright owner that is granting the License. | |
19 | ||
20 | "Legal Entity" shall mean the union of the acting entity and all | |
21 | other entities that control, are controlled by, or are under common | |
22 | control with that entity. For the purposes of this definition, | |
23 | "control" means (i) the power, direct or indirect, to cause the | |
24 | direction or management of such entity, whether by contract or | |
25 | otherwise, or (ii) ownership of fifty percent (50%) or more of the | |
26 | outstanding shares, or (iii) beneficial ownership of such entity. | |
27 | ||
28 | "You" (or "Your") shall mean an individual or Legal Entity | |
29 | exercising permissions granted by this License. | |
30 | ||
31 | "Source" form shall mean the preferred form for making modifications, | |
32 | including but not limited to software source code, documentation | |
33 | source, and configuration files. | |
34 | ||
35 | "Object" form shall mean any form resulting from mechanical | |
36 | transformation or translation of a Source form, including but | |
37 | not limited to compiled object code, generated documentation, | |
38 | and conversions to other media types. | |
39 | ||
40 | "Work" shall mean the work of authorship, whether in Source or | |
41 | Object form, made available under the License, as indicated by a | |
42 | copyright notice that is included in or attached to the work | |
43 | (an example is provided in the Appendix below). | |
44 | ||
45 | "Derivative Works" shall mean any work, whether in Source or Object | |
46 | form, that is based on (or derived from) the Work and for which the | |
47 | editorial revisions, annotations, elaborations, or other modifications | |
48 | represent, as a whole, an original work of authorship. For the purposes | |
49 | of this License, Derivative Works shall not include works that remain | |
50 | separable from, or merely link (or bind by name) to the interfaces of, | |
51 | the Work and Derivative Works thereof. | |
52 | ||
53 | "Contribution" shall mean any work of authorship, including | |
54 | the original version of the Work and any modifications or additions | |
55 | to that Work or Derivative Works thereof, that is intentionally | |
56 | submitted to Licensor for inclusion in the Work by the copyright owner | |
57 | or by an individual or Legal Entity authorized to submit on behalf of | |
58 | the copyright owner. For the purposes of this definition, "submitted" | |
59 | means any form of electronic, verbal, or written communication sent | |
60 | to the Licensor or its representatives, including but not limited to | |
61 | communication on electronic mailing lists, source code control systems, | |
62 | and issue tracking systems that are managed by, or on behalf of, the | |
63 | Licensor for the purpose of discussing and improving the Work, but | |
64 | excluding communication that is conspicuously marked or otherwise | |
65 | designated in writing by the copyright owner as "Not a Contribution." | |
66 | ||
67 | "Contributor" shall mean Licensor and any individual or Legal Entity | |
68 | on behalf of whom a Contribution has been received by Licensor and | |
69 | subsequently incorporated within the Work. | |
70 | ||
71 | 2. Grant of Copyright License. Subject to the terms and conditions of | |
72 | this License, each Contributor hereby grants to You a perpetual, | |
73 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
74 | copyright license to reproduce, prepare Derivative Works of, | |
75 | publicly display, publicly perform, sublicense, and distribute the | |
76 | Work and such Derivative Works in Source or Object form. | |
77 | ||
78 | 3. Grant of Patent License. Subject to the terms and conditions of | |
79 | this License, each Contributor hereby grants to You a perpetual, | |
80 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable | |
81 | (except as stated in this section) patent license to make, have made, | |
82 | use, offer to sell, sell, import, and otherwise transfer the Work, | |
83 | where such license applies only to those patent claims licensable | |
84 | by such Contributor that are necessarily infringed by their | |
85 | Contribution(s) alone or by combination of their Contribution(s) | |
86 | with the Work to which such Contribution(s) was submitted. If You | |
87 | institute patent litigation against any entity (including a | |
88 | cross-claim or counterclaim in a lawsuit) alleging that the Work | |
89 | or a Contribution incorporated within the Work constitutes direct | |
90 | or contributory patent infringement, then any patent licenses | |
91 | granted to You under this License for that Work shall terminate | |
92 | as of the date such litigation is filed. | |
93 | ||
94 | 4. Redistribution. You may reproduce and distribute copies of the | |
95 | Work or Derivative Works thereof in any medium, with or without | |
96 | modifications, and in Source or Object form, provided that You | |
97 | meet the following conditions: | |
98 | ||
99 | (a) You must give any other recipients of the Work or | |
100 | Derivative Works a copy of this License; and | |
101 | ||
102 | (b) You must cause any modified files to carry prominent notices | |
103 | stating that You changed the files; and | |
104 | ||
105 | (c) You must retain, in the Source form of any Derivative Works | |
106 | that You distribute, all copyright, patent, trademark, and | |
107 | attribution notices from the Source form of the Work, | |
108 | excluding those notices that do not pertain to any part of | |
109 | the Derivative Works; and | |
110 | ||
111 | (d) If the Work includes a "NOTICE" text file as part of its | |
112 | distribution, then any Derivative Works that You distribute must | |
113 | include a readable copy of the attribution notices contained | |
114 | within such NOTICE file, excluding those notices that do not | |
115 | pertain to any part of the Derivative Works, in at least one | |
116 | of the following places: within a NOTICE text file distributed | |
117 | as part of the Derivative Works; within the Source form or | |
118 | documentation, if provided along with the Derivative Works; or, | |
119 | within a display generated by the Derivative Works, if and | |
120 | wherever such third-party notices normally appear. The contents | |
121 | of the NOTICE file are for informational purposes only and | |
122 | do not modify the License. You may add Your own attribution | |
123 | notices within Derivative Works that You distribute, alongside | |
124 | or as an addendum to the NOTICE text from the Work, provided | |
125 | that such additional attribution notices cannot be construed | |
126 | as modifying the License. | |
127 | ||
128 | You may add Your own copyright statement to Your modifications and | |
129 | may provide additional or different license terms and conditions | |
130 | for use, reproduction, or distribution of Your modifications, or | |
131 | for any such Derivative Works as a whole, provided Your use, | |
132 | reproduction, and distribution of the Work otherwise complies with | |
133 | the conditions stated in this License. | |
134 | ||
135 | 5. Submission of Contributions. Unless You explicitly state otherwise, | |
136 | any Contribution intentionally submitted for inclusion in the Work | |
137 | by You to the Licensor shall be under the terms and conditions of | |
138 | this License, without any additional terms or conditions. | |
139 | Notwithstanding the above, nothing herein shall supersede or modify | |
140 | the terms of any separate license agreement you may have executed | |
141 | with Licensor regarding such Contributions. | |
142 | ||
143 | 6. Trademarks. This License does not grant permission to use the trade | |
144 | names, trademarks, service marks, or product names of the Licensor, | |
145 | except as required for reasonable and customary use in describing the | |
146 | origin of the Work and reproducing the content of the NOTICE file. | |
147 | ||
148 | 7. Disclaimer of Warranty. Unless required by applicable law or | |
149 | agreed to in writing, Licensor provides the Work (and each | |
150 | Contributor provides its Contributions) on an "AS IS" BASIS, | |
151 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
152 | implied, including, without limitation, any warranties or conditions | |
153 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A | |
154 | PARTICULAR PURPOSE. You are solely responsible for determining the | |
155 | appropriateness of using or redistributing the Work and assume any | |
156 | risks associated with Your exercise of permissions under this License. | |
157 | ||
158 | 8. Limitation of Liability. In no event and under no legal theory, | |
159 | whether in tort (including negligence), contract, or otherwise, | |
160 | unless required by applicable law (such as deliberate and grossly | |
161 | negligent acts) or agreed to in writing, shall any Contributor be | |
162 | liable to You for damages, including any direct, indirect, special, | |
163 | incidental, or consequential damages of any character arising as a | |
164 | result of this License or out of the use or inability to use the | |
165 | Work (including but not limited to damages for loss of goodwill, | |
166 | work stoppage, computer failure or malfunction, or any and all | |
167 | other commercial damages or losses), even if such Contributor | |
168 | has been advised of the possibility of such damages. | |
169 | ||
170 | 9. Accepting Warranty or Additional Liability. While redistributing | |
171 | the Work or Derivative Works thereof, You may choose to offer, | |
172 | and charge a fee for, acceptance of support, warranty, indemnity, | |
173 | or other liability obligations and/or rights consistent with this | |
174 | License. However, in accepting such obligations, You may act only | |
175 | on Your own behalf and on Your sole responsibility, not on behalf | |
176 | of any other Contributor, and only if You agree to indemnify, | |
177 | defend, and hold each Contributor harmless for any liability | |
178 | incurred by, or claims asserted against, such Contributor by reason | |
179 | of your accepting any such warranty or additional liability. | |
180 | ||
181 | END OF TERMS AND CONDITIONS | |
182 | ||
183 | APPENDIX: How to apply the Apache License to your work. | |
184 | ||
185 | To apply the Apache License to your work, attach the following | |
186 | boilerplate notice, with the fields enclosed by brackets "[]" | |
187 | replaced with your own identifying information. (Don't include | |
188 | the brackets!) The text should be enclosed in the appropriate | |
189 | comment syntax for the file format. We also recommend that a | |
190 | file or class name and description of purpose be included on the | |
191 | same "printed page" as the copyright notice for easier | |
192 | identification within third-party archives. | |
193 | ||
194 | Copyright [yyyy] [name of copyright owner] | |
195 | ||
196 | Licensed under the Apache License, Version 2.0 (the "License"); | |
197 | you may not use this file except in compliance with the License. | |
198 | You may obtain a copy of the License at | |
199 | ||
200 | http://www.apache.org/licenses/LICENSE-2.0 | |
201 | ||
202 | Unless required by applicable law or agreed to in writing, software | |
203 | distributed under the License is distributed on an "AS IS" BASIS, | |
204 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
205 | See the License for the specific language governing permissions and | |
206 | limitations under the License. |
0 | # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.015. | |
0 | .local.vimrc | |
1 | .perltidyrc | |
2 | Changes | |
1 | 3 | CONTRIBUTING.mkdn |
2 | Changes | |
3 | LICENSE | |
4 | MANIFEST | |
5 | META.json | |
6 | META.yml | |
7 | Makefile.PL | |
8 | README | |
9 | cpanfile | |
10 | 4 | dist.ini |
5 | HTTP-CookieJar-0.013/META.json | |
6 | HTTP-CookieJar-0.013/META.yml | |
11 | 7 | lib/HTTP/CookieJar.pm |
12 | 8 | lib/HTTP/CookieJar/LWP.pm |
9 | Makefile.PL | |
10 | MANIFEST This list of files | |
13 | 11 | perlcritic.rc |
14 | t/00-report-prereqs.dd | |
15 | t/00-report-prereqs.t | |
12 | README.mkdn | |
16 | 13 | t/add.t |
17 | 14 | t/examples.t |
18 | 15 | t/lib/MockTime.pm |
22 | 19 | t/sort.t |
23 | 20 | t/zzz-lwp.t |
24 | 21 | tidyall.ini |
25 | xt/author/00-compile.t | |
26 | xt/author/critic.t | |
27 | xt/author/minimum-version.t | |
28 | xt/author/pod-coverage.t | |
29 | xt/author/pod-spell.t | |
30 | xt/author/pod-syntax.t | |
31 | xt/author/portability.t | |
32 | xt/author/test-version.t | |
33 | xt/release/distmeta.t | |
22 | META.yml Module YAML meta-data (added by MakeMaker) | |
23 | META.json Module JSON meta-data (added by MakeMaker) |
2 | 2 | "author" : [ |
3 | 3 | "David Golden <dagolden@cpan.org>" |
4 | 4 | ], |
5 | "dynamic_config" : 0, | |
6 | "generated_by" : "Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010", | |
5 | "dynamic_config" : 1, | |
6 | "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", | |
7 | 7 | "license" : [ |
8 | 8 | "apache_2_0" |
9 | 9 | ], |
14 | 14 | "name" : "HTTP-CookieJar", |
15 | 15 | "no_index" : { |
16 | 16 | "directory" : [ |
17 | "corpus", | |
18 | "examples", | |
19 | 17 | "t", |
20 | "xt" | |
21 | ], | |
22 | "package" : [ | |
23 | "DB" | |
18 | "inc" | |
24 | 19 | ] |
25 | 20 | }, |
26 | 21 | "prereqs" : { |
22 | "build" : { | |
23 | "requires" : { | |
24 | "ExtUtils::MakeMaker" : "0" | |
25 | } | |
26 | }, | |
27 | 27 | "configure" : { |
28 | 28 | "requires" : { |
29 | "ExtUtils::MakeMaker" : "6.17", | |
30 | "perl" : "5.008001" | |
31 | } | |
32 | }, | |
33 | "develop" : { | |
34 | "requires" : { | |
35 | "Dist::Zilla" : "5", | |
36 | "Dist::Zilla::Plugin::Prereqs" : "0", | |
37 | "Dist::Zilla::Plugin::ReleaseStatus::FromVersion" : "0", | |
38 | "Dist::Zilla::Plugin::RemovePrereqs" : "0", | |
39 | "Dist::Zilla::PluginBundle::DAGOLDEN" : "0.072", | |
40 | "File::Spec" : "0", | |
41 | "File::Temp" : "0", | |
42 | "IO::Handle" : "0", | |
43 | "IPC::Open3" : "0", | |
44 | "Pod::Coverage::TrustPod" : "0", | |
45 | "Pod::Wordlist" : "0", | |
46 | "Software::License::Apache_2_0" : "0", | |
47 | "Test::CPAN::Meta" : "0", | |
48 | "Test::MinimumVersion" : "0", | |
49 | "Test::More" : "0", | |
50 | "Test::Perl::Critic" : "0", | |
51 | "Test::Pod" : "1.41", | |
52 | "Test::Pod::Coverage" : "1.08", | |
53 | "Test::Portability::Files" : "0", | |
54 | "Test::Spelling" : "0.12", | |
55 | "Test::Version" : "1" | |
29 | "ExtUtils::MakeMaker" : "6.17" | |
56 | 30 | } |
57 | 31 | }, |
58 | 32 | "runtime" : { |
59 | "recommends" : { | |
60 | "Mozilla::PublicSuffix" : "0" | |
61 | }, | |
62 | 33 | "requires" : { |
63 | 34 | "Carp" : "0", |
64 | 35 | "HTTP::Date" : "0", |
70 | 41 | } |
71 | 42 | }, |
72 | 43 | "test" : { |
73 | "recommends" : { | |
74 | "CPAN::Meta" : "2.120900" | |
75 | }, | |
76 | 44 | "requires" : { |
77 | 45 | "ExtUtils::MakeMaker" : "0", |
78 | 46 | "File::Spec" : "0", |
81 | 49 | "Test::Requires" : "0", |
82 | 50 | "Time::Local" : "1.1901", |
83 | 51 | "URI" : "0", |
84 | "lib" : "0", | |
85 | "perl" : "5.008001" | |
52 | "lib" : "0" | |
86 | 53 | } |
87 | 54 | } |
88 | 55 | }, |
89 | "provides" : { | |
90 | "HTTP::CookieJar" : { | |
91 | "file" : "lib/HTTP/CookieJar.pm", | |
92 | "version" : "0.010" | |
93 | }, | |
94 | "HTTP::CookieJar::LWP" : { | |
95 | "file" : "lib/HTTP/CookieJar/LWP.pm", | |
96 | "version" : "0.010" | |
97 | } | |
98 | }, | |
99 | 56 | "release_status" : "stable", |
100 | "resources" : { | |
101 | "bugtracker" : { | |
102 | "web" : "https://github.com/dagolden/HTTP-CookieJar/issues" | |
103 | }, | |
104 | "homepage" : "https://github.com/dagolden/HTTP-CookieJar", | |
105 | "repository" : { | |
106 | "type" : "git", | |
107 | "url" : "https://github.com/dagolden/HTTP-CookieJar.git", | |
108 | "web" : "https://github.com/dagolden/HTTP-CookieJar" | |
109 | } | |
110 | }, | |
111 | "version" : "0.010", | |
112 | "x_authority" : "cpan:DAGOLDEN", | |
113 | "x_contributors" : [ | |
114 | "Dan Book <grinnz@grinnz.com>", | |
115 | "David Golden <xdg@xdg.me>", | |
116 | "jvolkening <jdv@base2bio.com>" | |
117 | ], | |
118 | "x_generated_by_perl" : "v5.32.0", | |
119 | "x_serialization_backend" : "Cpanel::JSON::XS version 4.19", | |
120 | "x_spdx_expression" : "Apache-2.0" | |
57 | "version" : "0.013", | |
58 | "x_serialization_backend" : "JSON::PP version 4.04" | |
121 | 59 | } |
122 |
10 | 10 | Time::Local: '1.1901' |
11 | 11 | URI: '0' |
12 | 12 | lib: '0' |
13 | perl: '5.008001' | |
14 | 13 | configure_requires: |
15 | 14 | ExtUtils::MakeMaker: '6.17' |
16 | perl: '5.008001' | |
17 | dynamic_config: 0 | |
18 | generated_by: 'Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010' | |
15 | dynamic_config: 1 | |
16 | generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' | |
19 | 17 | license: apache |
20 | 18 | meta-spec: |
21 | 19 | url: http://module-build.sourceforge.net/META-spec-v1.4.html |
23 | 21 | name: HTTP-CookieJar |
24 | 22 | no_index: |
25 | 23 | directory: |
26 | - corpus | |
27 | - examples | |
28 | 24 | - t |
29 | - xt | |
30 | package: | |
31 | - DB | |
32 | provides: | |
33 | HTTP::CookieJar: | |
34 | file: lib/HTTP/CookieJar.pm | |
35 | version: '0.010' | |
36 | HTTP::CookieJar::LWP: | |
37 | file: lib/HTTP/CookieJar/LWP.pm | |
38 | version: '0.010' | |
39 | recommends: | |
40 | Mozilla::PublicSuffix: '0' | |
25 | - inc | |
41 | 26 | requires: |
42 | 27 | Carp: '0' |
43 | 28 | HTTP::Date: '0' |
46 | 31 | perl: '5.008001' |
47 | 32 | strict: '0' |
48 | 33 | warnings: '0' |
49 | resources: | |
50 | bugtracker: https://github.com/dagolden/HTTP-CookieJar/issues | |
51 | homepage: https://github.com/dagolden/HTTP-CookieJar | |
52 | repository: https://github.com/dagolden/HTTP-CookieJar.git | |
53 | version: '0.010' | |
54 | x_authority: cpan:DAGOLDEN | |
55 | x_contributors: | |
56 | - 'Dan Book <grinnz@grinnz.com>' | |
57 | - 'David Golden <xdg@xdg.me>' | |
58 | - 'jvolkening <jdv@base2bio.com>' | |
59 | x_generated_by_perl: v5.32.0 | |
60 | x_serialization_backend: 'YAML::Tiny version 1.73' | |
61 | x_spdx_expression: Apache-2.0 | |
34 | version: '0.013' | |
35 | x_serialization_backend: 'CPAN::Meta::YAML version 0.018' |
0 | # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.015. | |
1 | 0 | use strict; |
2 | 1 | use warnings; |
3 | 2 | |
33 | 32 | "URI" => 0, |
34 | 33 | "lib" => 0 |
35 | 34 | }, |
36 | "VERSION" => "0.010", | |
35 | "VERSION" => "0.013", | |
37 | 36 | "test" => { |
38 | 37 | "TESTS" => "t/*.t" |
39 | 38 | } |
0 | NAME | |
1 | HTTP::CookieJar - A minimalist HTTP user agent cookie jar | |
2 | ||
3 | VERSION | |
4 | version 0.010 | |
5 | ||
6 | SYNOPSIS | |
7 | use HTTP::CookieJar; | |
8 | ||
9 | my $jar = HTTP::CookieJar->new; | |
10 | ||
11 | # add cookie received from a request | |
12 | $jar->add( "http://www.example.com/", "CUSTOMER=WILE_E_COYOTE; Path=/; Domain=example.com" ); | |
13 | ||
14 | # extract cookie header for a given request | |
15 | my $cookie = $jar->cookie_header( "http://www.example.com/" ); | |
16 | ||
17 | DESCRIPTION | |
18 | This module implements a minimalist HTTP user agent cookie jar in | |
19 | conformance with RFC 6265 <http://tools.ietf.org/html/rfc6265>. | |
20 | ||
21 | Unlike the commonly used HTTP::Cookies module, this module does not | |
22 | require use of HTTP::Request and HTTP::Response objects. An | |
23 | LWP-compatible adapter is available as HTTP::CookieJar::LWP. | |
24 | ||
25 | CONSTRUCTORS | |
26 | new | |
27 | my $jar = HTTP::CookieJar->new; | |
28 | ||
29 | Return a new, empty cookie jar | |
30 | ||
31 | METHODS | |
32 | add | |
33 | $jar->add( | |
34 | "http://www.example.com/", "lang=en-US; Path=/; Domain=example.com" | |
35 | ); | |
36 | ||
37 | Given a request URL and a "Set-Cookie" header string, attempts to adds | |
38 | the cookie to the jar. If the cookie is expired, instead it deletes any | |
39 | matching cookie from the jar. A "Max-Age" attribute will be converted to | |
40 | an absolute "Expires" attribute. | |
41 | ||
42 | It will throw an exception if the request URL is missing or invalid. | |
43 | Returns true if successful cookie processing or undef/empty-list on | |
44 | failure. | |
45 | ||
46 | clear | |
47 | $jar->clear | |
48 | ||
49 | Empties the cookie jar. | |
50 | ||
51 | cookies_for | |
52 | my @cookies = $jar->cookies_for("http://www.example.com/foo/bar"); | |
53 | ||
54 | Given a request URL, returns a list of hash references representing | |
55 | cookies that should be sent. The hash references are copies -- changing | |
56 | values will not change the cookies in the jar. | |
57 | ||
58 | Cookies set "secure" will only be returned if the request scheme is | |
59 | "https". Expired cookies will not be returned. | |
60 | ||
61 | Keys of a cookie hash reference might include: | |
62 | ||
63 | * name -- the name of the cookie | |
64 | ||
65 | * value -- the value of the cookie | |
66 | ||
67 | * domain -- the domain name to which the cookie applies | |
68 | ||
69 | * path -- the path to which the cookie applies | |
70 | ||
71 | * expires -- if present, when the cookie expires in epoch seconds | |
72 | ||
73 | * secure -- if present, the cookie was set "Secure" | |
74 | ||
75 | * httponly -- if present, the cookie was set "HttpOnly" | |
76 | ||
77 | * hostonly -- if present, the cookie may only be used with the domain | |
78 | as a host | |
79 | ||
80 | * creation_time -- epoch seconds since the cookie was first stored | |
81 | ||
82 | * last_access_time -- epoch seconds since the cookie was last stored | |
83 | ||
84 | Keep in mind that "httponly" means it should only be used in requests | |
85 | and not made available via Javascript, etc. This is pretty meaningless | |
86 | for Perl user agents. | |
87 | ||
88 | Generally, user agents should use the "cookie_header" method instead. | |
89 | ||
90 | It will throw an exception if the request URL is missing or invalid. | |
91 | ||
92 | cookie_header | |
93 | my $header = $jar->cookie_header("http://www.example.com/foo/bar"); | |
94 | ||
95 | Given a request URL, returns a correctly-formatted string with all | |
96 | relevant cookies for the request. This string is ready to be used in a | |
97 | "Cookie" header in an HTTP request. E.g.: | |
98 | ||
99 | SID=31d4d96e407aad42; lang=en-US | |
100 | ||
101 | It follows the same exclusion rules as "cookies_for". | |
102 | ||
103 | If the request is invalid or no cookies apply, it will return an empty | |
104 | string. | |
105 | ||
106 | dump_cookies | |
107 | my @list = $jar->dump_cookies; | |
108 | my @list = $jar->dump_cookies( { persistent => 1 } ); | |
109 | ||
110 | Returns a list of raw cookies in string form. The strings resemble what | |
111 | would be received from "Set-Cookie" headers, but with additional | |
112 | internal fields. The list is only intended for use with "load_cookies" | |
113 | to allow cookie jar persistence. | |
114 | ||
115 | If a hash reference with a true "persistent" key is given as an | |
116 | argument, cookies without an "Expires" time (i.e. "session cookies") | |
117 | will be omitted. | |
118 | ||
119 | Here is a trivial example of saving a cookie jar file with Path::Tiny: | |
120 | ||
121 | path("jar.txt")->spew( join "\n", $jar->dump_cookies ); | |
122 | ||
123 | load_cookies | |
124 | $jar->load_cookies( @cookies ); | |
125 | ||
126 | Given a list of cookie strings from "dump_cookies", it adds them to the | |
127 | cookie jar. Cookies added in this way will supersede any existing | |
128 | cookies with similar domain, path and name. | |
129 | ||
130 | It returns the jar object for convenience when loading a new object: | |
131 | ||
132 | my $jar = HTTP::CookieJar->new->load_cookies( @cookies ); | |
133 | ||
134 | Here is a trivial example of loading a cookie jar file with Path::Tiny: | |
135 | ||
136 | my $jar = HTTP::CookieJar->new->load_cookies( | |
137 | path("jar.txt")->lines | |
138 | ); | |
139 | ||
140 | LIMITATIONS AND CAVEATS | |
141 | RFC 6265 vs prior standards | |
142 | This modules adheres as closely as possible to the user-agent rules of | |
143 | RFC 6265. Therefore, it does not handle nor generate "Set-Cookie2" and | |
144 | "Cookie2" headers, implement ".local" suffixes, or do path/domain | |
145 | matching in accord with prior RFC's. | |
146 | ||
147 | Internationalized domain names | |
148 | Internationalized domain names given in requests must be properly | |
149 | encoded in ASCII form. | |
150 | ||
151 | Public suffixes | |
152 | If Mozilla::PublicSuffix is installed, cookie domains will be checked | |
153 | against the public suffix list. Public suffix cookies are only allowed | |
154 | as host-only cookies. | |
155 | ||
156 | Third-party cookies | |
157 | According to RFC 6265, a cookie may be accepted only if has no "Domain" | |
158 | attribute (in which case it is "host-only") or if the "Domain" attribute | |
159 | is a suffix of the request URL. This effectively prohibits Site A from | |
160 | setting a cookie for unrelated Site B, which is one potential | |
161 | third-party cookie vector. | |
162 | ||
163 | SEE ALSO | |
164 | * HTTP::Cookies | |
165 | ||
166 | * Mojo::UserAgent::CookieJar | |
167 | ||
168 | AUTHOR | |
169 | David Golden <dagolden@cpan.org> | |
170 | ||
171 | CONTRIBUTORS | |
172 | * Dan Book <grinnz@grinnz.com> | |
173 | ||
174 | * David Golden <xdg@xdg.me> | |
175 | ||
176 | * jvolkening <jdv@base2bio.com> | |
177 | ||
178 | COPYRIGHT AND LICENSE | |
179 | This software is Copyright (c) 2013 by David Golden. | |
180 | ||
181 | This is free software, licensed under: | |
182 | ||
183 | The Apache License, Version 2.0, January 2004 | |
184 |
0 | ## HOW TO CONTRIBUTE | |
1 | ||
2 | Thank you for considering contributing to this distribution. This file | |
3 | contains instructions that will help you work with the source code. | |
4 | ||
5 | The distribution is managed with Dist::Zilla. This means that many of the | |
6 | usual files you might expect are not in the repository, but are generated at | |
7 | release time, as is much of the documentation. Some generated files are | |
8 | kept in the repository as a convenience (e.g. Makefile.PL or cpanfile). | |
9 | ||
10 | Generally, **you do not need Dist::Zilla to contribute patches**. You do need | |
11 | Dist::Zilla to create a tarball. See below for guidance. | |
12 | ||
13 | ### Getting dependencies | |
14 | ||
15 | If you have App::cpanminus 1.6 or later installed, you can use `cpanm` to | |
16 | satisfy dependencies like this: | |
17 | ||
18 | $ cpanm --installdeps . | |
19 | ||
20 | Otherwise, look for either a `Makefile.PL` or `cpanfile` file for | |
21 | a list of dependencies to satisfy. | |
22 | ||
23 | ### Running tests | |
24 | ||
25 | You can run tests directly using the `prove` tool: | |
26 | ||
27 | $ prove -l | |
28 | $ prove -lv t/some_test_file.t | |
29 | ||
30 | For most of my distributions, `prove` is entirely sufficient for you to test any | |
31 | patches you have. I use `prove` for 99% of my testing during development. | |
32 | ||
33 | ### Code style and tidying | |
34 | ||
35 | Please try to match any existing coding style. If there is a `.perltidyrc` | |
36 | file, please install Perl::Tidy and use perltidy before submitting patches. | |
37 | ||
38 | If there is a `tidyall.ini` file, you can also install Code::TidyAll and run | |
39 | `tidyall` on a file or `tidyall -a` to tidy all files. | |
40 | ||
41 | ### Patching documentation | |
42 | ||
43 | Much of the documentation Pod is generated at release time. Some is | |
44 | generated boilerplate; other documentation is built from pseudo-POD | |
45 | directives in the source like C<=method> or C<=func>. | |
46 | ||
47 | If you would like to submit a documentation edit, please limit yourself to | |
48 | the documentation you see. | |
49 | ||
50 | If you see typos or documentation issues in the generated docs, please | |
51 | email or open a bug ticket instead of patching. | |
52 | ||
53 | ### Where to send patches and pull requests | |
54 | ||
55 | If you found this distribution on Github, sending a pull-request is the | |
56 | best way to contribute. | |
57 | ||
58 | If a pull-request isn't possible, a bug ticket with a patch file is the | |
59 | next best option. | |
60 | ||
61 | As a last resort, an email to the author(s) is acceptable. | |
62 | ||
63 | ## Installing and using Dist::Zilla | |
64 | ||
65 | Dist::Zilla is not required for contributing, but if you'd like to learn | |
66 | more, this section will get you up to speed. | |
67 | ||
68 | Dist::Zilla is a very powerful authoring tool, optimized for maintaining a | |
69 | large number of distributions with a high degree of automation, but it has a | |
70 | large dependency chain, a bit of a learning curve and requires a number of | |
71 | author-specific plugins. | |
72 | ||
73 | To install it from CPAN, I recommend one of the following approaches for | |
74 | the quickest installation: | |
75 | ||
76 | # using CPAN.pm, but bypassing non-functional pod tests | |
77 | $ cpan TAP::Harness::Restricted | |
78 | $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla | |
79 | ||
80 | # using cpanm, bypassing *all* tests | |
81 | $ cpanm -n Dist::Zilla | |
82 | ||
83 | In either case, it's probably going to take about 10 minutes. Go for a walk, | |
84 | go get a cup of your favorite beverage, take a bathroom break, or whatever. | |
85 | When you get back, Dist::Zilla should be ready for you. | |
86 | ||
87 | Then you need to install any plugins specific to this distribution: | |
88 | ||
89 | $ cpan `dzil authordeps` | |
90 | $ dzil authordeps | cpanm | |
91 | ||
92 | Once installed, here are some dzil commands you might try: | |
93 | ||
94 | $ dzil build | |
95 | $ dzil test | |
96 | $ dzil xtest | |
97 | ||
98 | You can learn more about Dist::Zilla at http://dzil.org/ | |
99 |
0 | # This file is generated by Dist::Zilla::Plugin::CPANFile v6.015 | |
1 | # Do not edit this file directly. To change prereqs, edit the `dist.ini` file. | |
2 | ||
3 | requires "Carp" => "0"; | |
4 | requires "HTTP::Date" => "0"; | |
5 | requires "Time::Local" => "1.1901"; | |
6 | requires "parent" => "0"; | |
7 | requires "perl" => "5.008001"; | |
8 | requires "strict" => "0"; | |
9 | requires "warnings" => "0"; | |
10 | recommends "Mozilla::PublicSuffix" => "0"; | |
11 | ||
12 | on 'test' => sub { | |
13 | requires "ExtUtils::MakeMaker" => "0"; | |
14 | requires "File::Spec" => "0"; | |
15 | requires "Test::Deep" => "0"; | |
16 | requires "Test::More" => "0.96"; | |
17 | requires "Test::Requires" => "0"; | |
18 | requires "Time::Local" => "1.1901"; | |
19 | requires "URI" => "0"; | |
20 | requires "lib" => "0"; | |
21 | requires "perl" => "5.008001"; | |
22 | }; | |
23 | ||
24 | on 'test' => sub { | |
25 | recommends "CPAN::Meta" => "2.120900"; | |
26 | }; | |
27 | ||
28 | on 'configure' => sub { | |
29 | requires "ExtUtils::MakeMaker" => "6.17"; | |
30 | requires "perl" => "5.008001"; | |
31 | }; | |
32 | ||
33 | on 'develop' => sub { | |
34 | requires "Dist::Zilla" => "5"; | |
35 | requires "Dist::Zilla::Plugin::Prereqs" => "0"; | |
36 | requires "Dist::Zilla::Plugin::ReleaseStatus::FromVersion" => "0"; | |
37 | requires "Dist::Zilla::Plugin::RemovePrereqs" => "0"; | |
38 | requires "Dist::Zilla::PluginBundle::DAGOLDEN" => "0.072"; | |
39 | requires "File::Spec" => "0"; | |
40 | requires "File::Temp" => "0"; | |
41 | requires "IO::Handle" => "0"; | |
42 | requires "IPC::Open3" => "0"; | |
43 | requires "Pod::Coverage::TrustPod" => "0"; | |
44 | requires "Pod::Wordlist" => "0"; | |
45 | requires "Software::License::Apache_2_0" => "0"; | |
46 | requires "Test::CPAN::Meta" => "0"; | |
47 | requires "Test::MinimumVersion" => "0"; | |
48 | requires "Test::More" => "0"; | |
49 | requires "Test::Perl::Critic" => "0"; | |
50 | requires "Test::Pod" => "1.41"; | |
51 | requires "Test::Pod::Coverage" => "1.08"; | |
52 | requires "Test::Portability::Files" => "0"; | |
53 | requires "Test::Spelling" => "0.12"; | |
54 | requires "Test::Version" => "1"; | |
55 | }; |
3 | 3 | |
4 | 4 | package HTTP::CookieJar::LWP; |
5 | 5 | # ABSTRACT: LWP adapter for HTTP::CookieJar |
6 | our $VERSION = '0.010'; | |
6 | our $VERSION = '0.013'; | |
7 | 7 | |
8 | 8 | use parent 'HTTP::CookieJar'; |
9 | 9 | |
72 | 72 | |
73 | 73 | 1; |
74 | 74 | |
75 | ||
76 | # vim: ts=4 sts=4 sw=4 et: | |
77 | ||
78 | __END__ | |
79 | ||
80 | =pod | |
81 | ||
82 | =encoding UTF-8 | |
83 | ||
84 | =head1 NAME | |
85 | ||
86 | HTTP::CookieJar::LWP - LWP adapter for HTTP::CookieJar | |
87 | ||
88 | =head1 VERSION | |
89 | ||
90 | version 0.010 | |
75 | =for Pod::Coverage method_names_here | |
76 | add_cookie_header | |
77 | extract_cookies | |
91 | 78 | |
92 | 79 | =head1 SYNOPSIS |
93 | 80 | |
106 | 93 | It is not a general-purpose drop-in replacement for C<HTTP::Cookies> in any |
107 | 94 | other way. |
108 | 95 | |
109 | =for Pod::Coverage method_names_here | |
110 | add_cookie_header | |
111 | extract_cookies | |
96 | =cut | |
112 | 97 | |
113 | =head1 AUTHOR | |
114 | ||
115 | David Golden <dagolden@cpan.org> | |
116 | ||
117 | =head1 COPYRIGHT AND LICENSE | |
118 | ||
119 | This software is Copyright (c) 2013 by David Golden. | |
120 | ||
121 | This is free software, licensed under: | |
122 | ||
123 | The Apache License, Version 2.0, January 2004 | |
124 | ||
125 | =cut | |
98 | # vim: ts=4 sts=4 sw=4 et: |
3 | 3 | |
4 | 4 | package HTTP::CookieJar; |
5 | 5 | # ABSTRACT: A minimalist HTTP user agent cookie jar |
6 | our $VERSION = '0.010'; | |
6 | our $VERSION = '0.013'; | |
7 | 7 | |
8 | 8 | use Carp (); |
9 | 9 | use HTTP::Date (); |
10 | 10 | |
11 | 11 | my $HAS_MPS = eval { require Mozilla::PublicSuffix; 1 }; |
12 | 12 | |
13 | #pod =construct new | |
14 | #pod | |
15 | #pod my $jar = HTTP::CookieJar->new; | |
16 | #pod | |
17 | #pod Return a new, empty cookie jar | |
18 | #pod | |
19 | #pod =cut | |
13 | =construct new | |
14 | ||
15 | my $jar = HTTP::CookieJar->new; | |
16 | ||
17 | Return a new, empty cookie jar | |
18 | ||
19 | =cut | |
20 | 20 | |
21 | 21 | sub new { |
22 | 22 | my ($class) = @_; |
23 | 23 | bless { store => {} }, $class; |
24 | 24 | } |
25 | 25 | |
26 | #pod =method add | |
27 | #pod | |
28 | #pod $jar->add( | |
29 | #pod "http://www.example.com/", "lang=en-US; Path=/; Domain=example.com" | |
30 | #pod ); | |
31 | #pod | |
32 | #pod Given a request URL and a C<Set-Cookie> header string, attempts to adds the | |
33 | #pod cookie to the jar. If the cookie is expired, instead it deletes any matching | |
34 | #pod cookie from the jar. A C<Max-Age> attribute will be converted to an absolute | |
35 | #pod C<Expires> attribute. | |
36 | #pod | |
37 | #pod It will throw an exception if the request URL is missing or invalid. Returns true if | |
38 | #pod successful cookie processing or undef/empty-list on failure. | |
39 | #pod | |
40 | #pod =cut | |
26 | =method add | |
27 | ||
28 | $jar->add( | |
29 | "http://www.example.com/", "lang=en-US; Path=/; Domain=example.com" | |
30 | ); | |
31 | ||
32 | Given a request URL and a C<Set-Cookie> header string, attempts to adds the | |
33 | cookie to the jar. If the cookie is expired, instead it deletes any matching | |
34 | cookie from the jar. A C<Max-Age> attribute will be converted to an absolute | |
35 | C<Expires> attribute. | |
36 | ||
37 | It will throw an exception if the request URL is missing or invalid. Returns true if | |
38 | successful cookie processing or undef/empty-list on failure. | |
39 | ||
40 | =cut | |
41 | 41 | |
42 | 42 | sub add { |
43 | 43 | my ( $self, $request, $cookie ) = @_; |
87 | 87 | return 1; |
88 | 88 | } |
89 | 89 | |
90 | #pod =method clear | |
91 | #pod | |
92 | #pod $jar->clear | |
93 | #pod | |
94 | #pod Empties the cookie jar. | |
95 | #pod | |
96 | #pod =cut | |
90 | =method clear | |
91 | ||
92 | $jar->clear | |
93 | ||
94 | Empties the cookie jar. | |
95 | ||
96 | =cut | |
97 | 97 | |
98 | 98 | sub clear { |
99 | 99 | my ($self) = @_; |
101 | 101 | return 1; |
102 | 102 | } |
103 | 103 | |
104 | #pod =method cookies_for | |
105 | #pod | |
106 | #pod my @cookies = $jar->cookies_for("http://www.example.com/foo/bar"); | |
107 | #pod | |
108 | #pod Given a request URL, returns a list of hash references representing cookies | |
109 | #pod that should be sent. The hash references are copies -- changing values | |
110 | #pod will not change the cookies in the jar. | |
111 | #pod | |
112 | #pod Cookies set C<secure> will only be returned if the request scheme is C<https>. | |
113 | #pod Expired cookies will not be returned. | |
114 | #pod | |
115 | #pod Keys of a cookie hash reference might include: | |
116 | #pod | |
117 | #pod =for :list | |
118 | #pod * name -- the name of the cookie | |
119 | #pod * value -- the value of the cookie | |
120 | #pod * domain -- the domain name to which the cookie applies | |
121 | #pod * path -- the path to which the cookie applies | |
122 | #pod * expires -- if present, when the cookie expires in epoch seconds | |
123 | #pod * secure -- if present, the cookie was set C<Secure> | |
124 | #pod * httponly -- if present, the cookie was set C<HttpOnly> | |
125 | #pod * hostonly -- if present, the cookie may only be used with the domain as a host | |
126 | #pod * creation_time -- epoch seconds since the cookie was first stored | |
127 | #pod * last_access_time -- epoch seconds since the cookie was last stored | |
128 | #pod | |
129 | #pod Keep in mind that C<httponly> means it should only be used in requests and not | |
130 | #pod made available via Javascript, etc. This is pretty meaningless for Perl user | |
131 | #pod agents. | |
132 | #pod | |
133 | #pod Generally, user agents should use the C<cookie_header> method instead. | |
134 | #pod | |
135 | #pod It will throw an exception if the request URL is missing or invalid. | |
136 | #pod | |
137 | #pod =cut | |
104 | =method cookies_for | |
105 | ||
106 | my @cookies = $jar->cookies_for("http://www.example.com/foo/bar"); | |
107 | ||
108 | Given a request URL, returns a list of hash references representing cookies | |
109 | that should be sent. The hash references are copies -- changing values | |
110 | will not change the cookies in the jar. | |
111 | ||
112 | Cookies set C<secure> will only be returned if the request scheme is C<https>. | |
113 | Expired cookies will not be returned. | |
114 | ||
115 | Keys of a cookie hash reference might include: | |
116 | ||
117 | =for :list | |
118 | * name -- the name of the cookie | |
119 | * value -- the value of the cookie | |
120 | * domain -- the domain name to which the cookie applies | |
121 | * path -- the path to which the cookie applies | |
122 | * expires -- if present, when the cookie expires in epoch seconds | |
123 | * secure -- if present, the cookie was set C<Secure> | |
124 | * httponly -- if present, the cookie was set C<HttpOnly> | |
125 | * hostonly -- if present, the cookie may only be used with the domain as a host | |
126 | * creation_time -- epoch seconds since the cookie was first stored | |
127 | * last_access_time -- epoch seconds since the cookie was last stored | |
128 | ||
129 | Keep in mind that C<httponly> means it should only be used in requests and not | |
130 | made available via Javascript, etc. This is pretty meaningless for Perl user | |
131 | agents. | |
132 | ||
133 | Generally, user agents should use the C<cookie_header> method instead. | |
134 | ||
135 | It will throw an exception if the request URL is missing or invalid. | |
136 | ||
137 | =cut | |
138 | 138 | |
139 | 139 | sub cookies_for { |
140 | 140 | my ( $self, $request ) = @_; |
158 | 158 | return @found; |
159 | 159 | } |
160 | 160 | |
161 | #pod =method cookie_header | |
162 | #pod | |
163 | #pod my $header = $jar->cookie_header("http://www.example.com/foo/bar"); | |
164 | #pod | |
165 | #pod Given a request URL, returns a correctly-formatted string with all relevant | |
166 | #pod cookies for the request. This string is ready to be used in a C<Cookie> header | |
167 | #pod in an HTTP request. E.g.: | |
168 | #pod | |
169 | #pod SID=31d4d96e407aad42; lang=en-US | |
170 | #pod | |
171 | #pod It follows the same exclusion rules as C<cookies_for>. | |
172 | #pod | |
173 | #pod If the request is invalid or no cookies apply, it will return an empty string. | |
174 | #pod | |
175 | #pod =cut | |
161 | =method cookie_header | |
162 | ||
163 | my $header = $jar->cookie_header("http://www.example.com/foo/bar"); | |
164 | ||
165 | Given a request URL, returns a correctly-formatted string with all relevant | |
166 | cookies for the request. This string is ready to be used in a C<Cookie> header | |
167 | in an HTTP request. E.g.: | |
168 | ||
169 | SID=31d4d96e407aad42; lang=en-US | |
170 | ||
171 | It follows the same exclusion rules as C<cookies_for>. | |
172 | ||
173 | If the request is invalid or no cookies apply, it will return an empty string. | |
174 | ||
175 | =cut | |
176 | 176 | |
177 | 177 | sub cookie_header { |
178 | 178 | my ( $self, $req ) = @_; |
179 | 179 | return join( "; ", map { "$_->{name}=$_->{value}" } $self->cookies_for($req) ); |
180 | 180 | } |
181 | 181 | |
182 | #pod =method dump_cookies | |
183 | #pod | |
184 | #pod my @list = $jar->dump_cookies; | |
185 | #pod my @list = $jar->dump_cookies( { persistent => 1 } ); | |
186 | #pod | |
187 | #pod Returns a list of raw cookies in string form. The strings resemble what | |
188 | #pod would be received from C<Set-Cookie> headers, but with additional internal | |
189 | #pod fields. The list is only intended for use with C<load_cookies> to allow | |
190 | #pod cookie jar persistence. | |
191 | #pod | |
192 | #pod If a hash reference with a true C<persistent> key is given as an argument, | |
193 | #pod cookies without an C<Expires> time (i.e. "session cookies") will be omitted. | |
194 | #pod | |
195 | #pod Here is a trivial example of saving a cookie jar file with L<Path::Tiny>: | |
196 | #pod | |
197 | #pod path("jar.txt")->spew( join "\n", $jar->dump_cookies ); | |
198 | #pod | |
199 | #pod =cut | |
182 | =method dump_cookies | |
183 | ||
184 | my @list = $jar->dump_cookies; | |
185 | my @list = $jar->dump_cookies( { persistent => 1 } ); | |
186 | ||
187 | Returns a list of raw cookies in string form. The strings resemble what | |
188 | would be received from C<Set-Cookie> headers, but with additional internal | |
189 | fields. The list is only intended for use with C<load_cookies> to allow | |
190 | cookie jar persistence. | |
191 | ||
192 | If a hash reference with a true C<persistent> key is given as an argument, | |
193 | cookies without an C<Expires> time (i.e. "session cookies") will be omitted. | |
194 | ||
195 | Here is a trivial example of saving a cookie jar file with L<Path::Tiny>: | |
196 | ||
197 | path("jar.txt")->spew( join "\n", $jar->dump_cookies ); | |
198 | ||
199 | =cut | |
200 | 200 | |
201 | 201 | sub dump_cookies { |
202 | 202 | my ( $self, $args ) = @_; |
220 | 220 | return @list; |
221 | 221 | } |
222 | 222 | |
223 | #pod =method load_cookies | |
224 | #pod | |
225 | #pod $jar->load_cookies( @cookies ); | |
226 | #pod | |
227 | #pod Given a list of cookie strings from C<dump_cookies>, it adds them to | |
228 | #pod the cookie jar. Cookies added in this way will supersede any existing | |
229 | #pod cookies with similar domain, path and name. | |
230 | #pod | |
231 | #pod It returns the jar object for convenience when loading a new object: | |
232 | #pod | |
233 | #pod my $jar = HTTP::CookieJar->new->load_cookies( @cookies ); | |
234 | #pod | |
235 | #pod Here is a trivial example of loading a cookie jar file with L<Path::Tiny>: | |
236 | #pod | |
237 | #pod my $jar = HTTP::CookieJar->new->load_cookies( | |
238 | #pod path("jar.txt")->lines | |
239 | #pod ); | |
240 | #pod | |
241 | #pod =cut | |
223 | =method load_cookies | |
224 | ||
225 | $jar->load_cookies( @cookies ); | |
226 | ||
227 | Given a list of cookie strings from C<dump_cookies>, it adds them to | |
228 | the cookie jar. Cookies added in this way will supersede any existing | |
229 | cookies with similar domain, path and name. | |
230 | ||
231 | It returns the jar object for convenience when loading a new object: | |
232 | ||
233 | my $jar = HTTP::CookieJar->new->load_cookies( @cookies ); | |
234 | ||
235 | Here is a trivial example of loading a cookie jar file with L<Path::Tiny>: | |
236 | ||
237 | my $jar = HTTP::CookieJar->new->load_cookies( | |
238 | path("jar.txt")->lines | |
239 | ); | |
240 | ||
241 | =cut | |
242 | 242 | |
243 | 243 | sub load_cookies { |
244 | 244 | my ( $self, @cookies ) = @_; |
372 | 372 | |
373 | 373 | 1; |
374 | 374 | |
375 | ||
376 | # vim: ts=4 sts=4 sw=4 et: | |
377 | ||
378 | __END__ | |
379 | ||
380 | =pod | |
381 | ||
382 | =encoding UTF-8 | |
383 | ||
384 | =head1 NAME | |
385 | ||
386 | HTTP::CookieJar - A minimalist HTTP user agent cookie jar | |
387 | ||
388 | =head1 VERSION | |
389 | ||
390 | version 0.010 | |
375 | =for Pod::Coverage method_names_here | |
391 | 376 | |
392 | 377 | =head1 SYNOPSIS |
393 | 378 | |
409 | 394 | Unlike the commonly used L<HTTP::Cookies> module, this module does |
410 | 395 | not require use of L<HTTP::Request> and L<HTTP::Response> objects. |
411 | 396 | An LWP-compatible adapter is available as L<HTTP::CookieJar::LWP>. |
412 | ||
413 | =head1 CONSTRUCTORS | |
414 | ||
415 | =head2 new | |
416 | ||
417 | my $jar = HTTP::CookieJar->new; | |
418 | ||
419 | Return a new, empty cookie jar | |
420 | ||
421 | =head1 METHODS | |
422 | ||
423 | =head2 add | |
424 | ||
425 | $jar->add( | |
426 | "http://www.example.com/", "lang=en-US; Path=/; Domain=example.com" | |
427 | ); | |
428 | ||
429 | Given a request URL and a C<Set-Cookie> header string, attempts to adds the | |
430 | cookie to the jar. If the cookie is expired, instead it deletes any matching | |
431 | cookie from the jar. A C<Max-Age> attribute will be converted to an absolute | |
432 | C<Expires> attribute. | |
433 | ||
434 | It will throw an exception if the request URL is missing or invalid. Returns true if | |
435 | successful cookie processing or undef/empty-list on failure. | |
436 | ||
437 | =head2 clear | |
438 | ||
439 | $jar->clear | |
440 | ||
441 | Empties the cookie jar. | |
442 | ||
443 | =head2 cookies_for | |
444 | ||
445 | my @cookies = $jar->cookies_for("http://www.example.com/foo/bar"); | |
446 | ||
447 | Given a request URL, returns a list of hash references representing cookies | |
448 | that should be sent. The hash references are copies -- changing values | |
449 | will not change the cookies in the jar. | |
450 | ||
451 | Cookies set C<secure> will only be returned if the request scheme is C<https>. | |
452 | Expired cookies will not be returned. | |
453 | ||
454 | Keys of a cookie hash reference might include: | |
455 | ||
456 | =over 4 | |
457 | ||
458 | =item * | |
459 | ||
460 | name -- the name of the cookie | |
461 | ||
462 | =item * | |
463 | ||
464 | value -- the value of the cookie | |
465 | ||
466 | =item * | |
467 | ||
468 | domain -- the domain name to which the cookie applies | |
469 | ||
470 | =item * | |
471 | ||
472 | path -- the path to which the cookie applies | |
473 | ||
474 | =item * | |
475 | ||
476 | expires -- if present, when the cookie expires in epoch seconds | |
477 | ||
478 | =item * | |
479 | ||
480 | secure -- if present, the cookie was set C<Secure> | |
481 | ||
482 | =item * | |
483 | ||
484 | httponly -- if present, the cookie was set C<HttpOnly> | |
485 | ||
486 | =item * | |
487 | ||
488 | hostonly -- if present, the cookie may only be used with the domain as a host | |
489 | ||
490 | =item * | |
491 | ||
492 | creation_time -- epoch seconds since the cookie was first stored | |
493 | ||
494 | =item * | |
495 | ||
496 | last_access_time -- epoch seconds since the cookie was last stored | |
497 | ||
498 | =back | |
499 | ||
500 | Keep in mind that C<httponly> means it should only be used in requests and not | |
501 | made available via Javascript, etc. This is pretty meaningless for Perl user | |
502 | agents. | |
503 | ||
504 | Generally, user agents should use the C<cookie_header> method instead. | |
505 | ||
506 | It will throw an exception if the request URL is missing or invalid. | |
507 | ||
508 | =head2 cookie_header | |
509 | ||
510 | my $header = $jar->cookie_header("http://www.example.com/foo/bar"); | |
511 | ||
512 | Given a request URL, returns a correctly-formatted string with all relevant | |
513 | cookies for the request. This string is ready to be used in a C<Cookie> header | |
514 | in an HTTP request. E.g.: | |
515 | ||
516 | SID=31d4d96e407aad42; lang=en-US | |
517 | ||
518 | It follows the same exclusion rules as C<cookies_for>. | |
519 | ||
520 | If the request is invalid or no cookies apply, it will return an empty string. | |
521 | ||
522 | =head2 dump_cookies | |
523 | ||
524 | my @list = $jar->dump_cookies; | |
525 | my @list = $jar->dump_cookies( { persistent => 1 } ); | |
526 | ||
527 | Returns a list of raw cookies in string form. The strings resemble what | |
528 | would be received from C<Set-Cookie> headers, but with additional internal | |
529 | fields. The list is only intended for use with C<load_cookies> to allow | |
530 | cookie jar persistence. | |
531 | ||
532 | If a hash reference with a true C<persistent> key is given as an argument, | |
533 | cookies without an C<Expires> time (i.e. "session cookies") will be omitted. | |
534 | ||
535 | Here is a trivial example of saving a cookie jar file with L<Path::Tiny>: | |
536 | ||
537 | path("jar.txt")->spew( join "\n", $jar->dump_cookies ); | |
538 | ||
539 | =head2 load_cookies | |
540 | ||
541 | $jar->load_cookies( @cookies ); | |
542 | ||
543 | Given a list of cookie strings from C<dump_cookies>, it adds them to | |
544 | the cookie jar. Cookies added in this way will supersede any existing | |
545 | cookies with similar domain, path and name. | |
546 | ||
547 | It returns the jar object for convenience when loading a new object: | |
548 | ||
549 | my $jar = HTTP::CookieJar->new->load_cookies( @cookies ); | |
550 | ||
551 | Here is a trivial example of loading a cookie jar file with L<Path::Tiny>: | |
552 | ||
553 | my $jar = HTTP::CookieJar->new->load_cookies( | |
554 | path("jar.txt")->lines | |
555 | ); | |
556 | ||
557 | =for Pod::Coverage method_names_here | |
558 | 397 | |
559 | 398 | =head1 LIMITATIONS AND CAVEATS |
560 | 399 | |
585 | 424 | |
586 | 425 | =head1 SEE ALSO |
587 | 426 | |
588 | =over 4 | |
589 | ||
590 | =item * | |
591 | ||
592 | L<HTTP::Cookies> | |
593 | ||
594 | =item * | |
595 | ||
596 | L<Mojo::UserAgent::CookieJar> | |
597 | ||
598 | =back | |
599 | ||
600 | =head1 AUTHOR | |
601 | ||
602 | David Golden <dagolden@cpan.org> | |
603 | ||
604 | =head1 CONTRIBUTORS | |
605 | ||
606 | =for stopwords Dan Book David Golden jvolkening | |
607 | ||
608 | =over 4 | |
609 | ||
610 | =item * | |
611 | ||
612 | Dan Book <grinnz@grinnz.com> | |
613 | ||
614 | =item * | |
615 | ||
616 | David Golden <xdg@xdg.me> | |
617 | ||
618 | =item * | |
619 | ||
620 | jvolkening <jdv@base2bio.com> | |
621 | ||
622 | =back | |
623 | ||
624 | =head1 COPYRIGHT AND LICENSE | |
625 | ||
626 | This software is Copyright (c) 2013 by David Golden. | |
627 | ||
628 | This is free software, licensed under: | |
629 | ||
630 | The Apache License, Version 2.0, January 2004 | |
631 | ||
632 | =cut | |
427 | =for :list | |
428 | * L<HTTP::Cookies> | |
429 | * L<Mojo::UserAgent::CookieJar> | |
430 | ||
431 | =cut | |
432 | ||
433 | # vim: ts=4 sts=4 sw=4 et: |
0 | do { my $x = { | |
1 | 'configure' => { | |
2 | 'requires' => { | |
3 | 'ExtUtils::MakeMaker' => '6.17', | |
4 | 'perl' => '5.008001' | |
5 | } | |
6 | }, | |
7 | 'develop' => { | |
8 | 'requires' => { | |
9 | 'Dist::Zilla' => '5', | |
10 | 'Dist::Zilla::Plugin::Prereqs' => '0', | |
11 | 'Dist::Zilla::Plugin::ReleaseStatus::FromVersion' => '0', | |
12 | 'Dist::Zilla::Plugin::RemovePrereqs' => '0', | |
13 | 'Dist::Zilla::PluginBundle::DAGOLDEN' => '0.072', | |
14 | 'File::Spec' => '0', | |
15 | 'File::Temp' => '0', | |
16 | 'IO::Handle' => '0', | |
17 | 'IPC::Open3' => '0', | |
18 | 'Pod::Coverage::TrustPod' => '0', | |
19 | 'Pod::Wordlist' => '0', | |
20 | 'Software::License::Apache_2_0' => '0', | |
21 | 'Test::CPAN::Meta' => '0', | |
22 | 'Test::MinimumVersion' => '0', | |
23 | 'Test::More' => '0', | |
24 | 'Test::Perl::Critic' => '0', | |
25 | 'Test::Pod' => '1.41', | |
26 | 'Test::Pod::Coverage' => '1.08', | |
27 | 'Test::Portability::Files' => '0', | |
28 | 'Test::Spelling' => '0.12', | |
29 | 'Test::Version' => '1' | |
30 | } | |
31 | }, | |
32 | 'runtime' => { | |
33 | 'recommends' => { | |
34 | 'Mozilla::PublicSuffix' => '0' | |
35 | }, | |
36 | 'requires' => { | |
37 | 'Carp' => '0', | |
38 | 'HTTP::Date' => '0', | |
39 | 'Time::Local' => '1.1901', | |
40 | 'parent' => '0', | |
41 | 'perl' => '5.008001', | |
42 | 'strict' => '0', | |
43 | 'warnings' => '0' | |
44 | } | |
45 | }, | |
46 | 'test' => { | |
47 | 'recommends' => { | |
48 | 'CPAN::Meta' => '2.120900' | |
49 | }, | |
50 | 'requires' => { | |
51 | 'ExtUtils::MakeMaker' => '0', | |
52 | 'File::Spec' => '0', | |
53 | 'Test::Deep' => '0', | |
54 | 'Test::More' => '0.96', | |
55 | 'Test::Requires' => '0', | |
56 | 'Time::Local' => '1.1901', | |
57 | 'URI' => '0', | |
58 | 'lib' => '0', | |
59 | 'perl' => '5.008001' | |
60 | } | |
61 | } | |
62 | }; | |
63 | $x; | |
64 | }⏎ |
0 | #!perl | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 | |
6 | ||
7 | use Test::More tests => 1; | |
8 | ||
9 | use ExtUtils::MakeMaker; | |
10 | use File::Spec; | |
11 | ||
12 | # from $version::LAX | |
13 | my $lax_version_re = | |
14 | qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | |
15 | | | |
16 | (?:\.[0-9]+) (?:_[0-9]+)? | |
17 | ) | (?: | |
18 | v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | |
19 | | | |
20 | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? | |
21 | ) | |
22 | )/x; | |
23 | ||
24 | # hide optional CPAN::Meta modules from prereq scanner | |
25 | # and check if they are available | |
26 | my $cpan_meta = "CPAN::Meta"; | |
27 | my $cpan_meta_pre = "CPAN::Meta::Prereqs"; | |
28 | my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic | |
29 | ||
30 | # Verify requirements? | |
31 | my $DO_VERIFY_PREREQS = 1; | |
32 | ||
33 | sub _max { | |
34 | my $max = shift; | |
35 | $max = ( $_ > $max ) ? $_ : $max for @_; | |
36 | return $max; | |
37 | } | |
38 | ||
39 | sub _merge_prereqs { | |
40 | my ($collector, $prereqs) = @_; | |
41 | ||
42 | # CPAN::Meta::Prereqs object | |
43 | if (ref $collector eq $cpan_meta_pre) { | |
44 | return $collector->with_merged_prereqs( | |
45 | CPAN::Meta::Prereqs->new( $prereqs ) | |
46 | ); | |
47 | } | |
48 | ||
49 | # Raw hashrefs | |
50 | for my $phase ( keys %$prereqs ) { | |
51 | for my $type ( keys %{ $prereqs->{$phase} } ) { | |
52 | for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { | |
53 | $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; | |
54 | } | |
55 | } | |
56 | } | |
57 | ||
58 | return $collector; | |
59 | } | |
60 | ||
61 | my @include = qw( | |
62 | ||
63 | ); | |
64 | ||
65 | my @exclude = qw( | |
66 | ||
67 | ); | |
68 | ||
69 | # Add static prereqs to the included modules list | |
70 | my $static_prereqs = do './t/00-report-prereqs.dd'; | |
71 | ||
72 | # Merge all prereqs (either with ::Prereqs or a hashref) | |
73 | my $full_prereqs = _merge_prereqs( | |
74 | ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), | |
75 | $static_prereqs | |
76 | ); | |
77 | ||
78 | # Add dynamic prereqs to the included modules list (if we can) | |
79 | my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; | |
80 | my $cpan_meta_error; | |
81 | if ( $source && $HAS_CPAN_META | |
82 | && (my $meta = eval { CPAN::Meta->load_file($source) } ) | |
83 | ) { | |
84 | $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); | |
85 | } | |
86 | else { | |
87 | $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) | |
88 | $source = 'static metadata'; | |
89 | } | |
90 | ||
91 | my @full_reports; | |
92 | my @dep_errors; | |
93 | my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; | |
94 | ||
95 | # Add static includes into a fake section | |
96 | for my $mod (@include) { | |
97 | $req_hash->{other}{modules}{$mod} = 0; | |
98 | } | |
99 | ||
100 | for my $phase ( qw(configure build test runtime develop other) ) { | |
101 | next unless $req_hash->{$phase}; | |
102 | next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); | |
103 | ||
104 | for my $type ( qw(requires recommends suggests conflicts modules) ) { | |
105 | next unless $req_hash->{$phase}{$type}; | |
106 | ||
107 | my $title = ucfirst($phase).' '.ucfirst($type); | |
108 | my @reports = [qw/Module Want Have/]; | |
109 | ||
110 | for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { | |
111 | next if $mod eq 'perl'; | |
112 | next if grep { $_ eq $mod } @exclude; | |
113 | ||
114 | my $file = $mod; | |
115 | $file =~ s{::}{/}g; | |
116 | $file .= ".pm"; | |
117 | my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; | |
118 | ||
119 | my $want = $req_hash->{$phase}{$type}{$mod}; | |
120 | $want = "undef" unless defined $want; | |
121 | $want = "any" if !$want && $want == 0; | |
122 | ||
123 | my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; | |
124 | ||
125 | if ($prefix) { | |
126 | my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); | |
127 | $have = "undef" unless defined $have; | |
128 | push @reports, [$mod, $want, $have]; | |
129 | ||
130 | if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { | |
131 | if ( $have !~ /\A$lax_version_re\z/ ) { | |
132 | push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; | |
133 | } | |
134 | elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { | |
135 | push @dep_errors, "$mod version '$have' is not in required range '$want'"; | |
136 | } | |
137 | } | |
138 | } | |
139 | else { | |
140 | push @reports, [$mod, $want, "missing"]; | |
141 | ||
142 | if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { | |
143 | push @dep_errors, "$mod is not installed ($req_string)"; | |
144 | } | |
145 | } | |
146 | } | |
147 | ||
148 | if ( @reports ) { | |
149 | push @full_reports, "=== $title ===\n\n"; | |
150 | ||
151 | my $ml = _max( map { length $_->[0] } @reports ); | |
152 | my $wl = _max( map { length $_->[1] } @reports ); | |
153 | my $hl = _max( map { length $_->[2] } @reports ); | |
154 | ||
155 | if ($type eq 'modules') { | |
156 | splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; | |
157 | push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; | |
158 | } | |
159 | else { | |
160 | splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; | |
161 | push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; | |
162 | } | |
163 | ||
164 | push @full_reports, "\n"; | |
165 | } | |
166 | } | |
167 | } | |
168 | ||
169 | if ( @full_reports ) { | |
170 | diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; | |
171 | } | |
172 | ||
173 | if ( $cpan_meta_error || @dep_errors ) { | |
174 | diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; | |
175 | } | |
176 | ||
177 | if ( $cpan_meta_error ) { | |
178 | my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; | |
179 | diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; | |
180 | } | |
181 | ||
182 | if ( @dep_errors ) { | |
183 | diag join("\n", | |
184 | "\nThe following REQUIRED prerequisites were not satisfied:\n", | |
185 | @dep_errors, | |
186 | "\n" | |
187 | ); | |
188 | } | |
189 | ||
190 | pass('Reported prereqs'); | |
191 | ||
192 | # vim: ts=4 sts=4 sw=4 et: |
245 | 245 | } |
246 | 246 | |
247 | 247 | done_testing; |
248 | # | |
249 | # This file is part of HTTP-CookieJar | |
250 | # | |
251 | # This software is Copyright (c) 2013 by David Golden. | |
252 | # | |
253 | # This is free software, licensed under: | |
254 | # | |
255 | # The Apache License, Version 2.0, January 2004 | |
256 | # | |
248 | # COPYRIGHT |
37 | 37 | |
38 | 38 | subtest "expiration" => sub { |
39 | 39 | $jar->clear; |
40 | $jar->add( $req, "lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT" ); | |
40 | $jar->add( $req, "lang=en-US; Expires=Sun, 09 Jun 2041 10:18:14 GMT" ); | |
41 | 41 | is( $jar->cookie_header($req), "lang=en-US" ); |
42 | 42 | $jar->add( $req, "lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT" ); |
43 | 43 | is( $jar->cookie_header($req), "" ); |
44 | 44 | }; |
45 | 45 | |
46 | 46 | done_testing; |
47 | # | |
48 | # This file is part of HTTP-CookieJar | |
49 | # | |
50 | # This software is Copyright (c) 2013 by David Golden. | |
51 | # | |
52 | # This is free software, licensed under: | |
53 | # | |
54 | # The Apache License, Version 2.0, January 2004 | |
55 | # | |
47 | # COPYRIGHT |
82 | 82 | } |
83 | 83 | }, |
84 | 84 | { |
85 | cookie => "lang=en-US; Expires = Wed, 09 Jun 2021 10:18:14 GMT", | |
85 | cookie => "lang=en-US; Expires = Sun, 09 Jun 2041 10:18:14 GMT", | |
86 | 86 | parse => { |
87 | 87 | name => "lang", |
88 | 88 | value => "en-US", |
89 | expires => 1623233894, | |
89 | expires => 2254385894, | |
90 | 90 | } |
91 | 91 | }, |
92 | 92 | { |
93 | cookie => "lang=en-US; Expires = Wed, 09 Jun 2021 10:18:14 GMT; Max-Age=3600", | |
93 | cookie => "lang=en-US; Expires = Sun, 09 Jun 2041 10:18:14 GMT; Max-Age=3600", | |
94 | 94 | parse => { |
95 | 95 | name => "lang", |
96 | 96 | value => "en-US", |
97 | expires => 1623233894, | |
97 | expires => 2254385894, | |
98 | 98 | 'max-age' => 3600, |
99 | 99 | } |
100 | 100 | }, |
106 | 106 | } |
107 | 107 | |
108 | 108 | done_testing; |
109 | # | |
110 | # This file is part of HTTP-CookieJar | |
111 | # | |
112 | # This software is Copyright (c) 2013 by David Golden. | |
113 | # | |
114 | # This is free software, licensed under: | |
115 | # | |
116 | # The Apache License, Version 2.0, January 2004 | |
117 | # | |
109 | # COPYRIGHT |
90 | 90 | } |
91 | 91 | |
92 | 92 | done_testing; |
93 | # | |
94 | # This file is part of HTTP-CookieJar | |
95 | # | |
96 | # This software is Copyright (c) 2013 by David Golden. | |
97 | # | |
98 | # This is free software, licensed under: | |
99 | # | |
100 | # The Apache License, Version 2.0, January 2004 | |
101 | # | |
93 | # COPYRIGHT |
53 | 53 | }; |
54 | 54 | |
55 | 55 | done_testing; |
56 | # | |
57 | # This file is part of HTTP-CookieJar | |
58 | # | |
59 | # This software is Copyright (c) 2013 by David Golden. | |
60 | # | |
61 | # This is free software, licensed under: | |
62 | # | |
63 | # The Apache License, Version 2.0, January 2004 | |
64 | # | |
56 | # COPYRIGHT | |
65 | 57 | # vim: ts=4 sts=4 sw=4 et: |
42 | 42 | } |
43 | 43 | |
44 | 44 | done_testing; |
45 | # | |
46 | # This file is part of HTTP-CookieJar | |
47 | # | |
48 | # This software is Copyright (c) 2013 by David Golden. | |
49 | # | |
50 | # This is free software, licensed under: | |
51 | # | |
52 | # The Apache License, Version 2.0, January 2004 | |
53 | # | |
45 | # COPYRIGHT |
669 | 669 | } |
670 | 670 | |
671 | 671 | done_testing; |
672 | # | |
673 | # This file is part of HTTP-CookieJar | |
674 | # | |
675 | # This software is Copyright (c) 2013 by David Golden. | |
676 | # | |
677 | # This is free software, licensed under: | |
678 | # | |
679 | # The Apache License, Version 2.0, January 2004 | |
680 | # | |
672 | # COPYRIGHT |
0 | use 5.006; | |
1 | use strict; | |
2 | use warnings; | |
3 | ||
4 | # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 | |
5 | ||
6 | use Test::More; | |
7 | ||
8 | plan tests => 3; | |
9 | ||
10 | my @module_files = ( | |
11 | 'HTTP/CookieJar.pm', | |
12 | 'HTTP/CookieJar/LWP.pm' | |
13 | ); | |
14 | ||
15 | ||
16 | ||
17 | # fake home for cpan-testers | |
18 | use File::Temp; | |
19 | local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); | |
20 | ||
21 | ||
22 | my @switches = ( | |
23 | -d 'blib' ? '-Mblib' : '-Ilib', | |
24 | ); | |
25 | ||
26 | use File::Spec; | |
27 | use IPC::Open3; | |
28 | use IO::Handle; | |
29 | ||
30 | open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; | |
31 | ||
32 | my @warnings; | |
33 | for my $lib (@module_files) | |
34 | { | |
35 | # see L<perlfaq8/How can I capture STDERR from an external command?> | |
36 | my $stderr = IO::Handle->new; | |
37 | ||
38 | diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } | |
39 | $^X, @switches, '-e', "require q[$lib]")) | |
40 | if $ENV{PERL_COMPILE_TEST_DEBUG}; | |
41 | ||
42 | my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); | |
43 | binmode $stderr, ':crlf' if $^O eq 'MSWin32'; | |
44 | my @_warnings = <$stderr>; | |
45 | waitpid($pid, 0); | |
46 | is($?, 0, "$lib loaded ok"); | |
47 | ||
48 | shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ | |
49 | and not eval { +require blib; blib->VERSION('1.01') }; | |
50 | ||
51 | if (@_warnings) | |
52 | { | |
53 | warn @_warnings; | |
54 | push @warnings, @_warnings; | |
55 | } | |
56 | } | |
57 | ||
58 | ||
59 | ||
60 | is(scalar(@warnings), 0, 'no warnings found') | |
61 | or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); | |
62 | ||
63 |
0 | #!perl | |
1 | ||
2 | use strict; | |
3 | use warnings; | |
4 | ||
5 | use Test::Perl::Critic (-profile => "perlcritic.rc") x!! -e "perlcritic.rc"; | |
6 | all_critic_ok(); |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use Test::More; | |
4 | use Test::MinimumVersion; | |
5 | all_minimum_version_ok( qq{5.010} ); |
0 | #!perl | |
1 | # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. | |
2 | ||
3 | use Test::Pod::Coverage 1.08; | |
4 | use Pod::Coverage::TrustPod; | |
5 | ||
6 | all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); |
0 | use strict; | |
1 | use warnings; | |
2 | use Test::More; | |
3 | ||
4 | # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 | |
5 | use Test::Spelling 0.12; | |
6 | use Pod::Wordlist; | |
7 | ||
8 | ||
9 | add_stopwords(<DATA>); | |
10 | all_pod_files_spelling_ok( qw( bin lib ) ); | |
11 | __DATA__ | |
12 | Book | |
13 | CookieJar | |
14 | Dan | |
15 | David | |
16 | Golden | |
17 | HTTP | |
18 | Javascript | |
19 | LWP | |
20 | RFC's | |
21 | dagolden | |
22 | grinnz | |
23 | hostonly | |
24 | httponly | |
25 | jdv | |
26 | jvolkening | |
27 | lib | |
28 | xdg |
0 | #!perl | |
1 | # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. | |
2 | use strict; use warnings; | |
3 | use Test::More; | |
4 | use Test::Pod 1.41; | |
5 | ||
6 | all_pod_files_ok(); |
0 | use strict; | |
1 | use warnings; | |
2 | ||
3 | use Test::More; | |
4 | ||
5 | eval 'use Test::Portability::Files'; | |
6 | plan skip_all => 'Test::Portability::Files required for testing portability' | |
7 | if $@; | |
8 | options(test_one_dot => 0); | |
9 | run_tests(); |
0 | use strict; | |
1 | use warnings; | |
2 | use Test::More; | |
3 | ||
4 | # generated by Dist::Zilla::Plugin::Test::Version 1.09 | |
5 | use Test::Version; | |
6 | ||
7 | my @imports = qw( version_all_ok ); | |
8 | ||
9 | my $params = { | |
10 | is_strict => 0, | |
11 | has_version => 1, | |
12 | multiple => 0, | |
13 | ||
14 | }; | |
15 | ||
16 | push @imports, $params | |
17 | if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); | |
18 | ||
19 | Test::Version->import(@imports); | |
20 | ||
21 | version_all_ok; | |
22 | done_testing; |