From b756755c0209b8f55e5e4434d5efb13a25bebc1d Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 22 Jul 2022 15:08:08 +0900 Subject: [PATCH] Imported Upstream version 1.74 --- CONTRIBUTING.md | 105 +++++ Changes | 139 ++++++- LICENSE | 379 +++++++++++++++++ MANIFEST | 136 +++--- META.json | 872 +++++++++++++++++++++++++++++++++++++++ META.yml | 662 +++++++++++++++++++++++++++-- Makefile.PL | 127 ++++-- README | 30 -- URI/_foreign.pm | 6 - URI/https.pm | 9 - URI/ldaps.pm | 9 - URI/mms.pm | 8 - URI/nntp.pm | 6 - URI/rlogin.pm | 7 - URI/rtsp.pm | 8 - URI/rtspu.pm | 8 - URI/sips.pm | 9 - URI/telnet.pm | 7 - URI/tn3270.pm | 7 - cpanfile | 38 ++ dist.ini | 195 +++++++++ URI.pm => lib/URI.pm | 67 ++- {URI => lib/URI}/Escape.pm | 19 +- {URI => lib/URI}/Heuristic.pm | 12 +- {URI => lib/URI}/IRI.pm | 5 +- {URI => lib/URI}/QueryParam.pm | 14 + {URI => lib/URI}/Split.pm | 9 +- {URI => lib/URI}/URL.pm | 18 +- {URI => lib/URI}/WithBase.pm | 11 +- lib/URI/_foreign.pm | 10 + {URI => lib/URI}/_generic.pm | 12 +- {URI => lib/URI}/_idna.pm | 6 +- {URI => lib/URI}/_ldap.pm | 8 +- {URI => lib/URI}/_login.pm | 9 +- {URI => lib/URI}/_punycode.pm | 75 ++-- {URI => lib/URI}/_query.pm | 8 +- {URI => lib/URI}/_segment.pm | 4 + {URI => lib/URI}/_server.pm | 10 +- {URI => lib/URI}/_userpass.pm | 10 +- {URI => lib/URI}/data.pm | 8 +- {URI => lib/URI}/file.pm | 11 +- {URI => lib/URI}/file/Base.pm | 8 +- {URI => lib/URI}/file/FAT.pm | 8 +- {URI => lib/URI}/file/Mac.pm | 9 +- {URI => lib/URI}/file/OS2.pm | 8 +- {URI => lib/URI}/file/QNX.pm | 8 +- {URI => lib/URI}/file/Unix.pm | 9 +- {URI => lib/URI}/file/Win32.pm | 9 +- {URI => lib/URI}/ftp.pm | 9 +- {URI => lib/URI}/gopher.pm | 11 +- {URI => lib/URI}/http.pm | 8 +- lib/URI/https.pm | 14 + {URI => lib/URI}/ldap.pm | 8 +- {URI => lib/URI}/ldapi.pm | 7 +- lib/URI/ldaps.pm | 14 + {URI => lib/URI}/mailto.pm | 9 +- lib/URI/mms.pm | 12 + {URI => lib/URI}/news.pm | 11 +- lib/URI/nntp.pm | 10 + {URI => lib/URI}/pop.pm | 13 +- lib/URI/rlogin.pm | 12 + {URI => lib/URI}/rsync.pm | 8 +- lib/URI/rtsp.pm | 12 + lib/URI/rtspu.pm | 12 + lib/URI/sftp.pm | 10 + {URI => lib/URI}/sip.pm | 11 +- lib/URI/sips.pm | 14 + {URI => lib/URI}/snews.pm | 8 +- {URI => lib/URI}/ssh.pm | 9 +- lib/URI/telnet.pm | 12 + lib/URI/tn3270.pm | 12 + {URI => lib/URI}/urn.pm | 22 +- {URI => lib/URI}/urn/isbn.pm | 9 +- {URI => lib/URI}/urn/oid.pm | 8 +- t/00-report-prereqs.dd | 70 ++++ t/00-report-prereqs.t | 193 +++++++++ t/abs.t | 10 +- t/clone.t | 4 +- t/cwd.t | 9 +- t/data.t | 16 +- t/escape-char.t | 29 ++ t/escape.t | 4 +- t/file.t | 17 +- t/ftp.t | 4 +- t/generic.t | 13 +- t/gopher.t | 2 +- t/heuristic.t | 3 +- t/http.t | 13 +- t/idna.t | 4 +- t/iri.t | 8 +- t/ldap.t | 4 +- t/mailto.t | 9 +- t/mix.t | 23 +- t/mms.t | 7 +- t/news.t | 7 +- t/num_eq.t | 5 +- t/old-absconf.t | 5 +- t/old-base.t | 455 +++++++++----------- t/old-file.t | 19 +- t/old-relbase.t | 19 +- t/path-segments.t | 33 ++ t/pop.t | 5 +- t/punycode.t | 4 +- t/query-param.t | 3 +- t/query.t | 4 +- t/rel.t | 18 +- t/rfc2732.t | 4 +- t/roy-test.t | 4 +- t/rsync.t | 4 +- t/rtsp.t | 7 +- t/scheme-exceptions.t | 16 + t/sip.t | 4 +- t/sort-hash-query-form.t | 22 + t/split.t | 4 +- t/storable-test.pl | 3 +- t/storable.t | 13 +- t/urn-isbn.t | 14 +- t/urn-oid.t | 4 +- t/utf8.t | 2 - uri-test | 3 + xt/author/00-compile.t | 112 +++++ xt/author/minimum-version.t | 6 + xt/author/mojibake.t | 9 + xt/author/pod-coverage.t | 118 ++++++ xt/author/pod-spell.t | 162 ++++++++ xt/author/pod-syntax.t | 7 + xt/author/portability.t | 10 + xt/author/test-version.t | 23 ++ xt/release/changes_has_content.t | 42 ++ xt/release/distmeta.t | 6 + 130 files changed, 4226 insertions(+), 829 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 META.json delete mode 100644 README delete mode 100644 URI/_foreign.pm delete mode 100644 URI/https.pm delete mode 100644 URI/ldaps.pm delete mode 100644 URI/mms.pm delete mode 100644 URI/nntp.pm delete mode 100644 URI/rlogin.pm delete mode 100644 URI/rtsp.pm delete mode 100644 URI/rtspu.pm delete mode 100644 URI/sips.pm delete mode 100644 URI/telnet.pm delete mode 100644 URI/tn3270.pm create mode 100644 cpanfile create mode 100644 dist.ini rename URI.pm => lib/URI.pm (94%) rename {URI => lib/URI}/Escape.pm (92%) rename {URI => lib/URI}/Heuristic.pm (96%) rename {URI => lib/URI}/IRI.pm (93%) rename {URI => lib/URI}/QueryParam.pm (94%) rename {URI => lib/URI}/Split.pm (95%) rename {URI => lib/URI}/URL.pm (95%) rename {URI => lib/URI}/WithBase.pm (94%) create mode 100644 lib/URI/_foreign.pm rename {URI => lib/URI}/_generic.pm (97%) rename {URI => lib/URI}/_idna.pm (95%) rename {URI => lib/URI}/_ldap.pm (95%) rename {URI => lib/URI}/_login.pm (58%) rename {URI => lib/URI}/_punycode.pm (65%) rename {URI => lib/URI}/_query.pm (95%) rename {URI => lib/URI}/_segment.pm (90%) rename {URI => lib/URI}/_server.pm (96%) rename {URI => lib/URI}/_userpass.pm (84%) rename {URI => lib/URI}/data.pm (98%) rename {URI => lib/URI}/file.pm (98%) rename {URI => lib/URI}/file/Base.pm (91%) rename {URI => lib/URI}/file/FAT.pm (83%) rename {URI => lib/URI}/file/Mac.pm (97%) rename {URI => lib/URI}/file/OS2.pm (85%) rename {URI => lib/URI}/file/QNX.pm (79%) rename {URI => lib/URI}/file/Unix.pm (93%) rename {URI => lib/URI}/file/Win32.pm (96%) rename {URI => lib/URI}/ftp.pm (92%) rename {URI => lib/URI}/gopher.pm (94%) rename {URI => lib/URI}/http.pm (84%) create mode 100644 lib/URI/https.pm rename {URI => lib/URI}/ldap.pm (95%) rename {URI => lib/URI}/ldapi.pm (78%) create mode 100644 lib/URI/ldaps.pm rename {URI => lib/URI}/mailto.pm (94%) create mode 100644 lib/URI/mms.pm rename {URI => lib/URI}/news.pm (92%) create mode 100644 lib/URI/nntp.pm rename {URI => lib/URI}/pop.pm (88%) create mode 100644 lib/URI/rlogin.pm rename {URI => lib/URI}/rsync.pm (54%) create mode 100644 lib/URI/rtsp.pm create mode 100644 lib/URI/rtspu.pm create mode 100644 lib/URI/sftp.pm rename {URI => lib/URI}/sip.pm (92%) create mode 100644 lib/URI/sips.pm rename {URI => lib/URI}/snews.pm (56%) rename {URI => lib/URI}/ssh.pm (55%) create mode 100644 lib/URI/telnet.pm create mode 100644 lib/URI/tn3270.pm rename {URI => lib/URI}/urn.pm (82%) rename {URI => lib/URI}/urn/isbn.pm (97%) rename {URI => lib/URI}/urn/oid.pm (78%) create mode 100644 t/00-report-prereqs.dd create mode 100644 t/00-report-prereqs.t create mode 100644 t/escape-char.t create mode 100755 t/path-segments.t create mode 100644 t/scheme-exceptions.t create mode 100644 t/sort-hash-query-form.t create mode 100644 xt/author/00-compile.t create mode 100644 xt/author/minimum-version.t create mode 100644 xt/author/mojibake.t create mode 100644 xt/author/pod-coverage.t create mode 100644 xt/author/pod-spell.t create mode 100644 xt/author/pod-syntax.t create mode 100644 xt/author/portability.t create mode 100644 xt/author/test-version.t create mode 100644 xt/release/changes_has_content.t create mode 100644 xt/release/distmeta.t diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..35fc514 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,105 @@ +# HOW TO CONTRIBUTE + +Thank you for considering contributing to this distribution. This file +contains instructions that will help you work with the source code. + +The distribution is managed with [Dist::Zilla](https://metacpan.org/pod/Dist::Zilla). +This means that many of the usual files you might expect are not in the +repository, but are generated at release time. Some generated files are kept +in the repository as a convenience (e.g. Build.PL/Makefile.PL and META.json). + +Generally, **you do not need Dist::Zilla to contribute patches**. You may need +Dist::Zilla to create a tarball. See below for guidance. + +## Getting dependencies + +If you have App::cpanminus 1.6 or later installed, you can use +[cpanm](https://metacpan.org/pod/cpanm) to satisfy dependencies like this: + + $ cpanm --installdeps --with-develop . + +You can also run this command (or any other cpanm command) without installing +App::cpanminus first, using the fatpacked `cpanm` script via curl or wget: + + $ curl -L https://cpanmin.us | perl - --installdeps --with-develop . + $ wget -qO - https://cpanmin.us | perl - --installdeps --with-develop . + +Otherwise, look for either a `cpanfile` or `META.json` file for a list of +dependencies to satisfy. + +## Running tests + +You can run tests directly using the `prove` tool: + + $ prove -l + $ prove -lv t/some_test_file.t + +For most of my distributions, `prove` is entirely sufficient for you to test +any patches you have. I use `prove` for 99% of my testing during development. + +## Code style and tidying + +Please try to match any existing coding style. If there is a `.perltidyrc` +file, please install Perl::Tidy and use perltidy before submitting patches. + +## Installing and using Dist::Zilla + +[Dist::Zilla](https://metacpan.org/pod/Dist::Zilla) is a very powerful +authoring tool, optimized for maintaining a large number of distributions with +a high degree of automation, but it has a large dependency chain, a bit of a +learning curve and requires a number of author-specific plugins. + +To install it from CPAN, I recommend one of the following approaches for the +quickest installation: + + # using CPAN.pm, but bypassing non-functional pod tests + $ cpan TAP::Harness::Restricted + $ PERL_MM_USE_DEFAULT=1 HARNESS_CLASS=TAP::Harness::Restricted cpan Dist::Zilla + + # using cpanm, bypassing *all* tests + $ cpanm -n Dist::Zilla + +In either case, it's probably going to take about 10 minutes. Go for a walk, +go get a cup of your favorite beverage, take a bathroom break, or whatever. +When you get back, Dist::Zilla should be ready for you. + +Then you need to install any plugins specific to this distribution: + + $ dzil authordeps --missing | cpanm + +You can use Dist::Zilla to install the distribution's dependencies if you +haven't already installed them with cpanm: + + $ dzil listdeps --missing --develop | cpanm + +Once everything is installed, here are some dzil commands you might try: + + $ dzil build + $ dzil test + $ dzil regenerate + +You can learn more about Dist::Zilla at http://dzil.org/ + +## Other notes + +This distribution maintains the generated `META.json` and either `Makefile.PL` +or `Build.PL` in the repository. This allows two things: +[Travis CI](https://travis-ci.org/) can build and test the distribution without +requiring Dist::Zilla, and the distribution can be installed directly from +Github or a local git repository using `cpanm` for testing (again, not +requiring Dist::Zilla). + + $ cpanm git://github.com/Author/Distribution-Name.git + $ cd Distribution-Name; cpanm . + +Contributions are preferred in the form of a Github pull request. See +[Using pull requests](https://help.github.com/articles/using-pull-requests/) +for further information. You can use the Github issue tracker to report issues +without an accompanying patch. + +# CREDITS + +This file was adapted from an initial `CONTRIBUTING.mkdn` file from David +Golden under the terms of the Apache 2 license, with inspiration from the +contributing documents from [Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING](https://metacpan.org/pod/Dist::Zilla::Plugin::Author::KENTNL::CONTRIBUTING) +and [Dist::Zilla::PluginBundle::Author::ETHER](https://metacpan.org/pod/Dist::Zilla::PluginBundle::Author::ETHER). diff --git a/Changes b/Changes index 3586f48..ca6a487 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,137 @@ +Revision history for URI + +1.74 2018-04-22 12:30:44Z + - avoid 'uninitialized' warning in URI::File when host has no domain name + set (PR#53, thanks Shoichi Kaji!) + +1.73 2018-01-09 06:42:51Z + - Update documentation for URI::_punycode (GH Issue #45) + +1.72 2017-07-25 + - Convert the dist to Dist::Zilla for authoring. + - Remove recommendation of Business::ISBN as urn/isbn.pm is deprecated + - Use Test::Needs instead of raw eval in urn-isbn.t + +2016-01-08 Karen Etheridge + + Release 1.71 + + No changes since 1.70_001 + +2015-12-29 Karen Etheridge + + Release 1.70_001 + + Kaitlyn Parkhurst: + + - Localize $@ when attempting to load URI subclasses (PR#30) + + Karen Etheridge: + + - speed up construction time by not attempting to load the same + non-existent URI subclass twice + + +2015-07-25 Karen Etheridge + + Release 1.69 + + Karen Etheridge: + - add $VERSIONs for all modules that lack them + + Olaf Alders: + - add missing documentation for URI::sftp + - Clarify use of query_param() method + + +2015-06-25 Karen Etheridge + + Release 1.68 + + Kent Fredric: + - Sort hash keys to make generated query predictable + + Slaven Rezic: + - Add new tests for path segments + + Brendan Byrd: + - Add sftp scheme + + +2015-02-24 Karen Etheridge + + Release 1.67 + + Karen Etheridge: + - properly skip author test for normal user installs + + +2015-02-24 Karen Etheridge + + Release 1.66 + + Adam Herzog: + - reorganize .pm files under lib/ (github #20) + + +2014-11-05 Karen Etheridge + + Release 1.65 + + Karen Etheridge: + - add a TO_JSON method, to assist JSON serialization + + +2014-07-13 Karen Etheridge + + Release 1.64 + + Eric Brine: + - better fix for RT#96941, that also works around utf8 bugs on older perls + + +2014-07-13 Karen Etheridge + + Release 1.63 + + Karen Etheridge: + - mark utf8-related test failures on older perls caused by recent string + parsing changes as TODO (RT#97177, RT#96941) + + +2014-07-12 Karen Etheridge + + Release 1.62 + + Karen Etheridge (2): + - use strict and warnings in all modules, tests and scripts + - remove all remaining uses of "use vars" + + Eric Brine: + - fixed new "\C is deprecated in regex" warning in 5.21.2 (RT#96941) + + +2014-07-01 Karen Etheridge + + Release 1.61 + + David Schmidt: + Fix test failure if local hostname is 'foo' [RT#75519] + + Gisle Aas (2): + New 'has_recognized_scheme' interface [RT#71204] + Interfaces that return a single value now return undef rather than an + empty list in list context + + Slaven Rezic: + Fix bad regex when parsing hostnames + + Piotr Roszatycki: + Preferentially use $ENV{TMPDIR} for temporary test files over /tmp + (fixes tests on Android) + + + 2012-03-25 Gisle Aas Release 1.60 @@ -45,6 +179,9 @@ Release 1.57 + Perl 5.6 is no longer supported; use backpan.cpan.org to obtain obsolete + versions of URI. + Mark Stosberg (8): typo fix: s/do deal/to deal/ best practice: s/foreach /for / @@ -400,7 +537,7 @@ Relative URIs that start with the query string directly (i.e. "?q") are now absolutized as specified in rfc2396bis. See: http://www.apache.org/~fielding/uri/rev-2002/issues.html#003-relative-query - + Added URI::Split module. It's a lightweight module that can be used to parse and compose URI string to/from its component parts. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0faf80a --- /dev/null +++ b/LICENSE @@ -0,0 +1,379 @@ +This software is copyright (c) 1998 by Gisle Aas. + +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) 1998 by Gisle Aas. + +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) 1998 by Gisle Aas. + +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 + diff --git a/MANIFEST b/MANIFEST index 814be4b..5f21638 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,63 +1,73 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. +CONTRIBUTING.md Changes +LICENSE MANIFEST +META.json +META.yml Makefile.PL -README -URI.pm -URI/Escape.pm -URI/Heuristic.pm -URI/IRI.pm -URI/QueryParam.pm -URI/Split.pm -URI/URL.pm -URI/WithBase.pm -URI/_foreign.pm -URI/_generic.pm -URI/_idna.pm -URI/_ldap.pm -URI/_login.pm -URI/_punycode.pm -URI/_query.pm -URI/_segment.pm -URI/_server.pm -URI/_userpass.pm -URI/data.pm -URI/file.pm -URI/file/Base.pm -URI/file/FAT.pm -URI/file/Mac.pm -URI/file/OS2.pm -URI/file/QNX.pm -URI/file/Unix.pm -URI/file/Win32.pm -URI/ftp.pm -URI/gopher.pm -URI/http.pm -URI/https.pm -URI/ldap.pm -URI/ldapi.pm -URI/ldaps.pm -URI/mailto.pm -URI/mms.pm -URI/news.pm -URI/nntp.pm -URI/pop.pm -URI/rlogin.pm -URI/rsync.pm -URI/rtsp.pm -URI/rtspu.pm -URI/sip.pm -URI/sips.pm -URI/snews.pm -URI/ssh.pm -URI/telnet.pm -URI/tn3270.pm -URI/urn.pm -URI/urn/isbn.pm -URI/urn/oid.pm +cpanfile +dist.ini +lib/URI.pm +lib/URI/Escape.pm +lib/URI/Heuristic.pm +lib/URI/IRI.pm +lib/URI/QueryParam.pm +lib/URI/Split.pm +lib/URI/URL.pm +lib/URI/WithBase.pm +lib/URI/_foreign.pm +lib/URI/_generic.pm +lib/URI/_idna.pm +lib/URI/_ldap.pm +lib/URI/_login.pm +lib/URI/_punycode.pm +lib/URI/_query.pm +lib/URI/_segment.pm +lib/URI/_server.pm +lib/URI/_userpass.pm +lib/URI/data.pm +lib/URI/file.pm +lib/URI/file/Base.pm +lib/URI/file/FAT.pm +lib/URI/file/Mac.pm +lib/URI/file/OS2.pm +lib/URI/file/QNX.pm +lib/URI/file/Unix.pm +lib/URI/file/Win32.pm +lib/URI/ftp.pm +lib/URI/gopher.pm +lib/URI/http.pm +lib/URI/https.pm +lib/URI/ldap.pm +lib/URI/ldapi.pm +lib/URI/ldaps.pm +lib/URI/mailto.pm +lib/URI/mms.pm +lib/URI/news.pm +lib/URI/nntp.pm +lib/URI/pop.pm +lib/URI/rlogin.pm +lib/URI/rsync.pm +lib/URI/rtsp.pm +lib/URI/rtspu.pm +lib/URI/sftp.pm +lib/URI/sip.pm +lib/URI/sips.pm +lib/URI/snews.pm +lib/URI/ssh.pm +lib/URI/telnet.pm +lib/URI/tn3270.pm +lib/URI/urn.pm +lib/URI/urn/isbn.pm +lib/URI/urn/oid.pm +t/00-report-prereqs.dd +t/00-report-prereqs.t t/abs.t t/clone.t t/cwd.t t/data.t +t/escape-char.t t/escape.t t/file.t t/ftp.t @@ -77,10 +87,11 @@ t/old-absconf.t t/old-base.t t/old-file.t t/old-relbase.t +t/path-segments.t t/pop.t t/punycode.t -t/query.t t/query-param.t +t/query.t t/rel.t t/rfc2732.t t/roy-test.t @@ -91,12 +102,23 @@ t/roytest4.html t/roytest5.html t/rsync.t t/rtsp.t -t/split.t +t/scheme-exceptions.t t/sip.t -t/storable.t +t/sort-hash-query-form.t +t/split.t t/storable-test.pl +t/storable.t t/urn-isbn.t t/urn-oid.t t/utf8.t uri-test -META.yml Module meta-data (added by MakeMaker) +xt/author/00-compile.t +xt/author/minimum-version.t +xt/author/mojibake.t +xt/author/pod-coverage.t +xt/author/pod-spell.t +xt/author/pod-syntax.t +xt/author/portability.t +xt/author/test-version.t +xt/release/changes_has_content.t +xt/release/distmeta.t diff --git a/META.json b/META.json new file mode 100644 index 0000000..8347ee3 --- /dev/null +++ b/META.json @@ -0,0 +1,872 @@ +{ + "abstract" : "Uniform Resource Identifiers (absolute and relative)", + "author" : [ + "Gisle Aas " + ], + "dynamic_config" : 0, + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", + "license" : [ + "perl_5" + ], + "meta-spec" : { + "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", + "version" : 2 + }, + "name" : "URI", + "no_index" : { + "directory" : [ + "t", + "xt" + ] + }, + "prereqs" : { + "configure" : { + "requires" : { + "ExtUtils::MakeMaker" : "0" + }, + "suggests" : { + "JSON::PP" : "2.27300" + } + }, + "develop" : { + "recommends" : { + "Business::ISBN" : "0", + "Dist::Zilla::PluginBundle::Git::VersionManager" : "0.007", + "Storable" : "0" + }, + "requires" : { + "File::Spec" : "0", + "IO::Handle" : "0", + "IPC::Open3" : "0", + "Pod::Coverage::TrustPod" : "0", + "Test::CPAN::Changes" : "0.19", + "Test::CPAN::Meta" : "0", + "Test::MinimumVersion" : "0", + "Test::Mojibake" : "0", + "Test::More" : "0.94", + "Test::Pod" : "1.41", + "Test::Pod::Coverage" : "1.08", + "Test::Portability::Files" : "0", + "Test::Spelling" : "0.12", + "Test::Version" : "1" + } + }, + "runtime" : { + "requires" : { + "Carp" : "0", + "Cwd" : "0", + "Data::Dumper" : "0", + "Encode" : "0", + "Exporter" : "5.57", + "MIME::Base64" : "2", + "Net::Domain" : "0", + "Scalar::Util" : "0", + "constant" : "0", + "integer" : "0", + "overload" : "0", + "parent" : "0", + "perl" : "5.008001", + "strict" : "0", + "utf8" : "0", + "warnings" : "0" + } + }, + "test" : { + "recommends" : { + "CPAN::Meta" : "2.120900" + }, + "requires" : { + "ExtUtils::MakeMaker" : "0", + "File::Spec" : "0", + "File::Spec::Functions" : "0", + "File::Temp" : "0", + "Test" : "0", + "Test::More" : "0.96", + "Test::Needs" : "0", + "utf8" : "0" + } + } + }, + "provides" : { + "URI" : { + "file" : "lib/URI.pm", + "version" : "1.74" + }, + "URI::Escape" : { + "file" : "lib/URI/Escape.pm", + "version" : "3.31" + }, + "URI::Heuristic" : { + "file" : "lib/URI/Heuristic.pm", + "version" : "4.20" + }, + "URI::IRI" : { + "file" : "lib/URI/IRI.pm", + "version" : "1.74" + }, + "URI::QueryParam" : { + "file" : "lib/URI/QueryParam.pm", + "version" : "1.74" + }, + "URI::Split" : { + "file" : "lib/URI/Split.pm", + "version" : "1.74" + }, + "URI::URL" : { + "file" : "lib/URI/URL.pm", + "version" : "5.04" + }, + "URI::WithBase" : { + "file" : "lib/URI/WithBase.pm", + "version" : "2.20" + }, + "URI::data" : { + "file" : "lib/URI/data.pm", + "version" : "1.74" + }, + "URI::file" : { + "file" : "lib/URI/file.pm", + "version" : "4.21" + }, + "URI::file::Base" : { + "file" : "lib/URI/file/Base.pm", + "version" : "1.74" + }, + "URI::file::FAT" : { + "file" : "lib/URI/file/FAT.pm", + "version" : "1.74" + }, + "URI::file::Mac" : { + "file" : "lib/URI/file/Mac.pm", + "version" : "1.74" + }, + "URI::file::OS2" : { + "file" : "lib/URI/file/OS2.pm", + "version" : "1.74" + }, + "URI::file::QNX" : { + "file" : "lib/URI/file/QNX.pm", + "version" : "1.74" + }, + "URI::file::Unix" : { + "file" : "lib/URI/file/Unix.pm", + "version" : "1.74" + }, + "URI::file::Win32" : { + "file" : "lib/URI/file/Win32.pm", + "version" : "1.74" + }, + "URI::ftp" : { + "file" : "lib/URI/ftp.pm", + "version" : "1.74" + }, + "URI::gopher" : { + "file" : "lib/URI/gopher.pm", + "version" : "1.74" + }, + "URI::http" : { + "file" : "lib/URI/http.pm", + "version" : "1.74" + }, + "URI::https" : { + "file" : "lib/URI/https.pm", + "version" : "1.74" + }, + "URI::ldap" : { + "file" : "lib/URI/ldap.pm", + "version" : "1.74" + }, + "URI::ldapi" : { + "file" : "lib/URI/ldapi.pm", + "version" : "1.74" + }, + "URI::ldaps" : { + "file" : "lib/URI/ldaps.pm", + "version" : "1.74" + }, + "URI::mailto" : { + "file" : "lib/URI/mailto.pm", + "version" : "1.74" + }, + "URI::mms" : { + "file" : "lib/URI/mms.pm", + "version" : "1.74" + }, + "URI::news" : { + "file" : "lib/URI/news.pm", + "version" : "1.74" + }, + "URI::nntp" : { + "file" : "lib/URI/nntp.pm", + "version" : "1.74" + }, + "URI::pop" : { + "file" : "lib/URI/pop.pm", + "version" : "1.74" + }, + "URI::rlogin" : { + "file" : "lib/URI/rlogin.pm", + "version" : "1.74" + }, + "URI::rsync" : { + "file" : "lib/URI/rsync.pm", + "version" : "1.74" + }, + "URI::rtsp" : { + "file" : "lib/URI/rtsp.pm", + "version" : "1.74" + }, + "URI::rtspu" : { + "file" : "lib/URI/rtspu.pm", + "version" : "1.74" + }, + "URI::sftp" : { + "file" : "lib/URI/sftp.pm", + "version" : "1.74" + }, + "URI::sip" : { + "file" : "lib/URI/sip.pm", + "version" : "1.74" + }, + "URI::sips" : { + "file" : "lib/URI/sips.pm", + "version" : "1.74" + }, + "URI::snews" : { + "file" : "lib/URI/snews.pm", + "version" : "1.74" + }, + "URI::ssh" : { + "file" : "lib/URI/ssh.pm", + "version" : "1.74" + }, + "URI::telnet" : { + "file" : "lib/URI/telnet.pm", + "version" : "1.74" + }, + "URI::tn3270" : { + "file" : "lib/URI/tn3270.pm", + "version" : "1.74" + }, + "URI::urn" : { + "file" : "lib/URI/urn.pm", + "version" : "1.74" + }, + "URI::urn::isbn" : { + "file" : "lib/URI/urn/isbn.pm", + "version" : "1.74" + }, + "URI::urn::oid" : { + "file" : "lib/URI/urn/oid.pm", + "version" : "1.74" + } + }, + "release_status" : "stable", + "resources" : { + "bugtracker" : { + "web" : "https://github.com/libwww-perl/URI/issues" + }, + "homepage" : "https://github.com/libwww-perl/URI", + "repository" : { + "type" : "git", + "url" : "https://github.com/libwww-perl/URI.git", + "web" : "https://github.com/libwww-perl/URI" + }, + "x_IRC" : "irc://irc.perl.org/#lwp", + "x_MailingList" : "mailto:libwww@perl.org" + }, + "version" : "1.74", + "x_Dist_Zilla" : { + "perl" : { + "version" : "5.027011" + }, + "plugins" : [ + { + "class" : "Dist::Zilla::Plugin::Git::GatherDir", + "config" : { + "Dist::Zilla::Plugin::GatherDir" : { + "exclude_filename" : [ + "LICENSE", + "README.md", + "draft-duerst-iri-bis.txt", + "rfc2396.txt", + "rfc3986.txt", + "rfc3987.txt" + ], + "exclude_match" : [], + "follow_symlinks" : 0, + "include_dotfiles" : 0, + "prefix" : "", + "prune_directory" : [], + "root" : "." + }, + "Dist::Zilla::Plugin::Git::GatherDir" : { + "include_untracked" : 0 + } + }, + "name" : "Git::GatherDir", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::Encoding", + "name" : "Encoding", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaConfig", + "name" : "MetaConfig", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Package", + "config" : { + "Dist::Zilla::Plugin::MetaProvides::Package" : { + "finder_objects" : [ + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "include_underscores" : 0 + }, + "Dist::Zilla::Role::MetaProvider::Provider" : { + "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", + "inherit_missing" : "0", + "inherit_version" : "0", + "meta_noindex" : 1 + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000033", + "version" : "0.006" + } + }, + "name" : "MetaProvides::Package", + "version" : "2.004003" + }, + { + "class" : "Dist::Zilla::Plugin::MetaNoIndex", + "name" : "MetaNoIndex", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaYAML", + "name" : "MetaYAML", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaJSON", + "name" : "MetaJSON", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaResources", + "name" : "MetaResources", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Contributors", + "config" : { + "Dist::Zilla::Plugin::Git::Contributors" : { + "git_version" : "2.14.2", + "include_authors" : 0, + "include_releaser" : 1, + "order_by" : "commits", + "paths" : [] + } + }, + "name" : "Git::Contributors", + "version" : "0.034" + }, + { + "class" : "Dist::Zilla::Plugin::GithubMeta", + "name" : "GithubMeta", + "version" : "0.54" + }, + { + "class" : "Dist::Zilla::Plugin::Authority", + "name" : "Authority", + "version" : "1.009" + }, + { + "class" : "Dist::Zilla::Plugin::Manifest", + "name" : "Manifest", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::License", + "name" : "License", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ExecDir", + "name" : "ExecDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs::FromCPANfile", + "name" : "Prereqs::FromCPANfile", + "version" : "0.08" + }, + { + "class" : "Dist::Zilla::Plugin::MakeMaker", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "MakeMaker", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", + "name" : "CheckChangesHasContent", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::MojibakeTests", + "name" : "MojibakeTests", + "version" : "0.8" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Version", + "name" : "Test::Version", + "version" : "1.09" + }, + { + "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", + "name" : "Test::ReportPrereqs", + "version" : "0.027" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Compile", + "config" : { + "Dist::Zilla::Plugin::Test::Compile" : { + "bail_out_on_fail" : "1", + "fail_on_warning" : "author", + "fake_home" : 0, + "filename" : "xt/author/00-compile.t", + "module_finder" : [ + ":InstallModules" + ], + "needs_display" : 0, + "phase" : "develop", + "script_finder" : [ + ":PerlExecFiles" + ], + "skips" : [], + "switch" : [] + } + }, + "name" : "Test::Compile", + "version" : "2.058" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Portability", + "config" : { + "Dist::Zilla::Plugin::Test::Portability" : { + "options" : "" + } + }, + "name" : "Test::Portability", + "version" : "2.001000" + }, + { + "class" : "Dist::Zilla::Plugin::MetaTests", + "name" : "MetaTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", + "name" : "Test::ChangesHasContent", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", + "name" : "Test::MinimumVersion", + "version" : "2.000008" + }, + { + "class" : "Dist::Zilla::Plugin::PodSyntaxTests", + "name" : "PodSyntaxTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable", + "name" : "Test::Pod::Coverage::Configurable", + "version" : "0.07" + }, + { + "class" : "Dist::Zilla::Plugin::Test::PodSpelling", + "config" : { + "Dist::Zilla::Plugin::Test::PodSpelling" : { + "directories" : [ + "bin", + "lib" + ], + "spell_cmd" : "aspell list", + "stopwords" : [ + "Berners", + "IDNA", + "ISBNs", + "Koster", + "Martijn", + "Masinter", + "OIDs", + "OpenLDAP", + "Punycode", + "TCP", + "TLS", + "UDP", + "UNC", + "etype", + "evalue", + "lowercasing", + "relativize", + "uppercasing" + ], + "wordlist" : "Pod::Wordlist" + } + }, + "name" : "Test::PodSpelling", + "version" : "2.007005" + }, + { + "class" : "Dist::Zilla::Plugin::CheckStrictVersion", + "name" : "CheckStrictVersion", + "version" : "0.001" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Check", + "config" : { + "Dist::Zilla::Plugin::Git::Check" : { + "untracked_files" : "die" + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [], + "allow_dirty_match" : [], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + } + }, + "name" : "Git::Check", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", + "config" : { + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + } + }, + "name" : "Git::CheckFor::MergeConflicts", + "version" : "0.014" + }, + { + "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", + "config" : { + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + } + }, + "name" : "Git::CheckFor::CorrectBranch", + "version" : "0.014" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Remote::Check", + "name" : "Git::Remote::Check", + "version" : "0.1.2" + }, + { + "class" : "Dist::Zilla::Plugin::TestRelease", + "name" : "TestRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::RunExtraTests", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "RunExtraTests", + "version" : "0.029" + }, + { + "class" : "Dist::Zilla::Plugin::UploadToCPAN", + "name" : "UploadToCPAN", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", + "config" : { + "Dist::Zilla::Role::FileWatcher" : { + "version" : "0.006" + } + }, + "name" : "Markdown_Readme", + "version" : "0.163250" + }, + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "develop", + "type" : "recommends" + } + }, + "name" : "@Git::VersionManager/pluginbundle version", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::VersionFromMainModule", + "config" : { + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000033", + "version" : "0.006" + } + }, + "name" : "@Git::VersionManager/VersionFromMainModule", + "version" : "0.04" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Update", + "name" : "@Git::VersionManager/MetaProvides::Update", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::CopyFilesFromRelease", + "config" : { + "Dist::Zilla::Plugin::CopyFilesFromRelease" : { + "filename" : [ + "Changes" + ], + "match" : [] + } + }, + "name" : "@Git::VersionManager/CopyFilesFromRelease", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Commit", + "config" : { + "Dist::Zilla::Plugin::Git::Commit" : { + "add_files_in" : [], + "commit_msg" : "%N-%v%t%n%n%c" + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [ + "Changes", + "LICENSE", + "README.md" + ], + "allow_dirty_match" : [], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Git::VersionManager/release snapshot", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Tag", + "config" : { + "Dist::Zilla::Plugin::Git::Tag" : { + "branch" : null, + "changelog" : "Changes", + "signed" : 0, + "tag" : "v1.74", + "tag_format" : "v%v", + "tag_message" : "v%v" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Git::VersionManager/Git::Tag", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", + "config" : { + "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { + "finders" : [ + ":ExecFiles", + ":InstallModules" + ], + "global" : 0, + "munge_makefile_pl" : 1 + } + }, + "name" : "@Git::VersionManager/BumpVersionAfterRelease", + "version" : "0.018" + }, + { + "class" : "Dist::Zilla::Plugin::NextRelease", + "name" : "@Git::VersionManager/NextRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Commit", + "config" : { + "Dist::Zilla::Plugin::Git::Commit" : { + "add_files_in" : [], + "commit_msg" : "increment $VERSION after %v release" + }, + "Dist::Zilla::Role::Git::DirtyFiles" : { + "allow_dirty" : [ + "Build.PL", + "Changes", + "Makefile.PL" + ], + "allow_dirty_match" : [ + "(?^:^lib/.*\\.pm$)" + ], + "changelog" : "Changes" + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + }, + "Dist::Zilla::Role::Git::StringFormatter" : { + "time_zone" : "local" + } + }, + "name" : "@Git::VersionManager/post-release commit", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::Git::Push", + "config" : { + "Dist::Zilla::Plugin::Git::Push" : { + "push_to" : [ + "origin" + ], + "remotes_must_exist" : 1 + }, + "Dist::Zilla::Role::Git::Repo" : { + "git_version" : "2.14.2", + "repo_root" : "." + } + }, + "name" : "Git::Push", + "version" : "2.043" + }, + { + "class" : "Dist::Zilla::Plugin::ConfirmRelease", + "name" : "ConfirmRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":IncModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":TestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExtraTestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":PerlExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ShareFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":MainModule", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":AllFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":NoFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "zilla" : { + "class" : "Dist::Zilla::Dist::Builder", + "config" : { + "is_trial" : 0 + }, + "version" : "6.012" + } + }, + "x_authority" : "cpan:LWWWP", + "x_contributors" : [ + "Gisle Aas ", + "Karen Etheridge ", + "Chase Whitener ", + "Ville Skytt\u00e4 ", + "Mark Stosberg ", + "Olaf Alders ", + "Michael G. Schwern ", + "Shoichi Kaji ", + "Slaven Rezic ", + "Kent Fredric ", + "Masahiro Honma ", + "Matt Lawrence ", + "Peter Rabbitson ", + "Piotr Roszatycki ", + "Salvatore Bonaccorso ", + "Tatsuhiko Miyagawa ", + "Torsten F\u00f6rtsch ", + "Adam Herzog ", + "gerard ", + "Alex Kapranoff ", + "Brendan Byrd ", + "David Schmidt ", + "Jan Dubois ", + "John Karr ", + "John Miller ", + "Kaitlyn Parkhurst ", + "Kenichi Ishigaki " + ], + "x_generated_by_perl" : "v5.27.11", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.02" +} + diff --git a/META.yml b/META.yml index 637f063..3ecbc32 100644 --- a/META.yml +++ b/META.yml @@ -1,30 +1,640 @@ ---- #YAML:1.0 -name: URI -version: 1.60 -abstract: Uniform Resource Identifiers (absolute and relative) +--- +abstract: 'Uniform Resource Identifiers (absolute and relative)' author: - - Gisle Aas -license: perl -distribution_type: module -configure_requires: - ExtUtils::MakeMaker: 0 + - 'Gisle Aas ' build_requires: - ExtUtils::MakeMaker: 0 - Test: 0 - Test::More: 0 + ExtUtils::MakeMaker: '0' + File::Spec: '0' + File::Spec::Functions: '0' + File::Temp: '0' + Test: '0' + Test::More: '0.96' + Test::Needs: '0' + utf8: '0' +configure_requires: + ExtUtils::MakeMaker: '0' +dynamic_config: 0 +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' +license: perl +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: '1.4' +name: URI +no_index: + directory: + - t + - xt +provides: + URI: + file: lib/URI.pm + version: '1.74' + URI::Escape: + file: lib/URI/Escape.pm + version: '3.31' + URI::Heuristic: + file: lib/URI/Heuristic.pm + version: '4.20' + URI::IRI: + file: lib/URI/IRI.pm + version: '1.74' + URI::QueryParam: + file: lib/URI/QueryParam.pm + version: '1.74' + URI::Split: + file: lib/URI/Split.pm + version: '1.74' + URI::URL: + file: lib/URI/URL.pm + version: '5.04' + URI::WithBase: + file: lib/URI/WithBase.pm + version: '2.20' + URI::data: + file: lib/URI/data.pm + version: '1.74' + URI::file: + file: lib/URI/file.pm + version: '4.21' + URI::file::Base: + file: lib/URI/file/Base.pm + version: '1.74' + URI::file::FAT: + file: lib/URI/file/FAT.pm + version: '1.74' + URI::file::Mac: + file: lib/URI/file/Mac.pm + version: '1.74' + URI::file::OS2: + file: lib/URI/file/OS2.pm + version: '1.74' + URI::file::QNX: + file: lib/URI/file/QNX.pm + version: '1.74' + URI::file::Unix: + file: lib/URI/file/Unix.pm + version: '1.74' + URI::file::Win32: + file: lib/URI/file/Win32.pm + version: '1.74' + URI::ftp: + file: lib/URI/ftp.pm + version: '1.74' + URI::gopher: + file: lib/URI/gopher.pm + version: '1.74' + URI::http: + file: lib/URI/http.pm + version: '1.74' + URI::https: + file: lib/URI/https.pm + version: '1.74' + URI::ldap: + file: lib/URI/ldap.pm + version: '1.74' + URI::ldapi: + file: lib/URI/ldapi.pm + version: '1.74' + URI::ldaps: + file: lib/URI/ldaps.pm + version: '1.74' + URI::mailto: + file: lib/URI/mailto.pm + version: '1.74' + URI::mms: + file: lib/URI/mms.pm + version: '1.74' + URI::news: + file: lib/URI/news.pm + version: '1.74' + URI::nntp: + file: lib/URI/nntp.pm + version: '1.74' + URI::pop: + file: lib/URI/pop.pm + version: '1.74' + URI::rlogin: + file: lib/URI/rlogin.pm + version: '1.74' + URI::rsync: + file: lib/URI/rsync.pm + version: '1.74' + URI::rtsp: + file: lib/URI/rtsp.pm + version: '1.74' + URI::rtspu: + file: lib/URI/rtspu.pm + version: '1.74' + URI::sftp: + file: lib/URI/sftp.pm + version: '1.74' + URI::sip: + file: lib/URI/sip.pm + version: '1.74' + URI::sips: + file: lib/URI/sips.pm + version: '1.74' + URI::snews: + file: lib/URI/snews.pm + version: '1.74' + URI::ssh: + file: lib/URI/ssh.pm + version: '1.74' + URI::telnet: + file: lib/URI/telnet.pm + version: '1.74' + URI::tn3270: + file: lib/URI/tn3270.pm + version: '1.74' + URI::urn: + file: lib/URI/urn.pm + version: '1.74' + URI::urn::isbn: + file: lib/URI/urn/isbn.pm + version: '1.74' + URI::urn::oid: + file: lib/URI/urn/oid.pm + version: '1.74' requires: - MIME::Base64: 2 - perl: 5.008001 + Carp: '0' + Cwd: '0' + Data::Dumper: '0' + Encode: '0' + Exporter: '5.57' + MIME::Base64: '2' + Net::Domain: '0' + Scalar::Util: '0' + constant: '0' + integer: '0' + overload: '0' + parent: '0' + perl: '5.008001' + strict: '0' + utf8: '0' + warnings: '0' resources: - MailingList: mailto:libwww@perl.org - repository: https://github.com/libwww-perl/uri -no_index: - directory: - - t - - inc -generated_by: ExtUtils::MakeMaker version 6.57_05 -meta-spec: - url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 -recommends: - Business::ISBN: 0 + IRC: irc://irc.perl.org/#lwp + MailingList: mailto:libwww@perl.org + bugtracker: https://github.com/libwww-perl/URI/issues + homepage: https://github.com/libwww-perl/URI + repository: https://github.com/libwww-perl/URI.git +version: '1.74' +x_Dist_Zilla: + perl: + version: '5.027011' + plugins: + - + class: Dist::Zilla::Plugin::Git::GatherDir + config: + Dist::Zilla::Plugin::GatherDir: + exclude_filename: + - LICENSE + - README.md + - draft-duerst-iri-bis.txt + - rfc2396.txt + - rfc3986.txt + - rfc3987.txt + exclude_match: [] + follow_symlinks: 0 + include_dotfiles: 0 + prefix: '' + prune_directory: [] + root: . + Dist::Zilla::Plugin::Git::GatherDir: + include_untracked: 0 + name: Git::GatherDir + version: '2.043' + - + class: Dist::Zilla::Plugin::Encoding + name: Encoding + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaConfig + name: MetaConfig + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaProvides::Package + config: + Dist::Zilla::Plugin::MetaProvides::Package: + finder_objects: + - + class: Dist::Zilla::Plugin::FinderCode + name: MetaProvides::Package/AUTOVIV/:InstallModulesPM + version: '6.012' + include_underscores: 0 + Dist::Zilla::Role::MetaProvider::Provider: + $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' + inherit_missing: '0' + inherit_version: '0' + meta_noindex: '1' + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000033' + version: '0.006' + name: MetaProvides::Package + version: '2.004003' + - + class: Dist::Zilla::Plugin::MetaNoIndex + name: MetaNoIndex + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaYAML + name: MetaYAML + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaJSON + name: MetaJSON + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaResources + name: MetaResources + version: '6.012' + - + class: Dist::Zilla::Plugin::Git::Contributors + config: + Dist::Zilla::Plugin::Git::Contributors: + git_version: 2.14.2 + include_authors: 0 + include_releaser: 1 + order_by: commits + paths: [] + name: Git::Contributors + version: '0.034' + - + class: Dist::Zilla::Plugin::GithubMeta + name: GithubMeta + version: '0.54' + - + class: Dist::Zilla::Plugin::Authority + name: Authority + version: '1.009' + - + class: Dist::Zilla::Plugin::Manifest + name: Manifest + version: '6.012' + - + class: Dist::Zilla::Plugin::License + name: License + version: '6.012' + - + class: Dist::Zilla::Plugin::ExecDir + name: ExecDir + version: '6.012' + - + class: Dist::Zilla::Plugin::Prereqs::FromCPANfile + name: Prereqs::FromCPANfile + version: '0.08' + - + class: Dist::Zilla::Plugin::MakeMaker + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: MakeMaker + version: '6.012' + - + class: Dist::Zilla::Plugin::CheckChangesHasContent + name: CheckChangesHasContent + version: '0.011' + - + class: Dist::Zilla::Plugin::MojibakeTests + name: MojibakeTests + version: '0.8' + - + class: Dist::Zilla::Plugin::Test::Version + name: Test::Version + version: '1.09' + - + class: Dist::Zilla::Plugin::Test::ReportPrereqs + name: Test::ReportPrereqs + version: '0.027' + - + class: Dist::Zilla::Plugin::Test::Compile + config: + Dist::Zilla::Plugin::Test::Compile: + bail_out_on_fail: '1' + fail_on_warning: author + fake_home: 0 + filename: xt/author/00-compile.t + module_finder: + - ':InstallModules' + needs_display: 0 + phase: develop + script_finder: + - ':PerlExecFiles' + skips: [] + switch: [] + name: Test::Compile + version: '2.058' + - + class: Dist::Zilla::Plugin::Test::Portability + config: + Dist::Zilla::Plugin::Test::Portability: + options: '' + name: Test::Portability + version: '2.001000' + - + class: Dist::Zilla::Plugin::MetaTests + name: MetaTests + version: '6.012' + - + class: Dist::Zilla::Plugin::Test::ChangesHasContent + name: Test::ChangesHasContent + version: '0.011' + - + class: Dist::Zilla::Plugin::Test::MinimumVersion + name: Test::MinimumVersion + version: '2.000008' + - + class: Dist::Zilla::Plugin::PodSyntaxTests + name: PodSyntaxTests + version: '6.012' + - + class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable + name: Test::Pod::Coverage::Configurable + version: '0.07' + - + class: Dist::Zilla::Plugin::Test::PodSpelling + config: + Dist::Zilla::Plugin::Test::PodSpelling: + directories: + - bin + - lib + spell_cmd: 'aspell list' + stopwords: + - Berners + - IDNA + - ISBNs + - Koster + - Martijn + - Masinter + - OIDs + - OpenLDAP + - Punycode + - TCP + - TLS + - UDP + - UNC + - etype + - evalue + - lowercasing + - relativize + - uppercasing + wordlist: Pod::Wordlist + name: Test::PodSpelling + version: '2.007005' + - + class: Dist::Zilla::Plugin::CheckStrictVersion + name: CheckStrictVersion + version: '0.001' + - + class: Dist::Zilla::Plugin::Git::Check + config: + Dist::Zilla::Plugin::Git::Check: + untracked_files: die + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: [] + allow_dirty_match: [] + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + name: Git::Check + version: '2.043' + - + class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts + config: + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + name: Git::CheckFor::MergeConflicts + version: '0.014' + - + class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch + config: + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + name: Git::CheckFor::CorrectBranch + version: '0.014' + - + class: Dist::Zilla::Plugin::Git::Remote::Check + name: Git::Remote::Check + version: 0.1.2 + - + class: Dist::Zilla::Plugin::TestRelease + name: TestRelease + version: '6.012' + - + class: Dist::Zilla::Plugin::RunExtraTests + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: RunExtraTests + version: '0.029' + - + class: Dist::Zilla::Plugin::UploadToCPAN + name: UploadToCPAN + version: '6.012' + - + class: Dist::Zilla::Plugin::ReadmeAnyFromPod + config: + Dist::Zilla::Role::FileWatcher: + version: '0.006' + name: Markdown_Readme + version: '0.163250' + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: develop + type: recommends + name: '@Git::VersionManager/pluginbundle version' + version: '6.012' + - + class: Dist::Zilla::Plugin::VersionFromMainModule + config: + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000033' + version: '0.006' + name: '@Git::VersionManager/VersionFromMainModule' + version: '0.04' + - + class: Dist::Zilla::Plugin::MetaProvides::Update + name: '@Git::VersionManager/MetaProvides::Update' + version: '0.007' + - + class: Dist::Zilla::Plugin::CopyFilesFromRelease + config: + Dist::Zilla::Plugin::CopyFilesFromRelease: + filename: + - Changes + match: [] + name: '@Git::VersionManager/CopyFilesFromRelease' + version: '0.007' + - + class: Dist::Zilla::Plugin::Git::Commit + config: + Dist::Zilla::Plugin::Git::Commit: + add_files_in: [] + commit_msg: '%N-%v%t%n%n%c' + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: + - Changes + - LICENSE + - README.md + allow_dirty_match: [] + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Git::VersionManager/release snapshot' + version: '2.043' + - + class: Dist::Zilla::Plugin::Git::Tag + config: + Dist::Zilla::Plugin::Git::Tag: + branch: ~ + changelog: Changes + signed: 0 + tag: v1.74 + tag_format: v%v + tag_message: v%v + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Git::VersionManager/Git::Tag' + version: '2.043' + - + class: Dist::Zilla::Plugin::BumpVersionAfterRelease + config: + Dist::Zilla::Plugin::BumpVersionAfterRelease: + finders: + - ':ExecFiles' + - ':InstallModules' + global: 0 + munge_makefile_pl: 1 + name: '@Git::VersionManager/BumpVersionAfterRelease' + version: '0.018' + - + class: Dist::Zilla::Plugin::NextRelease + name: '@Git::VersionManager/NextRelease' + version: '6.012' + - + class: Dist::Zilla::Plugin::Git::Commit + config: + Dist::Zilla::Plugin::Git::Commit: + add_files_in: [] + commit_msg: 'increment $VERSION after %v release' + Dist::Zilla::Role::Git::DirtyFiles: + allow_dirty: + - Build.PL + - Changes + - Makefile.PL + allow_dirty_match: + - (?^:^lib/.*\.pm$) + changelog: Changes + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + Dist::Zilla::Role::Git::StringFormatter: + time_zone: local + name: '@Git::VersionManager/post-release commit' + version: '2.043' + - + class: Dist::Zilla::Plugin::Git::Push + config: + Dist::Zilla::Plugin::Git::Push: + push_to: + - origin + remotes_must_exist: 1 + Dist::Zilla::Role::Git::Repo: + git_version: 2.14.2 + repo_root: . + name: Git::Push + version: '2.043' + - + class: Dist::Zilla::Plugin::ConfirmRelease + name: ConfirmRelease + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':IncModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':TestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExtraTestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':PerlExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ShareFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':MainModule' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':AllFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':NoFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: MetaProvides::Package/AUTOVIV/:InstallModulesPM + version: '6.012' + zilla: + class: Dist::Zilla::Dist::Builder + config: + is_trial: '0' + version: '6.012' +x_authority: cpan:LWWWP +x_contributors: + - 'Gisle Aas ' + - 'Karen Etheridge ' + - 'Chase Whitener ' + - 'Ville Skyttä ' + - 'Mark Stosberg ' + - 'Olaf Alders ' + - 'Michael G. Schwern ' + - 'Shoichi Kaji ' + - 'Slaven Rezic ' + - 'Kent Fredric ' + - 'Masahiro Honma ' + - 'Matt Lawrence ' + - 'Peter Rabbitson ' + - 'Piotr Roszatycki ' + - 'Salvatore Bonaccorso ' + - 'Tatsuhiko Miyagawa ' + - 'Torsten Förtsch ' + - 'Adam Herzog ' + - 'gerard ' + - 'Alex Kapranoff ' + - 'Brendan Byrd ' + - 'David Schmidt ' + - 'Jan Dubois ' + - 'John Karr ' + - 'John Miller ' + - 'Kaitlyn Parkhurst ' + - 'Kenichi Ishigaki ' +x_generated_by_perl: v5.27.11 +x_serialization_backend: 'YAML::Tiny version 1.73' diff --git a/Makefile.PL b/Makefile.PL index 2b548d8..18a402b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,51 +1,88 @@ -require 5.008001; +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. +use strict; +use warnings; + +use 5.008001; + use ExtUtils::MakeMaker; -WriteMakefile( - 'NAME' => 'URI', - 'VERSION_FROM' => 'URI.pm', - 'ABSTRACT' => 'Uniform Resource Identifiers (absolute and relative)', - 'AUTHOR' => 'Gisle Aas ', - 'LICENSE' => 'perl', - 'MIN_PERL_VERSION' => 5.008001, - 'PREREQ_PM' => { - 'MIME::Base64' => 2, - }, - 'META_MERGE' => { - 'recommends' => { - 'Business::ISBN' => 0, - }, - 'resources' => { - 'repository' => 'https://github.com/libwww-perl/uri', - 'MailingList' => 'mailto:libwww@perl.org', - } - }, - BUILD_REQUIRES => { - 'ExtUtils::MakeMaker' => 0, - 'Test' => 0, - 'Test::More' => 0, - }, +my %WriteMakefileArgs = ( + "ABSTRACT" => "Uniform Resource Identifiers (absolute and relative)", + "AUTHOR" => "Gisle Aas ", + "CONFIGURE_REQUIRES" => { + "ExtUtils::MakeMaker" => 0 + }, + "DISTNAME" => "URI", + "LICENSE" => "perl", + "MIN_PERL_VERSION" => "5.008001", + "NAME" => "URI", + "PREREQ_PM" => { + "Carp" => 0, + "Cwd" => 0, + "Data::Dumper" => 0, + "Encode" => 0, + "Exporter" => "5.57", + "MIME::Base64" => 2, + "Net::Domain" => 0, + "Scalar::Util" => 0, + "constant" => 0, + "integer" => 0, + "overload" => 0, + "parent" => 0, + "strict" => 0, + "utf8" => 0, + "warnings" => 0 + }, + "TEST_REQUIRES" => { + "ExtUtils::MakeMaker" => 0, + "File::Spec" => 0, + "File::Spec::Functions" => 0, + "File::Temp" => 0, + "Test" => 0, + "Test::More" => "0.96", + "Test::Needs" => 0, + "utf8" => 0 + }, + "VERSION" => "1.74", + "test" => { + "TESTS" => "t/*.t" + } ); -BEGIN { - # compatibility with older versions of MakeMaker - my $developer = -f ".gitignore"; - my %mm_req = ( - LICENCE => 6.31, - META_MERGE => 6.45, - META_ADD => 6.45, - MIN_PERL_VERSION => 6.48, - ); - undef(*WriteMakefile); - *WriteMakefile = sub { - my %arg = @_; - for (keys %mm_req) { - unless (eval { ExtUtils::MakeMaker->VERSION($mm_req{$_}) }) { - warn "$_ $@" if $developer; - delete $arg{$_}; - } - } - ExtUtils::MakeMaker::WriteMakefile(%arg); - }; +my %FallbackPrereqs = ( + "Carp" => 0, + "Cwd" => 0, + "Data::Dumper" => 0, + "Encode" => 0, + "Exporter" => "5.57", + "ExtUtils::MakeMaker" => 0, + "File::Spec" => 0, + "File::Spec::Functions" => 0, + "File::Temp" => 0, + "MIME::Base64" => 2, + "Net::Domain" => 0, + "Scalar::Util" => 0, + "Test" => 0, + "Test::More" => "0.96", + "Test::Needs" => 0, + "constant" => 0, + "integer" => 0, + "overload" => 0, + "parent" => 0, + "strict" => 0, + "utf8" => 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); diff --git a/README b/README deleted file mode 100644 index 31eb3cc..0000000 --- a/README +++ /dev/null @@ -1,30 +0,0 @@ -This package contains the URI.pm module with friends. The module -implements the URI class. Objects of this class represent Uniform -Resource Identifier references as specified in RFC 2396 and updated by -RFC 2732. - -URI objects can be used to access and manipulate the various -components that make up these strings. There are also methods to -combine URIs in various ways. - -Some tests require an Internet connection to work and are skipped if -one is not active. - -You need perl-5.8.1 or better to install this package. You should also -have the MIME::Base64 module installed. Installation is otherwise as -usual: - - perl Makefile.PL - make - make test - make install - -Questions about how to use this library should be directed to the -comp.lang.perl.modules USENET Newsgroup. Bug reports and suggestions -for improvements can be sent to the mailing list. - -Copyright 1998-2009 Gisle Aas. -Copyright 1998 Graham Barr. - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. diff --git a/URI/_foreign.pm b/URI/_foreign.pm deleted file mode 100644 index 075f0fd..0000000 --- a/URI/_foreign.pm +++ /dev/null @@ -1,6 +0,0 @@ -package URI::_foreign; - -require URI::_generic; -@ISA=qw(URI::_generic); - -1; diff --git a/URI/https.pm b/URI/https.pm deleted file mode 100644 index 94f9bb1..0000000 --- a/URI/https.pm +++ /dev/null @@ -1,9 +0,0 @@ -package URI::https; -require URI::http; -@ISA=qw(URI::http); - -sub default_port { 443 } - -sub secure { 1 } - -1; diff --git a/URI/ldaps.pm b/URI/ldaps.pm deleted file mode 100644 index cbf901b..0000000 --- a/URI/ldaps.pm +++ /dev/null @@ -1,9 +0,0 @@ -package URI::ldaps; -require URI::ldap; -@ISA=qw(URI::ldap); - -sub default_port { 636 } - -sub secure { 1 } - -1; diff --git a/URI/mms.pm b/URI/mms.pm deleted file mode 100644 index 2f1015b..0000000 --- a/URI/mms.pm +++ /dev/null @@ -1,8 +0,0 @@ -package URI::mms; - -require URI::http; -@ISA=qw(URI::http); - -sub default_port { 1755 } - -1; diff --git a/URI/nntp.pm b/URI/nntp.pm deleted file mode 100644 index af61e03..0000000 --- a/URI/nntp.pm +++ /dev/null @@ -1,6 +0,0 @@ -package URI::nntp; # draft-gilman-news-url-01 - -require URI::news; -@ISA=qw(URI::news); - -1; diff --git a/URI/rlogin.pm b/URI/rlogin.pm deleted file mode 100644 index 18bb762..0000000 --- a/URI/rlogin.pm +++ /dev/null @@ -1,7 +0,0 @@ -package URI::rlogin; -require URI::_login; -@ISA = qw(URI::_login); - -sub default_port { 513 } - -1; diff --git a/URI/rtsp.pm b/URI/rtsp.pm deleted file mode 100644 index 982ca5e..0000000 --- a/URI/rtsp.pm +++ /dev/null @@ -1,8 +0,0 @@ -package URI::rtsp; - -require URI::http; -@ISA=qw(URI::http); - -sub default_port { 554 } - -1; diff --git a/URI/rtspu.pm b/URI/rtspu.pm deleted file mode 100644 index dbcf12b..0000000 --- a/URI/rtspu.pm +++ /dev/null @@ -1,8 +0,0 @@ -package URI::rtspu; - -require URI::rtsp; -@ISA=qw(URI::rtsp); - -sub default_port { 554 } - -1; diff --git a/URI/sips.pm b/URI/sips.pm deleted file mode 100644 index 8d184a3..0000000 --- a/URI/sips.pm +++ /dev/null @@ -1,9 +0,0 @@ -package URI::sips; -require URI::sip; -@ISA=qw(URI::sip); - -sub default_port { 5061 } - -sub secure { 1 } - -1; diff --git a/URI/telnet.pm b/URI/telnet.pm deleted file mode 100644 index 5f842d3..0000000 --- a/URI/telnet.pm +++ /dev/null @@ -1,7 +0,0 @@ -package URI::telnet; -require URI::_login; -@ISA = qw(URI::_login); - -sub default_port { 23 } - -1; diff --git a/URI/tn3270.pm b/URI/tn3270.pm deleted file mode 100644 index dd1e648..0000000 --- a/URI/tn3270.pm +++ /dev/null @@ -1,7 +0,0 @@ -package URI::tn3270; -require URI::_login; -@ISA = qw(URI::_login); - -sub default_port { 23 } - -1; diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..5816a2d --- /dev/null +++ b/cpanfile @@ -0,0 +1,38 @@ +on 'configure' => sub { + requires "ExtUtils::MakeMaker" => "0"; + suggests "JSON::PP" => "2.27300"; +}; + +on 'develop' => sub { + requires "Test::CPAN::Changes" => "0.19"; + recommends 'Business::ISBN' => 0; + recommends "Storable" => "0"; +}; + +on 'runtime' => sub { + requires "Carp" => "0"; + requires "Cwd" => "0"; + requires "Data::Dumper" => "0"; + requires "Encode" => "0"; + requires "Exporter" => "5.57"; + requires "MIME::Base64" => "2"; + requires "Net::Domain" => "0"; + requires "Scalar::Util" => "0"; + requires "constant" => "0"; + requires "integer" => "0"; + requires "overload" => "0"; + requires "parent" => "0"; + requires "perl" => "5.008001"; + requires "strict" => "0"; + requires "warnings" => "0"; + requires "utf8" => '0'; +}; + +on 'test' => sub { + requires "File::Spec::Functions" => "0"; + requires "File::Temp" => "0"; + requires "Test" => "0"; + requires "Test::More" => "0.96"; + requires "Test::Needs" => '0'; + requires "utf8" => "0"; +}; diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..d550dd7 --- /dev/null +++ b/dist.ini @@ -0,0 +1,195 @@ +name = URI +author = Gisle Aas +license = Perl_5 +main_module = lib/URI.pm +copyright_holder = Gisle Aas +copyright_year = 1998 + +; for version management, see the end of this file + +; Gather stuff in +[Git::GatherDir] +exclude_filename = LICENSE +exclude_filename = README.md +exclude_filename = draft-duerst-iri-bis.txt +exclude_filename = rfc2396.txt +exclude_filename = rfc3986.txt +exclude_filename = rfc3987.txt + +[Encoding] +encoding = latin1 +filename = t/data.t +filename = t/escape.t +filename = t/http.t +filename = t/old-base.t +filename = t/pop.t +filename = t/rtsp.t +filename = uri-test + +; Handle the META resources +[MetaConfig] + +[MetaProvides::Package] +inherit_version = 0 +inherit_missing = 0 + +[MetaNoIndex] +directory = t +directory = xt +[MetaYAML] +[MetaJSON] +[MetaResources] +x_IRC = irc://irc.perl.org/#lwp +x_MailingList = mailto:libwww@perl.org + +[Git::Contributors] +version = 0.029 +order_by = commits + +[GithubMeta] +issues = 1 +user = libwww-perl +[Authority] +do_munging = 0 +authority = cpan:LWWWP +[Manifest] +[License] + +; make the bin dir executables +[ExecDir] +; [ShareDir] + +[Prereqs::FromCPANfile] + +[MakeMaker] + +[CheckChangesHasContent] +; TODO strict and warnings to quiet the kwalitee tests +; [Test::Kwalitee] +; filename = xt/author/kwalitee.t +[MojibakeTests] +[Test::Version] +[Test::ReportPrereqs] +[Test::Compile] +bail_out_on_fail = 1 +xt_mode = 1 + +[Test::Portability] +; TODO perltidy for NoTabs and namespace::autoclean +; [Test::CleanNamespaces] ; TODO +; [Test::NoTabs] ; TODO +; [Test::EOL] ; TODO +[MetaTests] +[Test::ChangesHasContent] +[Test::MinimumVersion] +[PodSyntaxTests] + +[Test::Pod::Coverage::Configurable] +skip = URI::IRI +skip = URI::_foreign +skip = URI::_idna +skip = URI::_login +skip = URI::_ldap +skip = URI::file::QNX +skip = URI::nntp +skip = URI::urn::isbn +skip = URI::urn::oid +skip = URI::sftp +trustme = URI => qr/^(?:STORABLE_freeze|STORABLE_thaw|TO_JSON|implementor)$/ +trustme = URI::Escape => qr/^(?:escape_char)$/ +trustme = URI::Heuristic => qr/^(?:MY_COUNTRY|uf_url|uf_urlstr)$/ +trustme = URI::URL => qr/^(?:address|article|crack|dos_path|encoded822addr|eparams|epath|frag)$/ +trustme = URI::URL => qr/^(?:full_path|groupart|keywords|local_path|mac_path|netloc|newlocal|params|path|path_components|print_on|query|strict|unix_path|url|vms_path)$/ +trustme = URI::WithBase => qr/^(?:can|clone|eq|new_abs)$/ +trustme = URI::_punycode => qr/^(?:adapt|code_point|digit_value|min)$/ +trustme = URI::_query => qr/^(?:equery|query|query_form|query_form_hash|query_keywords|query_param|query_param_append|query_param_delete)$/ +trustme = URI::_segment => qr/^(?:new)$/ +trustme = URI::_userpass => qr/^(?:password|user)$/ +trustme = URI::file => qr/^(?:os_class)$/ +trustme = URI::file::Base => qr/^(?:dir|file|new)$/ +trustme = URI::file::FAT => qr/^(?:fix_path)$/ +trustme = URI::file::Mac => qr/^(?:dir|file)$/ +trustme = URI::file::OS2 => qr/^(?:file)$/ +trustme = URI::file::Unix => qr/^(?:file)$/ +trustme = URI::file::Win32 => qr/^(?:file|fix_path)$/ +trustme = URI::ftp => qr/^(?:password|user)$/ +trustme = URI::gopher => qr/^(?:gopher_type|gtype|search|selector|string)$/ +trustme = URI::ldapi => qr/^(?:un_path)$/ +trustme = URI::mailto => qr/^(?:headers|to)$/ +trustme = URI::news => qr/^(?:group|message)$/ +trustme = URI::pop => qr/^(?:auth|user)$/ +trustme = URI::sip => qr/^(?:params|params_form)$/ +trustme = URI::urn => qr/^(?:nid|nss)$/ + +[Test::PodSpelling] +wordlist = Pod::Wordlist +spell_cmd = aspell list +stopword = Berners +stopword = ISBNs +stopword = Masinter +stopword = OIDs +stopword = TCP +stopword = TLS +stopword = UDP +stopword = UNC +stopword = lowercasing +stopword = relativize +stopword = uppercasing +stopword = IDNA +stopword = OpenLDAP +stopword = etype +stopword = evalue +stopword = Punycode +stopword = Koster +stopword = Martijn + + +;;; pre-release actions + +[CheckStrictVersion] +decimal_only = 1 + +[Git::Check] +allow_dirty = + +[Git::CheckFor::MergeConflicts] +[Git::CheckFor::CorrectBranch] +:version = 0.004 +release_branch = master + +[Git::Remote::Check] +branch = master +remote_branch = master + +[TestRelease] +[RunExtraTests] + +;;; release actions +[UploadToCPAN] + + +;;; post-release actions + +[ReadmeAnyFromPod / Markdown_Readme] +source_filename = lib/URI.pm +type = markdown +filename = README.md +location = root +phase = release + +; the distribution version is read from lib/URI.pm's $VERSION. +; at release, all matching versions are bumped. +; To change the release version, update *every* .pm file's +; $VERSION. You can do this easily with this oneliner (e.g. for 1.70 -> 2.00): +; perl -p -i -e's/.VERSION = .\K1.70/2.00/;' `find lib -type f` +; (and don't forget to add $VERSION = eval $VERSION; for underscore releases!) +[@Git::VersionManager] +:version = 0.003 +bump_only_matching_versions = 1 +commit_files_after_release = LICENSE +commit_files_after_release = README.md +release snapshot.commit_msg = %N-%v%t%n%n%c + +[Git::Push] + +[ConfirmRelease] diff --git a/URI.pm b/lib/URI.pm similarity index 94% rename from URI.pm rename to lib/URI.pm index eb1970e..a513c2e 100644 --- a/URI.pm +++ b/lib/URI.pm @@ -1,22 +1,22 @@ package URI; use strict; -use vars qw($VERSION); -$VERSION = "1.60"; +use warnings; -use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER); +our $VERSION = '1.74'; + +our ($ABS_REMOTE_LEADING_DOTS, $ABS_ALLOW_RELATIVE_SCHEME, $DEFAULT_QUERY_FORM_DELIMITER); my %implements; # mapping from scheme to implementor class # Some "official" character classes -use vars qw($reserved $mark $unreserved $uric $scheme_re); -$reserved = q(;/?:@&=+$,[]); -$mark = q(-_.!~*'()); #'; emacs -$unreserved = "A-Za-z0-9\Q$mark\E"; -$uric = quotemeta($reserved) . $unreserved . "%"; +our $reserved = q(;/?:@&=+$,[]); +our $mark = q(-_.!~*'()); #'; emacs +our $unreserved = "A-Za-z0-9\Q$mark\E"; +our $uric = quotemeta($reserved) . $unreserved . "%"; -$scheme_re = '[a-zA-Z][a-zA-Z0-9.+\-]*'; +our $scheme_re = '[a-zA-Z][a-zA-Z0-9.+\-]*'; use Carp (); use URI::Escape (); @@ -94,6 +94,7 @@ sub _uric_escape return $str; } +my %require_attempted; sub implementor { @@ -128,10 +129,14 @@ sub implementor no strict 'refs'; # check we actually have one for the scheme: unless (@{"${ic}::ISA"}) { - # Try to load it - eval "require $ic"; - die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/; - return unless @{"${ic}::ISA"}; + if (not exists $require_attempted{$ic}) { + # Try to load it + my $_old_error = $@; + eval "require $ic"; + die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/; + $@ = $_old_error; + } + return undef unless @{"${ic}::ISA"}; } $ic->_init_implementor($scheme); @@ -155,6 +160,7 @@ sub clone bless \$other, ref $self; } +sub TO_JSON { ${$_[0]} } sub _no_scheme_ok { 0 } @@ -163,7 +169,7 @@ sub _scheme my $self = shift; unless (@_) { - return unless $$self =~ /^($scheme_re):/o; + return undef unless $$self =~ /^($scheme_re):/o; return $1; } @@ -193,10 +199,14 @@ sub _scheme sub scheme { my $scheme = shift->_scheme(@_); - return unless defined $scheme; + return undef unless defined $scheme; lc($scheme); } +sub has_recognized_scheme { + my $self = shift; + return ref($self) !~ /^URI::_(?:foreign|generic)\z/; +} sub opaque { @@ -228,14 +238,14 @@ sub opaque $old_opaque; } -*path = \&opaque; # alias +sub path { goto &opaque } # alias sub fragment { my $self = shift; unless (@_) { - return unless $$self =~ /\#(.*)/s; + return undef unless $$self =~ /\#(.*)/s; return $1; } @@ -347,6 +357,8 @@ URI - Uniform Resource Identifiers (absolute and relative) =head1 SYNOPSIS + use URI; + $u1 = URI->new("http://www.perl.com"); $u2 = URI->new("foo", "http"); $u3 = $u2->abs($u1); @@ -417,6 +429,11 @@ the $str argument before it is processed further. The constructor determines the scheme, maps this to an appropriate URI subclass, constructs a new object of that class and returns it. +If the scheme isn't one of those that URI recognizes, you still get +an URI object back that you can access the generic methods on. The +C<< $uri->has_recognized_scheme >> method can be used to test for +this. + The $scheme argument is only used when $str is a relative URI. It can be either a simple string that denotes the scheme, a string containing an absolute URI reference, or @@ -500,6 +517,14 @@ returned by $uri->scheme is always lowercase. If you want the scheme just as it was written in the URI in its original case, you can use the $uri->_scheme method instead. +=item $uri->has_recognized_scheme + +Returns TRUE if the URI scheme is one that URI recognizes. + +It will also be TRUE for relative URLs where a recognized +scheme was provided to the constructor, even if C<< $uri->scheme >> +returns C for these. + =item $uri->opaque =item $uri->opaque( $new_opaque ) @@ -585,7 +610,7 @@ a secure channel, such as an SSL or TLS encrypted one. The following methods are available to schemes that use the common/generic syntax for hierarchical namespaces. The descriptions of -schemes below indicate which these are. Unknown schemes are +schemes below indicate which these are. Unrecognized schemes are assumed to support the generic syntax, and therefore the following methods: @@ -972,6 +997,12 @@ C objects belonging to the ssh scheme support the common, generic and server methods. In addition, they provide methods to access the userinfo sub-components: $uri->user and $uri->password. +=item B: + +C objects belonging to the sftp scheme support the common, +generic and server methods. In addition, they provide methods to +access the userinfo sub-components: $uri->user and $uri->password. + =item B: The syntax of Uniform Resource Names is specified in RFC 2141. C diff --git a/URI/Escape.pm b/lib/URI/Escape.pm similarity index 92% rename from URI/Escape.pm rename to lib/URI/Escape.pm index e09d76a..f9392d4 100644 --- a/URI/Escape.pm +++ b/lib/URI/Escape.pm @@ -1,5 +1,7 @@ package URI::Escape; + use strict; +use warnings; =head1 NAME @@ -135,8 +137,7 @@ it under the same terms as Perl itself. =cut -require Exporter; -our @ISA = qw(Exporter); +use Exporter 5.57 'import'; our %escapes; our @EXPORT = qw(uri_escape uri_unescape uri_escape_utf8); our @EXPORT_OK = qw(%escapes); @@ -180,6 +181,7 @@ sub _fail_hi { sub uri_escape_utf8 { my $text = shift; + return undef unless defined $text; utf8::encode($text); return uri_escape($text, @_); } @@ -201,8 +203,19 @@ sub uri_unescape { $str; } +# XXX FIXME escape_char is buggy as it assigns meaning to the string's storage format. sub escape_char { - return join '', @URI::Escape::escapes{$_[0] =~ /(\C)/g}; + # Old versions of utf8::is_utf8() didn't properly handle magical vars (e.g. $1). + # The following forces a fetch to occur beforehand. + my $dummy = substr($_[0], 0, 0); + + if (utf8::is_utf8($_[0])) { + my $s = shift; + utf8::encode($s); + unshift(@_, $s); + } + + return join '', @URI::Escape::escapes{split //, $_[0]}; } 1; diff --git a/URI/Heuristic.pm b/lib/URI/Heuristic.pm similarity index 96% rename from URI/Heuristic.pm rename to lib/URI/Heuristic.pm index 71ad8da..d4ace34 100644 --- a/URI/Heuristic.pm +++ b/lib/URI/Heuristic.pm @@ -87,13 +87,13 @@ modify it under the same terms as Perl itself. =cut use strict; +use warnings; -use vars qw(@EXPORT_OK $VERSION $MY_COUNTRY %LOCAL_GUESSING $DEBUG); +use Exporter 5.57 'import'; +our @EXPORT_OK = qw(uf_uri uf_uristr uf_url uf_urlstr); +our $VERSION = "4.20"; -require Exporter; -*import = \&Exporter::import; -@EXPORT_OK = qw(uf_uri uf_uristr uf_url uf_urlstr); -$VERSION = "4.20"; +our ($MY_COUNTRY, $DEBUG); sub MY_COUNTRY() { for ($MY_COUNTRY) { @@ -131,7 +131,7 @@ sub MY_COUNTRY() { } } -%LOCAL_GUESSING = +our %LOCAL_GUESSING = ( 'us' => [qw(www.ACME.gov www.ACME.mil)], 'gb' => [qw(www.ACME.co.uk www.ACME.org.uk www.ACME.ac.uk)], diff --git a/URI/IRI.pm b/lib/URI/IRI.pm similarity index 93% rename from URI/IRI.pm rename to lib/URI/IRI.pm index 39336fc..3017c38 100644 --- a/URI/IRI.pm +++ b/lib/URI/IRI.pm @@ -3,10 +3,13 @@ package URI::IRI; # Experimental use strict; +use warnings; use URI (); use overload '""' => sub { shift->as_string }; +our $VERSION = '1.74'; + sub new { my($class, $uri, $scheme) = @_; utf8::upgrade($uri); @@ -27,9 +30,9 @@ sub as_string { return $self->{uri}->as_iri; } +our $AUTOLOAD; sub AUTOLOAD { - use vars qw($AUTOLOAD); my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::')+2); # We create the function here so that it will not need to be diff --git a/URI/QueryParam.pm b/lib/URI/QueryParam.pm similarity index 94% rename from URI/QueryParam.pm rename to lib/URI/QueryParam.pm index c202fea..73d56dd 100644 --- a/URI/QueryParam.pm +++ b/lib/URI/QueryParam.pm @@ -1,6 +1,9 @@ package URI::QueryParam; use strict; +use warnings; + +our $VERSION = '1.74'; sub URI::_query::query_param { my $self = shift; @@ -138,6 +141,17 @@ parameters with the given key. If any of the values provided are array references, then the array is dereferenced to get the actual values. +Please note that you can supply multiple values to this method, but you cannot +supply multiple keys. + +Do this: + + $uri->query_param( widget_id => 1, 5, 9 ); + +Do NOT do this: + + $uri->query_param( widget_id => 1, frobnicator_id => 99 ); + =item $u->query_param_append($key, $value,...) Adds new parameters with the given diff --git a/URI/Split.pm b/lib/URI/Split.pm similarity index 95% rename from URI/Split.pm rename to lib/URI/Split.pm index ad430b9..1fcc08e 100644 --- a/URI/Split.pm +++ b/lib/URI/Split.pm @@ -1,11 +1,12 @@ package URI::Split; use strict; +use warnings; -use vars qw(@ISA @EXPORT_OK); -require Exporter; -@ISA = qw(Exporter); -@EXPORT_OK = qw(uri_split uri_join); +our $VERSION = '1.74'; + +use Exporter 5.57 'import'; +our @EXPORT_OK = qw(uri_split uri_join); use URI::Escape (); diff --git a/URI/URL.pm b/lib/URI/URL.pm similarity index 95% rename from URI/URL.pm rename to lib/URI/URL.pm index 81bf47d..ba05eca 100644 --- a/URI/URL.pm +++ b/lib/URI/URL.pm @@ -1,19 +1,17 @@ package URI::URL; -require URI::WithBase; -@ISA=qw(URI::WithBase); - use strict; -use vars qw(@EXPORT $VERSION); +use warnings; + +use parent 'URI::WithBase'; -$VERSION = "5.04"; +our $VERSION = "5.04"; # Provide as much as possible of the old URI::URL interface for backwards # compatibility... -require Exporter; -*import = \&Exporter::import; -@EXPORT = qw(url); +use Exporter 5.57 'import'; +our @EXPORT = qw(url); # Easy to use constructor sub url ($;$) { URI::URL->new(@_); } @@ -105,7 +103,7 @@ sub eparams { my $self = shift; my @p = $self->path_segments; - return unless ref($p[-1]); + return undef unless ref($p[-1]); @p = @{$p[-1]}; shift @p; join(";", @p); @@ -144,7 +142,7 @@ sub query { Carp::croak("$mess (you must call equery)"); } } - # Now it should be safe to unescape the string without loosing + # Now it should be safe to unescape the string without losing # information return uri_unescape($old); } diff --git a/URI/WithBase.pm b/lib/URI/WithBase.pm similarity index 94% rename from URI/WithBase.pm rename to lib/URI/WithBase.pm index 4300a2a..943b7b5 100644 --- a/URI/WithBase.pm +++ b/lib/URI/WithBase.pm @@ -1,10 +1,12 @@ package URI::WithBase; use strict; -use vars qw($AUTOLOAD $VERSION); +use warnings; + use URI; +use Scalar::Util 'blessed'; -$VERSION = "2.20"; +our $VERSION = "2.20"; use overload '""' => "as_string", fallback => 1; @@ -14,7 +16,7 @@ sub new { my($class, $uri, $base) = @_; my $ibase = $base; - if ($base && ref($base) && UNIVERSAL::isa($base, __PACKAGE__)) { + if ($base && blessed($base) && $base->isa(__PACKAGE__)) { $base = $base->abs; $ibase = $base->[0]; } @@ -38,10 +40,11 @@ sub _init sub eq { my($self, $other) = @_; - $other = $other->[0] if UNIVERSAL::isa($other, __PACKAGE__); + $other = $other->[0] if blessed($other) and $other->isa(__PACKAGE__); $self->[0]->eq($other); } +our $AUTOLOAD; sub AUTOLOAD { my $self = shift; diff --git a/lib/URI/_foreign.pm b/lib/URI/_foreign.pm new file mode 100644 index 0000000..e48870e --- /dev/null +++ b/lib/URI/_foreign.pm @@ -0,0 +1,10 @@ +package URI::_foreign; + +use strict; +use warnings; + +use parent 'URI::_generic'; + +our $VERSION = '1.74'; + +1; diff --git a/URI/_generic.pm b/lib/URI/_generic.pm similarity index 97% rename from URI/_generic.pm rename to lib/URI/_generic.pm index 979087b..5a543aa 100644 --- a/URI/_generic.pm +++ b/lib/URI/_generic.pm @@ -1,12 +1,15 @@ package URI::_generic; -require URI; -require URI::_query; -@ISA=qw(URI URI::_query); use strict; +use warnings; + +use parent qw(URI URI::_query); + use URI::Escape qw(uri_unescape); use Carp (); +our $VERSION = '1.74'; + my $ACHAR = $URI::uric; $ACHAR =~ s,\\[/?],,g; my $PCHAR = $URI::uric; $PCHAR =~ s,\\[?],,g; @@ -148,7 +151,8 @@ sub abs my $abs = $base->clone; my $query = $self->query; $abs->query($query) if defined $query; - $abs->fragment($self->fragment); + my $fragment = $self->fragment; + $abs->fragment($fragment) if defined $fragment; return $abs; } diff --git a/URI/_idna.pm b/lib/URI/_idna.pm similarity index 95% rename from URI/_idna.pm rename to lib/URI/_idna.pm index 8b9eab7..df9327c 100644 --- a/URI/_idna.pm +++ b/lib/URI/_idna.pm @@ -4,11 +4,15 @@ package URI::_idna; # based on Python-2.6.4/Lib/encodings/idna.py use strict; +use warnings; + use URI::_punycode qw(encode_punycode decode_punycode); use Carp qw(croak); +our $VERSION = '1.74'; + BEGIN { - *URI::_idna::_ENV_::JOIN_LEAKS_UTF8_FLAGS = $] < 5.008_003 + *URI::_idna::_ENV_::JOIN_LEAKS_UTF8_FLAGS = "$]" < 5.008_003 ? sub () { 1 } : sub () { 0 } ; diff --git a/URI/_ldap.pm b/lib/URI/_ldap.pm similarity index 95% rename from URI/_ldap.pm rename to lib/URI/_ldap.pm index d767364..6036a4e 100644 --- a/URI/_ldap.pm +++ b/lib/URI/_ldap.pm @@ -5,9 +5,9 @@ package URI::_ldap; use strict; +use warnings; -use vars qw($VERSION); -$VERSION = "1.12"; +our $VERSION = '1.74'; use URI::Escape qw(uri_unescape); @@ -47,7 +47,7 @@ sub attributes { sub _scope { my $self = shift; my $old = _ldap_elem($self,1, @_); - return unless defined wantarray && defined $old; + return undef unless defined wantarray && defined $old; uri_unescape($old); } @@ -60,7 +60,7 @@ sub scope { sub _filter { my $self = shift; my $old = _ldap_elem($self,2, @_); - return unless defined wantarray && defined $old; + return undef unless defined wantarray && defined $old; uri_unescape($old); # || "(objectClass=*)"; } diff --git a/URI/_login.pm b/lib/URI/_login.pm similarity index 58% rename from URI/_login.pm rename to lib/URI/_login.pm index 4583f20..0fcadf3 100644 --- a/URI/_login.pm +++ b/lib/URI/_login.pm @@ -1,8 +1,11 @@ package URI::_login; -require URI::_server; -require URI::_userpass; -@ISA = qw(URI::_server URI::_userpass); +use strict; +use warnings; + +use parent qw(URI::_server URI::_userpass); + +our $VERSION = '1.74'; # Generic terminal logins. This is used as a base class for 'telnet', # 'tn3270', and 'rlogin' URL schemes. diff --git a/URI/_punycode.pm b/lib/URI/_punycode.pm similarity index 65% rename from URI/_punycode.pm rename to lib/URI/_punycode.pm index db40091..cb7b099 100644 --- a/URI/_punycode.pm +++ b/lib/URI/_punycode.pm @@ -1,10 +1,11 @@ package URI::_punycode; use strict; -our $VERSION = "0.04"; +use warnings; -require Exporter; -our @ISA = qw(Exporter); +our $VERSION = '1.74'; + +use Exporter 'import'; our @EXPORT = qw(encode_punycode decode_punycode); use integer; @@ -145,58 +146,72 @@ sub min { 1; __END__ +=encoding utf8 + =head1 NAME URI::_punycode - encodes Unicode string in Punycode =head1 SYNOPSIS - use URI::_punycode; - $punycode = encode_punycode($unicode); - $unicode = decode_punycode($punycode); + use strict; + use warnings; + use utf8; -=head1 DESCRIPTION + use URI::_punycode qw(encode_punycode decode_punycode); -URI::_punycode is a module to encode / decode Unicode strings into -Punycode, an efficient encoding of Unicode for use with IDNA. + # encode a unicode string + my $punycode = encode_punycode('http://☃.net'); # http://.net-xc8g + $punycode = encode_punycode('bücher'); # bcher-kva + $punycode = encode_punycode('他们为什么不说中文'); # ihqwcrb4cv8a8dqg056pqjye -This module requires Perl 5.6.0 or over to handle UTF8 flagged Unicode -strings. + # decode a punycode string back into a unicode string + my $unicode = decode_punycode('http://.net-xc8g'); # http://☃.net + $unicode = decode_punycode('bcher-kva'); # bücher + $unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文 -=head1 FUNCTIONS +=head1 DESCRIPTION + +L is a module to encode / decode Unicode strings into +L, an efficient +encoding of Unicode for use with L. -This module exports following functions by default. +=head1 FUNCTIONS -=over 4 +All functions throw exceptions on failure. You can C them with +L or L. The following functions are exported +by default. -=item encode_punycode +=head2 encode_punycode - $punycode = encode_punycode($unicode); + my $punycode = encode_punycode('http://☃.net'); # http://.net-xc8g + $punycode = encode_punycode('bücher'); # bcher-kva + $punycode = encode_punycode('他们为什么不说中文') # ihqwcrb4cv8a8dqg056pqjye -takes Unicode string (UTF8-flagged variable) and returns Punycode +Takes a Unicode string (UTF8-flagged variable) and returns a Punycode encoding for it. -=item decode_punycode +=head2 decode_punycode - $unicode = decode_punycode($punycode) + my $unicode = decode_punycode('http://.net-xc8g'); # http://☃.net + $unicode = decode_punycode('bcher-kva'); # bücher + $unicode = decode_punycode('ihqwcrb4cv8a8dqg056pqjye'); # 他们为什么不说中文 -takes Punycode encoding and returns original Unicode string. +Takes a Punycode encoding and returns original Unicode string. -=back +=head1 AUTHOR -These functions throw exceptions on failure. You can catch 'em via -C. +Tatsuhiko Miyagawa > is the author of +L which was the basis for this module. -=head1 AUTHOR +=head1 SEE ALSO + +L, L, +L -Tatsuhiko Miyagawa Emiyagawa@bulknews.netE is the author of -IDNA::Punycode v0.02 which was the basis for this module. +=head1 COPYRIGHT AND LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. -=head1 SEE ALSO - -L, RFC 3492 - =cut diff --git a/URI/_query.pm b/lib/URI/_query.pm similarity index 95% rename from URI/_query.pm rename to lib/URI/_query.pm index a6038a3..bee1533 100644 --- a/URI/_query.pm +++ b/lib/URI/_query.pm @@ -1,9 +1,13 @@ package URI::_query; use strict; +use warnings; + use URI (); use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; + sub query { my $self = shift; @@ -36,7 +40,7 @@ sub query_form { } elsif (ref($r) eq "HASH") { $delim = $_[1]; - @_ = %$r; + @_ = map { $_ => $r->{$_} } sort keys %$r; } $delim = pop if @_ % 2; @@ -88,6 +92,6 @@ sub query_keywords } # Some URI::URL compatibility stuff -*equery = \&query; +sub equery { goto &query } 1; diff --git a/URI/_segment.pm b/lib/URI/_segment.pm similarity index 90% rename from URI/_segment.pm rename to lib/URI/_segment.pm index c91b696..f060957 100644 --- a/URI/_segment.pm +++ b/lib/URI/_segment.pm @@ -4,11 +4,15 @@ package URI::_segment; # a string too. use strict; +use warnings; + use URI::Escape qw(uri_unescape); use overload '""' => sub { $_[0]->[0] }, fallback => 1; +our $VERSION = '1.74'; + sub new { my $class = shift; diff --git a/URI/_server.pm b/lib/URI/_server.pm similarity index 96% rename from URI/_server.pm rename to lib/URI/_server.pm index f72ec22..fce66b9 100644 --- a/URI/_server.pm +++ b/lib/URI/_server.pm @@ -1,10 +1,14 @@ package URI::_server; -require URI::_generic; -@ISA=qw(URI::_generic); use strict; +use warnings; + +use parent 'URI::_generic'; + use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; + sub _uric_escape { my($class, $str) = @_; if ($str =~ m,^((?:$URI::scheme_re:)?)//([^/?\#]*)(.*)$,os) { @@ -19,7 +23,7 @@ sub _uric_escape { } sub _host_escape { - return unless $_[0] =~ /[^URI::uric]/; + return unless $_[0] =~ /[^$URI::uric]/; eval { require URI::_idna; $_[0] = URI::_idna::encode($_[0]); diff --git a/URI/_userpass.pm b/lib/URI/_userpass.pm similarity index 84% rename from URI/_userpass.pm rename to lib/URI/_userpass.pm index a0361ae..d4c34f5 100644 --- a/URI/_userpass.pm +++ b/lib/URI/_userpass.pm @@ -1,8 +1,12 @@ package URI::_userpass; use strict; +use warnings; + use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; + sub user { my $self = shift; @@ -21,7 +25,7 @@ sub user $self->userinfo("$new$pass"); } } - return unless defined $info; + return undef unless defined $info; $info =~ s/:.*//; uri_unescape($info); } @@ -43,8 +47,8 @@ sub password $self->userinfo("$user:$new"); } } - return unless defined $info; - return unless $info =~ s/^[^:]*://; + return undef unless defined $info; + return undef unless $info =~ s/^[^:]*://; uri_unescape($info); } diff --git a/URI/data.pm b/lib/URI/data.pm similarity index 98% rename from URI/data.pm rename to lib/URI/data.pm index dccd818..4e14fa0 100644 --- a/URI/data.pm +++ b/lib/URI/data.pm @@ -1,9 +1,11 @@ package URI::data; # RFC 2397 -require URI; -@ISA=qw(URI); - use strict; +use warnings; + +use parent 'URI'; + +our $VERSION = '1.74'; use MIME::Base64 qw(encode_base64 decode_base64); use URI::Escape qw(uri_unescape); diff --git a/URI/file.pm b/lib/URI/file.pm similarity index 98% rename from URI/file.pm rename to lib/URI/file.pm index 5a1e2b5..d76ddf2 100644 --- a/URI/file.pm +++ b/lib/URI/file.pm @@ -1,19 +1,18 @@ package URI::file; use strict; -use vars qw(@ISA $VERSION $DEFAULT_AUTHORITY %OS_CLASS); +use warnings; -require URI::_generic; -@ISA = qw(URI::_generic); -$VERSION = "4.21"; +use parent 'URI::_generic'; +our $VERSION = "4.21"; use URI::Escape qw(uri_unescape); -$DEFAULT_AUTHORITY = ""; +our $DEFAULT_AUTHORITY = ""; # Map from $^O values to implementation classes. The Unix # class is the default. -%OS_CLASS = ( +our %OS_CLASS = ( os2 => "OS2", mac => "Mac", MacOS => "Mac", diff --git a/URI/file/Base.pm b/lib/URI/file/Base.pm similarity index 91% rename from URI/file/Base.pm rename to lib/URI/file/Base.pm index 941793b..8f11dda 100644 --- a/URI/file/Base.pm +++ b/lib/URI/file/Base.pm @@ -1,8 +1,12 @@ package URI::file::Base; use strict; +use warnings; + use URI::Escape qw(); +our $VERSION = '1.74'; + sub new { my $class = shift; @@ -61,8 +65,8 @@ sub _file_is_localhost return 1 if $host eq "localhost"; eval { require Net::Domain; - lc(Net::Domain::hostfqdn()) eq $host || - lc(Net::Domain::hostname()) eq $host; + lc(Net::Domain::hostfqdn() || '') eq $host || + lc(Net::Domain::hostname() || '') eq $host; }; } diff --git a/URI/file/FAT.pm b/lib/URI/file/FAT.pm similarity index 83% rename from URI/file/FAT.pm rename to lib/URI/file/FAT.pm index 328169b..7e77955 100644 --- a/URI/file/FAT.pm +++ b/lib/URI/file/FAT.pm @@ -1,7 +1,11 @@ package URI::file::FAT; -require URI::file::Win32; -@ISA=qw(URI::file::Win32); +use strict; +use warnings; + +use parent 'URI::file::Win32'; + +our $VERSION = '1.74'; sub fix_path { diff --git a/URI/file/Mac.pm b/lib/URI/file/Mac.pm similarity index 97% rename from URI/file/Mac.pm rename to lib/URI/file/Mac.pm index 6cfa781..7372613 100644 --- a/URI/file/Mac.pm +++ b/lib/URI/file/Mac.pm @@ -1,12 +1,13 @@ package URI::file::Mac; -require URI::file::Base; -@ISA=qw(URI::file::Base); - use strict; -use URI::Escape qw(uri_unescape); +use warnings; +use parent 'URI::file::Base'; + +use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; sub _file_extract_path { diff --git a/URI/file/OS2.pm b/lib/URI/file/OS2.pm similarity index 85% rename from URI/file/OS2.pm rename to lib/URI/file/OS2.pm index ad0a78e..ee3ef9b 100644 --- a/URI/file/OS2.pm +++ b/lib/URI/file/OS2.pm @@ -1,7 +1,11 @@ package URI::file::OS2; -require URI::file::Win32; -@ISA=qw(URI::file::Win32); +use strict; +use warnings; + +use parent 'URI::file::Win32'; + +our $VERSION = '1.74'; # The Win32 version translates k:/foo to file://k:/foo (?!) # We add an empty host diff --git a/URI/file/QNX.pm b/lib/URI/file/QNX.pm similarity index 79% rename from URI/file/QNX.pm rename to lib/URI/file/QNX.pm index 93a4983..fdb4c4c 100644 --- a/URI/file/QNX.pm +++ b/lib/URI/file/QNX.pm @@ -1,9 +1,11 @@ package URI::file::QNX; -require URI::file::Unix; -@ISA=qw(URI::file::Unix); - use strict; +use warnings; + +use parent 'URI::file::Unix'; + +our $VERSION = '1.74'; sub _file_extract_path { diff --git a/URI/file/Unix.pm b/lib/URI/file/Unix.pm similarity index 93% rename from URI/file/Unix.pm rename to lib/URI/file/Unix.pm index 5f8aaae..fedeb8d 100644 --- a/URI/file/Unix.pm +++ b/lib/URI/file/Unix.pm @@ -1,11 +1,14 @@ package URI::file::Unix; -require URI::file::Base; -@ISA=qw(URI::file::Base); - use strict; +use warnings; + +use parent 'URI::file::Base'; + use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; + sub _file_extract_path { my($class, $path) = @_; diff --git a/URI/file/Win32.pm b/lib/URI/file/Win32.pm similarity index 96% rename from URI/file/Win32.pm rename to lib/URI/file/Win32.pm index 0459386..f8e2005 100644 --- a/URI/file/Win32.pm +++ b/lib/URI/file/Win32.pm @@ -1,11 +1,14 @@ package URI::file::Win32; -require URI::file::Base; -@ISA=qw(URI::file::Base); - use strict; +use warnings; + +use parent 'URI::file::Base'; + use URI::Escape qw(uri_unescape); +our $VERSION = '1.74'; + sub _file_extract_authority { my $class = shift; diff --git a/URI/ftp.pm b/lib/URI/ftp.pm similarity index 92% rename from URI/ftp.pm rename to lib/URI/ftp.pm index 89aeb07..23e8cfa 100644 --- a/URI/ftp.pm +++ b/lib/URI/ftp.pm @@ -1,10 +1,11 @@ package URI::ftp; -require URI::_server; -require URI::_userpass; -@ISA=qw(URI::_server URI::_userpass); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent qw(URI::_server URI::_userpass); sub default_port { 21 } diff --git a/URI/gopher.pm b/lib/URI/gopher.pm similarity index 94% rename from URI/gopher.pm rename to lib/URI/gopher.pm index ae66904..0708278 100644 --- a/URI/gopher.pm +++ b/lib/URI/gopher.pm @@ -1,9 +1,12 @@ package URI::gopher; # , Dec 4, 1996 -require URI::_server; -@ISA=qw(URI::_server); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_server'; + use URI::Escape qw(uri_unescape); # A Gopher URL follows the common internet scheme syntax as defined in @@ -58,7 +61,7 @@ sub gopher_type $gtype; } -*gtype = \&gopher_type; # URI::URL compatibility +sub gtype { goto &gopher_type } # URI::URL compatibility sub selector { shift->_gfield(0, @_) } sub search { shift->_gfield(1, @_) } diff --git a/URI/http.pm b/lib/URI/http.pm similarity index 84% rename from URI/http.pm rename to lib/URI/http.pm index cb69822..1e80765 100644 --- a/URI/http.pm +++ b/lib/URI/http.pm @@ -1,9 +1,11 @@ package URI::http; -require URI::_server; -@ISA=qw(URI::_server); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_server'; sub default_port { 80 } diff --git a/lib/URI/https.pm b/lib/URI/https.pm new file mode 100644 index 0000000..96b327d --- /dev/null +++ b/lib/URI/https.pm @@ -0,0 +1,14 @@ +package URI::https; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::http'; + +sub default_port { 443 } + +sub secure { 1 } + +1; diff --git a/URI/ldap.pm b/lib/URI/ldap.pm similarity index 95% rename from URI/ldap.pm rename to lib/URI/ldap.pm index 378a942..2bf684b 100644 --- a/URI/ldap.pm +++ b/lib/URI/ldap.pm @@ -5,13 +5,11 @@ package URI::ldap; use strict; +use warnings; -use vars qw(@ISA $VERSION); -$VERSION = "1.12"; +our $VERSION = '1.74'; -require URI::_server; -require URI::_ldap; -@ISA=qw(URI::_ldap URI::_server); +use parent qw(URI::_ldap URI::_server); sub default_port { 389 } diff --git a/URI/ldapi.pm b/lib/URI/ldapi.pm similarity index 78% rename from URI/ldapi.pm rename to lib/URI/ldapi.pm index d92b13f..3176082 100644 --- a/URI/ldapi.pm +++ b/lib/URI/ldapi.pm @@ -1,12 +1,11 @@ package URI::ldapi; use strict; +use warnings; -use vars qw(@ISA); +our $VERSION = '1.74'; -require URI::_generic; -require URI::_ldap; -@ISA=qw(URI::_ldap URI::_generic); +use parent qw(URI::_ldap URI::_generic); require URI::Escape; diff --git a/lib/URI/ldaps.pm b/lib/URI/ldaps.pm new file mode 100644 index 0000000..4f39165 --- /dev/null +++ b/lib/URI/ldaps.pm @@ -0,0 +1,14 @@ +package URI::ldaps; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::ldap'; + +sub default_port { 636 } + +sub secure { 1 } + +1; diff --git a/URI/mailto.pm b/lib/URI/mailto.pm similarity index 94% rename from URI/mailto.pm rename to lib/URI/mailto.pm index 88761c4..674e174 100644 --- a/URI/mailto.pm +++ b/lib/URI/mailto.pm @@ -1,10 +1,11 @@ package URI::mailto; # RFC 2368 -require URI; -require URI::_query; -@ISA=qw(URI URI::_query); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent qw(URI URI::_query); sub to { diff --git a/lib/URI/mms.pm b/lib/URI/mms.pm new file mode 100644 index 0000000..f3d3075 --- /dev/null +++ b/lib/URI/mms.pm @@ -0,0 +1,12 @@ +package URI::mms; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::http'; + +sub default_port { 1755 } + +1; diff --git a/URI/news.pm b/lib/URI/news.pm similarity index 92% rename from URI/news.pm rename to lib/URI/news.pm index 1ffb419..75081c5 100644 --- a/URI/news.pm +++ b/lib/URI/news.pm @@ -1,9 +1,12 @@ package URI::news; # draft-gilman-news-url-01 -require URI::_server; -@ISA=qw(URI::_server); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_server'; + use URI::Escape qw(uri_unescape); use Carp (); @@ -61,7 +64,7 @@ sub message Carp::croak("Message must contain '\@'") unless $_[0] =~ /\@/; } my $old = $self->_group(@_); - return unless $old =~ /\@/; + return undef unless $old =~ /\@/; return $old; } diff --git a/lib/URI/nntp.pm b/lib/URI/nntp.pm new file mode 100644 index 0000000..a410a47 --- /dev/null +++ b/lib/URI/nntp.pm @@ -0,0 +1,10 @@ +package URI::nntp; # draft-gilman-news-url-01 + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::news'; + +1; diff --git a/URI/pop.pm b/lib/URI/pop.pm similarity index 88% rename from URI/pop.pm rename to lib/URI/pop.pm index 50b8d6d..40e03ff 100644 --- a/URI/pop.pm +++ b/lib/URI/pop.pm @@ -1,9 +1,12 @@ package URI::pop; # RFC 2384 -require URI::_server; -@ISA=qw(URI::_server); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_server'; + use URI::Escape qw(uri_unescape); sub default_port { 110 } @@ -31,7 +34,7 @@ sub user } } - return unless defined $old; + return undef unless defined $old; $old =~ s/;.*//; return uri_unescape($old); } @@ -59,7 +62,7 @@ sub auth } - return unless defined $old; + return undef unless defined $old; $old =~ s/^[^;]*//; return uri_unescape($1) if $old =~ /;auth=(.*)/i; return; diff --git a/lib/URI/rlogin.pm b/lib/URI/rlogin.pm new file mode 100644 index 0000000..910df54 --- /dev/null +++ b/lib/URI/rlogin.pm @@ -0,0 +1,12 @@ +package URI::rlogin; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_login'; + +sub default_port { 513 } + +1; diff --git a/URI/rsync.pm b/lib/URI/rsync.pm similarity index 54% rename from URI/rsync.pm rename to lib/URI/rsync.pm index 160d9d0..f11016e 100644 --- a/URI/rsync.pm +++ b/lib/URI/rsync.pm @@ -2,10 +2,12 @@ package URI::rsync; # http://rsync.samba.org/ # rsync://[USER@]HOST[:PORT]/SRC -require URI::_server; -require URI::_userpass; +use strict; +use warnings; -@ISA=qw(URI::_server URI::_userpass); +our $VERSION = '1.74'; + +use parent qw(URI::_server URI::_userpass); sub default_port { 873 } diff --git a/lib/URI/rtsp.pm b/lib/URI/rtsp.pm new file mode 100644 index 0000000..8ff9c4d --- /dev/null +++ b/lib/URI/rtsp.pm @@ -0,0 +1,12 @@ +package URI::rtsp; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::http'; + +sub default_port { 554 } + +1; diff --git a/lib/URI/rtspu.pm b/lib/URI/rtspu.pm new file mode 100644 index 0000000..a3f6077 --- /dev/null +++ b/lib/URI/rtspu.pm @@ -0,0 +1,12 @@ +package URI::rtspu; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::rtsp'; + +sub default_port { 554 } + +1; diff --git a/lib/URI/sftp.pm b/lib/URI/sftp.pm new file mode 100644 index 0000000..dd7cf8a --- /dev/null +++ b/lib/URI/sftp.pm @@ -0,0 +1,10 @@ +package URI::sftp; + +use strict; +use warnings; + +use parent 'URI::ssh'; + +our $VERSION = '1.74'; + +1; diff --git a/URI/sip.pm b/lib/URI/sip.pm similarity index 92% rename from URI/sip.pm rename to lib/URI/sip.pm index 97bf863..2268860 100644 --- a/URI/sip.pm +++ b/lib/URI/sip.pm @@ -7,15 +7,14 @@ package URI::sip; -require URI::_server; -require URI::_userpass; -@ISA=qw(URI::_server URI::_userpass); - use strict; -use vars qw(@ISA $VERSION); +use warnings; + +use parent qw(URI::_server URI::_userpass); + use URI::Escape qw(uri_unescape); -$VERSION = "0.11"; +our $VERSION = '1.74'; sub default_port { 5060 } diff --git a/lib/URI/sips.pm b/lib/URI/sips.pm new file mode 100644 index 0000000..b51ef43 --- /dev/null +++ b/lib/URI/sips.pm @@ -0,0 +1,14 @@ +package URI::sips; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::sip'; + +sub default_port { 5061 } + +sub secure { 1 } + +1; diff --git a/URI/snews.pm b/lib/URI/snews.pm similarity index 56% rename from URI/snews.pm rename to lib/URI/snews.pm index 4310f81..d6143ec 100644 --- a/URI/snews.pm +++ b/lib/URI/snews.pm @@ -1,7 +1,11 @@ package URI::snews; # draft-gilman-news-url-01 -require URI::news; -@ISA=qw(URI::news); +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::news'; sub default_port { 563 } diff --git a/URI/ssh.pm b/lib/URI/ssh.pm similarity index 55% rename from URI/ssh.pm rename to lib/URI/ssh.pm index 1d47e41..da1de32 100644 --- a/URI/ssh.pm +++ b/lib/URI/ssh.pm @@ -1,6 +1,11 @@ package URI::ssh; -require URI::_login; -@ISA=qw(URI::_login); + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_login'; # ssh://[USER@]HOST[:PORT]/SRC diff --git a/lib/URI/telnet.pm b/lib/URI/telnet.pm new file mode 100644 index 0000000..e1b20f4 --- /dev/null +++ b/lib/URI/telnet.pm @@ -0,0 +1,12 @@ +package URI::telnet; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_login'; + +sub default_port { 23 } + +1; diff --git a/lib/URI/tn3270.pm b/lib/URI/tn3270.pm new file mode 100644 index 0000000..ce85bfc --- /dev/null +++ b/lib/URI/tn3270.pm @@ -0,0 +1,12 @@ +package URI::tn3270; + +use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::_login'; + +sub default_port { 23 } + +1; diff --git a/URI/urn.pm b/lib/URI/urn.pm similarity index 82% rename from URI/urn.pm rename to lib/URI/urn.pm index 12d40b2..ae46aab 100644 --- a/URI/urn.pm +++ b/lib/URI/urn.pm @@ -1,12 +1,16 @@ package URI::urn; # RFC 2141 -require URI; -@ISA=qw(URI); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI'; + use Carp qw(carp); -use vars qw(%implementor); +my %implementor; +my %require_attempted; sub _init { my $class = shift; @@ -26,9 +30,13 @@ sub _init { $impclass = "URI::urn::$id"; no strict 'refs'; unless (@{"${impclass}::ISA"}) { - # Try to load it - eval "require $impclass"; - die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/; + if (not exists $require_attempted{$impclass}) { + # Try to load it + my $_old_error = $@; + eval "require $impclass"; + die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/; + $@ = $_old_error; + } $impclass = "URI::urn" unless @{"${impclass}::ISA"}; } } diff --git a/URI/urn/isbn.pm b/lib/URI/urn/isbn.pm similarity index 97% rename from URI/urn/isbn.pm rename to lib/URI/urn/isbn.pm index 0da931b..b5f0eaf 100644 --- a/URI/urn/isbn.pm +++ b/lib/URI/urn/isbn.pm @@ -1,9 +1,12 @@ package URI::urn::isbn; # RFC 3187 -require URI::urn; -@ISA=qw(URI::urn); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::urn'; + use Carp qw(carp); BEGIN { diff --git a/URI/urn/oid.pm b/lib/URI/urn/oid.pm similarity index 78% rename from URI/urn/oid.pm rename to lib/URI/urn/oid.pm index 301b2bc..fc0cf42 100644 --- a/URI/urn/oid.pm +++ b/lib/URI/urn/oid.pm @@ -1,9 +1,11 @@ package URI::urn::oid; # RFC 2061 -require URI::urn; -@ISA=qw(URI::urn); - use strict; +use warnings; + +our $VERSION = '1.74'; + +use parent 'URI::urn'; sub oid { my $self = shift; diff --git a/t/00-report-prereqs.dd b/t/00-report-prereqs.dd new file mode 100644 index 0000000..6ac7397 --- /dev/null +++ b/t/00-report-prereqs.dd @@ -0,0 +1,70 @@ +do { my $x = { + 'configure' => { + 'requires' => { + 'ExtUtils::MakeMaker' => '0' + }, + 'suggests' => { + 'JSON::PP' => '2.27300' + } + }, + 'develop' => { + 'recommends' => { + 'Business::ISBN' => '0', + 'Dist::Zilla::PluginBundle::Git::VersionManager' => '0.007', + 'Storable' => '0' + }, + 'requires' => { + 'File::Spec' => '0', + 'IO::Handle' => '0', + 'IPC::Open3' => '0', + 'Pod::Coverage::TrustPod' => '0', + 'Test::CPAN::Changes' => '0.19', + 'Test::CPAN::Meta' => '0', + 'Test::MinimumVersion' => '0', + 'Test::Mojibake' => '0', + 'Test::More' => '0.94', + 'Test::Pod' => '1.41', + 'Test::Pod::Coverage' => '1.08', + 'Test::Portability::Files' => '0', + 'Test::Spelling' => '0.12', + 'Test::Version' => '1' + } + }, + 'runtime' => { + 'requires' => { + 'Carp' => '0', + 'Cwd' => '0', + 'Data::Dumper' => '0', + 'Encode' => '0', + 'Exporter' => '5.57', + 'MIME::Base64' => '2', + 'Net::Domain' => '0', + 'Scalar::Util' => '0', + 'constant' => '0', + 'integer' => '0', + 'overload' => '0', + 'parent' => '0', + 'perl' => '5.008001', + 'strict' => '0', + 'utf8' => '0', + 'warnings' => '0' + } + }, + 'test' => { + 'recommends' => { + 'CPAN::Meta' => '2.120900' + }, + 'requires' => { + 'ExtUtils::MakeMaker' => '0', + 'File::Spec' => '0', + 'File::Spec::Functions' => '0', + 'File::Temp' => '0', + 'Test' => '0', + 'Test::More' => '0.96', + 'Test::Needs' => '0', + 'utf8' => '0' + } + } + }; + $x; + } \ No newline at end of file diff --git a/t/00-report-prereqs.t b/t/00-report-prereqs.t new file mode 100644 index 0000000..c72183a --- /dev/null +++ b/t/00-report-prereqs.t @@ -0,0 +1,193 @@ +#!perl + +use strict; +use warnings; + +# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 + +use Test::More tests => 1; + +use ExtUtils::MakeMaker; +use File::Spec; + +# from $version::LAX +my $lax_version_re = + qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? + | + (?:\.[0-9]+) (?:_[0-9]+)? + ) | (?: + v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? + | + (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? + ) + )/x; + +# hide optional CPAN::Meta modules from prereq scanner +# and check if they are available +my $cpan_meta = "CPAN::Meta"; +my $cpan_meta_pre = "CPAN::Meta::Prereqs"; +my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic + +# Verify requirements? +my $DO_VERIFY_PREREQS = 1; + +sub _max { + my $max = shift; + $max = ( $_ > $max ) ? $_ : $max for @_; + return $max; +} + +sub _merge_prereqs { + my ($collector, $prereqs) = @_; + + # CPAN::Meta::Prereqs object + if (ref $collector eq $cpan_meta_pre) { + return $collector->with_merged_prereqs( + CPAN::Meta::Prereqs->new( $prereqs ) + ); + } + + # Raw hashrefs + for my $phase ( keys %$prereqs ) { + for my $type ( keys %{ $prereqs->{$phase} } ) { + for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { + $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; + } + } + } + + return $collector; +} + +my @include = qw( + +); + +my @exclude = qw( + +); + +# Add static prereqs to the included modules list +my $static_prereqs = do './t/00-report-prereqs.dd'; + +# Merge all prereqs (either with ::Prereqs or a hashref) +my $full_prereqs = _merge_prereqs( + ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), + $static_prereqs +); + +# Add dynamic prereqs to the included modules list (if we can) +my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; +my $cpan_meta_error; +if ( $source && $HAS_CPAN_META + && (my $meta = eval { CPAN::Meta->load_file($source) } ) +) { + $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); +} +else { + $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) + $source = 'static metadata'; +} + +my @full_reports; +my @dep_errors; +my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; + +# Add static includes into a fake section +for my $mod (@include) { + $req_hash->{other}{modules}{$mod} = 0; +} + +for my $phase ( qw(configure build test runtime develop other) ) { + next unless $req_hash->{$phase}; + next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); + + for my $type ( qw(requires recommends suggests conflicts modules) ) { + next unless $req_hash->{$phase}{$type}; + + my $title = ucfirst($phase).' '.ucfirst($type); + my @reports = [qw/Module Want Have/]; + + for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { + next if $mod eq 'perl'; + next if grep { $_ eq $mod } @exclude; + + my $file = $mod; + $file =~ s{::}{/}g; + $file .= ".pm"; + my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; + + my $want = $req_hash->{$phase}{$type}{$mod}; + $want = "undef" unless defined $want; + $want = "any" if !$want && $want == 0; + + my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; + + if ($prefix) { + my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); + $have = "undef" unless defined $have; + push @reports, [$mod, $want, $have]; + + if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { + if ( $have !~ /\A$lax_version_re\z/ ) { + push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; + } + elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { + push @dep_errors, "$mod version '$have' is not in required range '$want'"; + } + } + } + else { + push @reports, [$mod, $want, "missing"]; + + if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { + push @dep_errors, "$mod is not installed ($req_string)"; + } + } + } + + if ( @reports ) { + push @full_reports, "=== $title ===\n\n"; + + my $ml = _max( map { length $_->[0] } @reports ); + my $wl = _max( map { length $_->[1] } @reports ); + my $hl = _max( map { length $_->[2] } @reports ); + + if ($type eq 'modules') { + splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; + push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; + } + else { + splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; + push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; + } + + push @full_reports, "\n"; + } + } +} + +if ( @full_reports ) { + diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; +} + +if ( $cpan_meta_error || @dep_errors ) { + diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; +} + +if ( $cpan_meta_error ) { + my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; + diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; +} + +if ( @dep_errors ) { + diag join("\n", + "\nThe following REQUIRED prerequisites were not satisfied:\n", + @dep_errors, + "\n" + ); +} + +pass; + +# vim: ts=4 sts=4 sw=4 et: diff --git a/t/abs.t b/t/abs.t index e2dad70..cf74ef4 100644 --- a/t/abs.t +++ b/t/abs.t @@ -1,4 +1,5 @@ -#!perl -w +use strict; +use warnings; print "1..45\n"; @@ -6,8 +7,9 @@ print "1..45\n"; # in the "Uniform Resource Identifiers (URI): Generic Syntax" document. use URI; -$base = "http://a/b/c/d;p?q"; -$testno = 1; +my $base = "http://a/b/c/d;p?q"; +my $testno = 1; +my @rel_fail; while () { #next if 1 .. /^C\.\s+/; @@ -162,7 +164,7 @@ C.2. Abnormal Examples http: = http: -========================================================================== +-------------------------------------------------------------------------- Some extra tests for good measure... diff --git a/t/clone.t b/t/clone.t index 2d49a14..57201f5 100644 --- a/t/clone.t +++ b/t/clone.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..2\n"; -use strict; use URI::URL; my $b = URI::URL->new("http://www/"); diff --git a/t/cwd.t b/t/cwd.t index 90e1859..a890ee5 100644 --- a/t/cwd.t +++ b/t/cwd.t @@ -1,6 +1,9 @@ -#!perl -Tw +#!perl -T -use Test; +use strict; +use warnings; + +use Test::More; plan tests => 1; @@ -8,5 +11,5 @@ use URI::file; $ENV{PATH} = "/bin:/usr/bin"; my $cwd = eval { URI::file->cwd }; -ok($@, ''); +is($@, '', 'no exceptions'); diff --git a/t/data.t b/t/data.t index 0e23e76..31890ea 100644 --- a/t/data.t +++ b/t/data.t @@ -1,19 +1,11 @@ -#!perl -w - -eval { - require MIME::Base64; -}; -if ($@) { - print "1..0\n"; - print $@; - exit; -} +use strict; +use warnings; print "1..22\n"; use URI; -$u = URI->new("data:,A%20brief%20note"); +my $u = URI->new("data:,A%20brief%20note"); print "not " unless $u->scheme eq "data" && $u->opaque eq ",A%20brief%20note"; print "ok 1\n"; @@ -21,7 +13,7 @@ print "not " unless $u->media_type eq "text/plain;charset=US-ASCII" && $u->data eq "A brief note"; print "ok 2\n"; -$old = $u->data("Får-i-kål er tingen!"); +my $old = $u->data("Får-i-kål er tingen!"); print "not " unless $old eq "A brief note" && $u eq "data:,F%E5r-i-k%E5l%20er%20tingen!"; print "ok 3\n"; diff --git a/t/escape-char.t b/t/escape-char.t new file mode 100644 index 0000000..b03e43d --- /dev/null +++ b/t/escape-char.t @@ -0,0 +1,29 @@ +use strict; +use warnings; + +# see https://rt.cpan.org/Ticket/Display.html?id=96941 + +use Test::More; +use URI; + +TODO: { + my $str = "http://foo/\xE9"; + utf8::upgrade($str); + my $uri = URI->new($str); + + local $TODO = 'URI::Escape::escape_char misunderstands utf8'; + + # http://foo/%C3%A9 + is("$uri", 'http://foo/%E9', 'correctly created a URI from a utf8-upgraded string'); +} + +{ + my $str = "http://foo/\xE9"; + utf8::downgrade($str); + my $uri = URI->new($str); + + # http://foo/%E9 + is("$uri", 'http://foo/%E9', 'correctly created a URI from a utf8-downgrade string'); +} + +done_testing; diff --git a/t/escape.t b/t/escape.t index 87ae743..05b8022 100644 --- a/t/escape.t +++ b/t/escape.t @@ -1,5 +1,3 @@ -#!perl -w - use strict; use warnings; @@ -34,6 +32,6 @@ is uri_escape_utf8("|abc skip "Perl 5.8.0 or higher required", 3 if $] < 5.008; ok !eval { print uri_escape("abc" . chr(300)); 1 }; -like $@, qr/^Can\'t escape \\x{012C}, try uri_escape_utf8\(\) instead/; +like $@, qr/^Can\'t escape \\x\{012C\}, try uri_escape_utf8\(\) instead/; is uri_escape_utf8(chr(0xFFF)), "%E0%BF%BF"; diff --git a/t/file.t b/t/file.t index e89c1a1..26e0119 100644 --- a/t/file.t +++ b/t/file.t @@ -1,8 +1,11 @@ -#!perl -Tw +#!perl -T + +use strict; +use warnings; use URI::file; -@tests = ( +my @tests = ( [ "file", "unix", "win32", "mac" ], #---------------- ------------ --------------- -------------- [ "file://localhost/foo/bar", @@ -21,22 +24,22 @@ use URI::file; [ "../%2E%2E", "!../..", "!..\\..", "::.."], ); -@os = @{shift @tests}; +my @os = @{shift @tests}; shift @os; # file my $num = @tests; print "1..$num\n"; -$testno = 1; +my $testno = 1; -for $t (@tests) { +for my $t (@tests) { my @t = @$t; my $file = shift @t; my $err; my $u = URI->new($file, "file"); my $i = 0; - for $os (@os) { + for my $os (@os) { my $f = $u->file($os); my $expect = $t[$i]; $f = "" unless defined $f; @@ -48,7 +51,7 @@ for $t (@tests) { $err++; } if (defined($t[$i]) && !$loose) { - $u2 = URI::file->new($t[$i], $os); + my $u2 = URI::file->new($t[$i], $os); unless ($u2->as_string eq $file) { print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n"; $err++; diff --git a/t/ftp.t b/t/ftp.t index 066f1d3..9340885 100644 --- a/t/ftp.t +++ b/t/ftp.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..13\n"; -use strict; use URI; my $uri; diff --git a/t/generic.t b/t/generic.t index 52dec46..e2f7b97 100644 --- a/t/generic.t +++ b/t/generic.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; print "1..48\n"; use URI; -$foo = URI->new("Foo:opaque#frag"); +my $foo = URI->new("Foo:opaque#frag"); print "not " unless ref($foo) eq "URI::_foreign"; print "ok 1\n"; @@ -16,7 +17,7 @@ print "not " unless "$foo" eq "Foo:opaque#frag"; print "ok 3\n"; # Try accessors -print "not " unless $foo->_scheme eq "Foo" && $foo->scheme eq "foo"; +print "not " unless $foo->_scheme eq "Foo" && $foo->scheme eq "foo" && !$foo->has_recognized_scheme; print "ok 4\n"; print "not " unless $foo->opaque eq "opaque"; @@ -29,7 +30,7 @@ print "not " unless $foo->canonical eq "foo:opaque#frag"; print "ok 7\n"; # Try modificators -$old = $foo->scheme("bar"); +my $old = $foo->scheme("bar"); print "not " unless $old eq "foo" && $foo eq "bar:opaque#frag"; print "ok 8\n"; @@ -188,7 +189,7 @@ print "ok 41\n"; $foo = URI->new("", "http:"); $foo->query("query"); $foo->authority("auth"); -print "not " unless $foo eq "//auth?query"; +print "not " unless $foo eq "//auth?query" && $foo->has_recognized_scheme; print "ok 42\n"; $foo->path("path"); @@ -197,7 +198,7 @@ print "ok 43\n"; $foo = URI->new(""); $old = $foo->path("foo"); -print "not " unless $old eq "" && $foo eq "foo"; +print "not " unless $old eq "" && $foo eq "foo" && !$foo->has_recognized_scheme; print "ok 44\n"; $old = $foo->path("bar"); diff --git a/t/gopher.t b/t/gopher.t index 2b23761..427a5fc 100644 --- a/t/gopher.t +++ b/t/gopher.t @@ -1,5 +1,5 @@ -#!perl -w use strict; +use warnings; print "1..48\n"; diff --git a/t/heuristic.t b/t/heuristic.t index 42c7663..63c2ad8 100644 --- a/t/heuristic.t +++ b/t/heuristic.t @@ -1,4 +1,5 @@ -#!perl -w +use strict; +use warnings; BEGIN { # mock up a gethostbyname that always works :-) diff --git a/t/http.t b/t/http.t index 2b8c44b..fb30124 100644 --- a/t/http.t +++ b/t/http.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; -print "1..15\n"; +print "1..16\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "http://www.perl.com/path?q=f%F4o"; @@ -14,7 +15,7 @@ print "not " unless $u->port == 80; print "ok 2\n"; # play with port -$old = $u->port(8080); +my $old = $u->port(8080); print "not " unless $old == 80 && $u eq "http://www.perl.com:8080/path?q=f%F4o"; print "ok 3\n"; @@ -30,7 +31,7 @@ $u->port(undef); print "not " unless $u eq "http://www.perl.com/path?q=f%F4o"; print "ok 6\n"; -@q = $u->query_form; +my @q = $u->query_form; print "not " unless @q == 2 && "@q" eq "q fôo"; print "ok 7\n"; @@ -61,3 +62,5 @@ $u = URI->new("http://%77%77%77%2e%70%65%72%6c%2e%63%6f%6d/%70%75%62/%61/%32%30% print "not " unless $u->canonical eq "http://www.perl.com/pub/a/2001/08/27/bjornstad.html"; print "ok 15\n"; +print "not " unless $u->has_recognized_scheme; +print "ok 16\n"; diff --git a/t/idna.t b/t/idna.t index a385e9d..da2ad98 100644 --- a/t/idna.t +++ b/t/idna.t @@ -1,6 +1,6 @@ -#!perl -w - use strict; +use warnings; + use utf8; use Test::More tests => 7; use URI::_idna; diff --git a/t/iri.t b/t/iri.t index a64f5d1..f1dfd51 100644 --- a/t/iri.t +++ b/t/iri.t @@ -1,7 +1,7 @@ -#!perl -w +use strict; +use warnings; use utf8; -use strict; use Test::More; use Config; @@ -16,8 +16,8 @@ use URI::IRI; my $u; -binmode Test::More->builder->output, ":utf8"; -binmode Test::More->builder->failure_output, ":utf8"; +binmode Test::More->builder->output, ':encoding(UTF-8)'; +binmode Test::More->builder->failure_output, ':encoding(UTF-8)'; $u = URI->new("http://Bücher.ch"); is $u, "http://xn--bcher-kva.ch"; diff --git a/t/ldap.t b/t/ldap.t index 8a7e00d..3cd3dd8 100644 --- a/t/ldap.t +++ b/t/ldap.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..24\n"; -use strict; use URI; my $uri; diff --git a/t/mailto.t b/t/mailto.t index f4fae5e..f13a1f8 100644 --- a/t/mailto.t +++ b/t/mailto.t @@ -1,16 +1,17 @@ -#!perl -w +use strict; +use warnings; print "1..7\n"; use URI; -$u = URI->new('mailto:gisle@aas.no'); +my $u = URI->new('mailto:gisle@aas.no'); print "not " unless $u->to eq 'gisle@aas.no' && $u eq 'mailto:gisle@aas.no'; print "ok 1\n"; -$old = $u->to('larry@wall.org'); +my $old = $u->to('larry@wall.org'); print "not " unless $old eq 'gisle@aas.no' && $u->to eq 'larry@wall.org' && $u eq 'mailto:larry@wall.org'; @@ -21,7 +22,7 @@ print "not " unless $u->to eq "?/#" && $u eq 'mailto:%3F/%23'; print "ok 3\n"; -@h = $u->headers; +my @h = $u->headers; print "not " unless @h == 2 && "@h" eq "to ?/#"; print "ok 4\n"; diff --git a/t/mix.t b/t/mix.t index 46d9e4f..b72942a 100644 --- a/t/mix.t +++ b/t/mix.t @@ -1,4 +1,5 @@ -#!perl -w +use strict; +use warnings; print "1..6\n"; @@ -7,12 +8,17 @@ use URI; use URI::WithBase; use URI::URL; -$str = "http://www.sn.no/"; -$rel = "path/img.gif"; +my $str = "http://www.sn.no/"; +my $rel = "path/img.gif"; -$u = URI->new($str); -$uw = URI::WithBase->new($str, "http:"); -$uu = URI::URL->new($str); +my $u = URI->new($str); +my $uw = URI::WithBase->new($str, "http:"); +my $uu = URI::URL->new($str); + +my $a = URI->new($rel, $u); +my $b = URI->new($rel, $uw); +my $c = URI->new($rel, $uu); +my $d = URI->new($rel, $str); sub Dump { @@ -20,11 +26,6 @@ sub Dump print Data::Dumper->Dump([$a, $b, $c, $d], [qw(a b c d)]); } -$a = URI->new($rel, $u); -$b = URI->new($rel, $uw); -$c = URI->new($rel, $uu); -$d = URI->new($rel, $str); - #Dump(); print "not " unless $a->isa("URI") && ref($b) eq ref($uw) && diff --git a/t/mms.t b/t/mms.t index 03fdcea..d3ac1d1 100644 --- a/t/mms.t +++ b/t/mms.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; print "1..8\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "mms://66.250.188.13/KFOG_FM"; @@ -14,7 +15,7 @@ print "not " unless $u->port == 1755; print "ok 2\n"; # play with port -$old = $u->port(8755); +my $old = $u->port(8755); print "not " unless $old == 1755 && $u eq "mms://66.250.188.13:8755/KFOG_FM"; print "ok 3\n"; diff --git a/t/news.t b/t/news.t index ea5b005..a009a9e 100644 --- a/t/news.t +++ b/t/news.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; print "1..7\n"; use URI; -$u = URI->new("news:comp.lang.perl.misc"); +my $u = URI->new("news:comp.lang.perl.misc"); print "not " unless $u->group eq "comp.lang.perl.misc" && !defined($u->message) && @@ -23,7 +24,7 @@ $u->group("no.perl", 1 => 10); print "not " unless $u eq "news://news.online.no/no.perl/1-10"; print "ok 3\n"; -@g = $u->group; +my @g = $u->group; #print "G: @g\n"; print "not " unless @g == 3 && "@g" eq "no.perl 1 10"; print "ok 4\n"; diff --git a/t/num_eq.t b/t/num_eq.t index 2d06120..066d84c 100644 --- a/t/num_eq.t +++ b/t/num_eq.t @@ -1,9 +1,8 @@ -#!/usr/bin/perl -w - -# Test URI's overloading of numeric comparision for checking object +# Test URI's overloading of numeric comparison for checking object # equality use strict; +use warnings; use Test::More 'no_plan'; use URI; diff --git a/t/old-absconf.t b/t/old-absconf.t index c74d78b..536f4d7 100644 --- a/t/old-absconf.t +++ b/t/old-absconf.t @@ -1,4 +1,5 @@ -#!perl -w +use strict; +use warnings; print "1..6\n"; @@ -9,7 +10,7 @@ use URI::URL qw(url); $URI::URL::ABS_REMOTE_LEADING_DOTS = 1; $URI::URL::ABS_ALLOW_RELATIVE_SCHEME = 1; -$u1 = url("../../../../abc", "http://web/a/b"); +my $u1 = url("../../../../abc", "http://web/a/b"); print "not " unless $u1->abs->as_string eq "http://web/abc"; print "ok 1\n"; diff --git a/t/old-base.t b/t/old-base.t index 9c9ccdb..984aab1 100644 --- a/t/old-base.t +++ b/t/old-base.t @@ -1,35 +1,22 @@ -#!/local/bin/perl -w +use strict; +use warnings; +use Test::More 0.96; use URI::URL qw(url); use URI::Escape qw(uri_escape uri_unescape); +use File::Temp 'tempdir'; -# want compatiblity +# want compatibility use URI::file; $URI::file::DEFAULT_AUTHORITY = undef; -# _expect() -# -# Handy low-level object method tester which we insert as a method -# in the URI::URL class -# -sub URI::URL::_expect { - my($self, $method, $expect, @args) = @_; - my $result = $self->$method(@args); - $expect = 'UNDEF' unless defined $expect; - $result = 'UNDEF' unless defined $result; - return 1 if $expect eq $result; - warn "'$self'->$method(@args) = '$result' " . - "(expected '$expect')\n"; - $self->print_on('STDERR'); - die "Test Failed"; -} package main; # Must ensure that there is no relative paths in @INC because we will # chdir in the newlocal tests. unless ($^O eq "MacOS") { -chomp($pwd = ($^O =~ /mswin32/i ? `cd` : $^O eq 'VMS' ? `show default` : `pwd`)); +chomp(my $pwd = ($^O =~ /mswin32/i ? `cd` : $^O eq 'VMS' ? `show default` : `pwd`)); if ($^O eq 'VMS') { $pwd =~ s#^\s+##; $pwd = VMS::Filespec::unixpath($pwd); @@ -40,7 +27,7 @@ for (@INC) { $x = VMS::Filespec::unixpath($x) if $^O eq 'VMS'; next if $x =~ m|^/| or $^O =~ /os2|mswin32/i and $x =~ m#^(\w:[\\/]|[\\/]{2})#; - print "Turn lib path $x into $pwd/$x\n"; + note "Turn lib path $x into $pwd/$x\n"; $_ = "$pwd/$x"; } @@ -48,45 +35,30 @@ for (@INC) { $| = 1; -print "1..8\n"; # for Test::Harness - # Do basic tests first. -# Dies if an error has been detected, prints "ok" otherwise. -print "Self tests for URI::URL version $URI::URL::VERSION...\n"; +note "Self tests for URI::URL version $URI::URL::VERSION...\n"; -eval { scheme_parse_test(); }; -print "not " if $@; -print "ok 1\n"; +subtest 'scheme tests' => \&scheme_parse_test; -eval { parts_test(); }; -print "not " if $@; -print "ok 2\n"; +subtest 'parts test' => \&parts_test; -eval { escape_test(); }; -print "not " if $@; -print "ok 3\n"; +subtest 'escape test' => \&escape_test; -eval { newlocal_test(); }; -print "not " if $@; -print "ok 4\n"; +subtest 'newlocal test' => \&newlocal_test; -eval { absolute_test(); }; -print "not " if $@; -print "ok 5\n"; +subtest 'Test relative/absolute URI::URL parsing' => \&absolute_test; -eval { eq_test(); }; -print "not " if $@; -print "ok 6\n"; +subtest 'eq test' => \&eq_test; # Let's test making our own things URI::URL::strict(0); # This should work after URI::URL::strict(0) -$url = new URI::URL "x-myscheme:something"; +my $url = new URI::URL "x-myscheme:something"; # Since no implementor is registered for 'x-myscheme' then it will # be handled by the URI::URL::_generic class -$url->_expect('as_string' => 'x-myscheme:something'); -$url->_expect('path' => 'something'); +is($url->as_string, 'x-myscheme:something', ref($url) . '->as_string'); +is($url->path, 'something', ref($url) . '->path'); URI::URL::strict(1); =comment @@ -112,8 +84,8 @@ URI::URL::implementor('x-foo', 'MyURL'); # Now we are ready to try our new URL scheme $url = new URI::URL 'x-a+b.c://foo/bar;a?b'; -$url->_expect('as_string', 'x-a+b.c://foo/bar;a?b'); -$url->_expect('path', '/bar;a?b'); +is($url->as_string, 'x-a+b.c://foo/bar;a?b', ref($url) . '->as_string'); +is($url->path, '/bar;a?b', ref($url) . '->path'); $url->foo; $newurl = new URI::URL 'xxx', $url; $newurl->foo; @@ -122,15 +94,13 @@ $url->foo; =cut -print "ok 7\n"; - # Test the new wash&go constructor -print "not " if url("../foo.html", "http://www.sn.no/a/b")->abs->as_string - ne 'http://www.sn.no/foo.html'; -print "ok 8\n"; +is(url("../foo.html", "http://www.sn.no/a/b")->abs->as_string, + 'http://www.sn.no/foo.html', 'wash&go'); -print "URI::URL version $URI::URL::VERSION ok\n"; +note "URI::URL version $URI::URL::VERSION ok\n"; +done_testing; exit 0; @@ -144,9 +114,7 @@ exit 0; sub scheme_parse_test { - print "scheme_parse_test:\n"; - - $tests = { + my $tests = { 'hTTp://web1.net/a/b/c/welcome#intro' => { 'scheme'=>'http', 'host'=>'web1.net', 'port'=>80, 'path'=>'/a/b/c/welcome', 'frag'=>'intro','query'=>undef, @@ -253,13 +221,12 @@ sub scheme_parse_test { # 'password'=>'pswd' }, }; - foreach $url_str (sort keys %$tests ){ - print "Testing '$url_str'\n"; + foreach my $url_str (sort keys %$tests ){ + note "Testing '$url_str'\n"; my $url = new URI::URL $url_str; my $tests = $tests->{$url_str}; - while( ($method, $exp) = each %$tests ){ - $exp = 'UNDEF' unless defined $exp; - $url->_expect($method, $exp); + while( my ($method, $exp) = each %$tests ){ + is($url->$method, $exp, ref($url) . "->$method"); } } } @@ -272,7 +239,6 @@ sub scheme_parse_test { # Test individual component part access functions # sub parts_test { - print "parts_test:\n"; # test storage part access/edit methods (netloc, user, password, # host and port are tested by &netloc_test) @@ -282,39 +248,39 @@ sub parts_test { $url->path('1info'); $url->query('key words'); $url->frag('this'); - $url->_expect('as_string' => 'http://web/1info?key%20words#this'); + is($url->as_string, 'http://web/1info?key%20words#this', ref($url) . '->as_string'); $url->epath('%2f/%2f'); $url->equery('a=%26'); - $url->_expect('full_path' => '/%2f/%2f?a=%26'); + is($url->full_path, '/%2f/%2f?a=%26', ref($url) . '->full_path'); # At this point it should be impossible to access the members path() # and query() without complaints. - eval { my $p = $url->path; print "Path is $p\n"; }; - die "Path exception failed" unless $@; - eval { my $p = $url->query; print "Query is $p\n"; }; - die "Query exception failed" unless $@; + eval { my $p = $url->path; note "Path is $p\n"; }; + fail "Path exception failed" unless $@; + eval { my $p = $url->query; note "Query is $p\n"; }; + fail "Query exception failed" unless $@; # but we should still be able to set it $url->path("howdy"); - $url->_expect('as_string' => 'http://web/howdy?a=%26#this'); + is($url->as_string, 'http://web/howdy?a=%26#this', ref($url) . '->as_string'); # Test the path_components function $url = new URI::URL 'file:%2f/%2f'; my $p; $p = join('-', $url->path_components); - die "\$url->path_components returns '$p', expected '/-/'" + fail "\$url->path_components returns '$p', expected '/-/'" unless $p eq "/-/"; $url->host("localhost"); $p = join('-', $url->path_components); - die "\$url->path_components returns '$p', expected '-/-/'" + fail "\$url->path_components returns '$p', expected '-/-/'" unless $p eq "-/-/"; $url->epath("/foo/bar/"); $p = join('-', $url->path_components); - die "\$url->path_components returns '$p', expected '-foo-bar-'" + fail "\$url->path_components returns '$p', expected '-foo-bar-'" unless $p eq "-foo-bar-"; $url->path_components("", "/etc", "\0", "..", "øse", ""); - $url->_expect('full_path' => '/%2Fetc/%00/../%F8se/'); + is($url->full_path, '/%2Fetc/%00/../%F8se/', ref($url) . '->full_path'); # Setting undef $url = new URI::URL 'http://web/p;p?q#f'; @@ -322,39 +288,47 @@ sub parts_test { $url->equery(undef); $url->eparams(undef); $url->frag(undef); - $url->_expect('as_string' => 'http://web'); + is($url->as_string, 'http://web', ref($url) . '->as_string'); # Test http query access methods $url->keywords('dog'); - $url->_expect('as_string' => 'http://web?dog'); + is($url->as_string, 'http://web?dog', ref($url) . '->as_string'); $url->keywords(qw(dog bones)); - $url->_expect('as_string' => 'http://web?dog+bones'); + is($url->as_string, 'http://web?dog+bones', ref($url) . '->as_string'); $url->keywords(0,0); - $url->_expect('as_string' => 'http://web?0+0'); + is($url->as_string, 'http://web?0+0', ref($url) . '->as_string'); $url->keywords('dog', 'bones', '#+='); - $url->_expect('as_string' => 'http://web?dog+bones+%23%2B%3D'); + is($url->as_string, 'http://web?dog+bones+%23%2B%3D', ref($url) . '->as_string'); $a = join(":", $url->keywords); - die "\$url->keywords did not work (returned '$a')" unless $a eq 'dog:bones:#+='; + is($a, 'dog:bones:#+=', "\$url->keywords"); # calling query_form is an error # eval { my $foo = $url->query_form; }; -# die "\$url->query_form should croak since query contains keywords not a form." +# fail "\$url->query_form should croak since query contains keywords not a form." # unless $@; $url->query_form(a => 'foo', b => 'bar'); - $url->_expect('as_string' => 'http://web?a=foo&b=bar'); + is($url->as_string, 'http://web?a=foo&b=bar', ref($url) . '->as_string'); my %a = $url->query_form; - die "\$url->query_form did not work" - unless $a{a} eq 'foo' && $a{b} eq 'bar'; + is_deeply( + \%a, + { a => 'foo', b => 'bar' }, + "\$url->query_form", + ); $url->query_form(a => undef, a => 'foo', '&=' => '&=+'); - $url->_expect('as_string' => 'http://web?a=&a=foo&%26%3D=%26%3D%2B'); + is($url->as_string, 'http://web?a=&a=foo&%26%3D=%26%3D%2B', ref($url) . '->as_string'); my @a = $url->query_form; - die "Wrong length" unless @a == 6; - die "Bad keys from query_form" - unless $a[0] eq 'a' && $a[2] eq 'a' && $a[4] eq '&='; - die "Bad values from query_form" - unless $a[1] eq '' && $a[3] eq 'foo' && $a[5] eq '&=+'; + is(scalar(@a), 6, 'length'); + is_deeply( + \@a, + [ + 'a', '', + 'a', 'foo', + '&=', '&=+', + ], + 'query_form', + ); # calling keywords is an error # eval { my $foo = $url->keywords; }; @@ -363,44 +337,46 @@ sub parts_test { # Try this odd one $url->equery('&=&=b&a=&a&a=b=c&&a=b'); @a = $url->query_form; - #print join(":", @a), "\n"; - die "Wrong length" unless @a == 16; - die "Wrong sequence" unless $a[4] eq "" && $a[5] eq "b" && - $a[10] eq "a" && $a[11] eq "b=c"; + #note join(":", @a), "\n"; + is(scalar(@a), 16, 'length'); + ok( + $a[4] eq "" && $a[5] eq "b" && $a[10] eq "a" && $a[11] eq "b=c", + 'sequence', + ); # Try array ref values in the key value pairs $url->query_form(a => ['foo', 'bar'], b => 'foo', c => ['bar', 'foo']); - $url->_expect('as_string', 'http://web?a=foo&a=bar&b=foo&c=bar&c=foo'); - + is($url->as_string, 'http://web?a=foo&a=bar&b=foo&c=bar&c=foo', ref($url) . '->as_string'); - netloc_test(); - port_test(); + subtest 'netloc_test' => \&netloc_test; + subtest 'port_test' => \&port_test; $url->query(undef); - $url->_expect('query', undef); + is($url->query, undef, ref($url) . '->as_string'); $url = new URI::URL 'gopher://gopher/'; $url->port(33); $url->gtype("3"); $url->selector("S"); $url->search("query"); - $url->_expect('as_string', 'gopher://gopher:33/3S%09query'); + is($url->as_string, 'gopher://gopher:33/3S%09query', ref($url) . '->as_string'); $url->epath("45%09a"); - $url->_expect('gtype' => '4'); - $url->_expect('selector' => '5'); - $url->_expect('search' => 'a'); - $url->_expect('string' => undef); - $url->_expect('path' => "/45\ta"); + is($url->gtype, '4', ref($url) . '->as_string'); + is($url->selector, '5', ref($url) . '->as_string'); + is($url->search, 'a', ref($url) . '->as_string'); + is($url->string, undef, ref($url) . '->as_string'); + is($url->path, "/45\ta", ref($url) . '->as_string'); # $url->path("00\t%09gisle"); -# $url->_expect('search', '%09gisle'); +# is($url->search '%09gisle', ref($url) . '->search'); # Let's test som other URL schemes $url = new URI::URL 'news:'; $url->group("comp.lang.perl.misc"); - $url->_expect('as_string' => 'news:comp.lang.perl.misc'); + is($url->as_string, 'news:comp.lang.perl.misc', ref($url) . '->as_string'); $url->article('<1234@a.sn.no>'); - $url->_expect('as_string' => 'news:1234@a.sn.no'); # "<" and ">" are gone + is($url->as_string, 'news:1234@a.sn.no', ref($url) . '->as_string: "<" and ">" are gone'); + # This one should be illegal eval { $url->article("no.perl"); }; die "This one should really complain" unless $@; @@ -408,62 +384,58 @@ sub parts_test { # $url = new URI::URL 'mailto:'; # $url->user("aas"); # $url->host("a.sn.no"); -# $url->_expect("as_string" => 'mailto:aas@a.sn.no'); +# is($url->as_string, 'mailto:aas@a.sn.no', ref($url) . '->as_string'); # $url->address('foo@bar'); -# $url->_expect("host" => 'bar'); -# $url->_expect("user" => 'foo'); +# is($url->host, 'bar', ref($url) . '->as_string'); +# is($url->user, 'foo', ref($url) . '->as_string'); # $url = new URI::URL 'wais://host/database/wt/wpath'; # $url->database('foo'); -# $url->_expect('as_string' => 'wais://host/foo/wt/wpath'); +# is($url->as_string, 'wais://host/foo/wt/wpath', ref($url) . '->as_string'); # $url->wtype('bar'); -# $url->_expect('as_string' => 'wais://host/foo/bar/wpath'); +# is($url->as_string, 'wais://host/foo/bar/wpath', ref($url) . '->as_string'); # Test crack method for various URLs my(@crack, $crack); @crack = URI::URL->new("http://host/path;param?query#frag")->crack; - die "Cracked result should be 9 elements" unless @crack == 9; + is(scalar(@crack), 9, '9 elements'); $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; - die "Bad crack result" unless - $crack eq "http*UNDEF*UNDEF*host*80*/path*param*query*frag"; + note "Cracked result: $crack"; + is($crack, "http*UNDEF*UNDEF*host*80*/path*param*query*frag", 'crack result'); @crack = URI::URL->new("foo/bar", "ftp://aas\@ftp.sn.no/")->crack; - die "Cracked result should be 9 elements" unless @crack == 9; + is(scalar(@crack), 9, '9 elements'); $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; + note "Cracked result: $crack"; # die "Bad crack result" unless # $crack eq "ftp*UNDEF*UNDEF*UNDEF*21*foo/bar*UNDEF*UNDEF*UNDEF"; @crack = URI::URL->new('ftp://u:p@host/q?path')->crack; - die "Cracked result should be 9 elements" unless @crack == 9; + is(scalar(@crack), 9, '9 elements'); $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; - die "Bad crack result" unless - $crack eq "ftp*u*p*host*21*/q?path*UNDEF*path*UNDEF"; + note "Cracked result: $crack"; + is($crack, "ftp*u*p*host*21*/q?path*UNDEF*path*UNDEF", 'crack result'); @crack = URI::URL->new("ftp://ftp.sn.no/pub")->crack; # Test anon ftp - die "Cracked result should be 9 elements" unless @crack == 9; - die "No passwd in anonymous crack" unless $crack[2]; + is(scalar(@crack), 9, '9 elements'); + ok($crack[2], "passwd in anonymous crack"); $crack[2] = 'passwd'; # easier to test when we know what it is $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; - die "Bad crack result" unless - $crack eq "ftp*anonymous*passwd*ftp.sn.no*21*/pub*UNDEF*UNDEF*UNDEF"; + note "Cracked result: $crack"; + is($crack, "ftp*anonymous*passwd*ftp.sn.no*21*/pub*UNDEF*UNDEF*UNDEF", 'crack result'); @crack = URI::URL->new('mailto:aas@sn.no')->crack; - die "Cracked result should be 9 elements" unless @crack == 9; + is(scalar(@crack), 9, '9 elements'); $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; + note "Cracked result: $crack"; # die "Bad crack result" unless # $crack eq "mailto*aas*UNDEF*sn.no*UNDEF*aas\@sn.no*UNDEF*UNDEF*UNDEF"; @crack = URI::URL->new('news:comp.lang.perl.misc')->crack; - die "Cracked result should be 9 elements" unless @crack == 9; + is(scalar(@crack), 9, '9 elements'); $crack = join("*", map { defined($_) ? $_ : "UNDEF" } @crack); - print "Cracked result: $crack\n"; - die "Bad crack result" unless - $crack eq "news*UNDEF*UNDEF*UNDEF*119*comp.lang.perl.misc*UNDEF*UNDEF*UNDEF"; + note "Cracked result: $crack"; + is($crack, "news*UNDEF*UNDEF*UNDEF*119*comp.lang.perl.misc*UNDEF*UNDEF*UNDEF", 'crack result'); } # @@ -472,55 +444,54 @@ sub parts_test { # Test automatic netloc synchronisation # sub netloc_test { - print "netloc_test:\n"; my $url = new URI::URL 'ftp://anonymous:p%61ss@håst:12345'; - $url->_expect('user', 'anonymous'); - $url->_expect('password', 'pass'); - $url->_expect('host', 'xn--hst-ula'); - $url->_expect('port', 12345); + is($url->user, 'anonymous', ref($url) . '->as_string'); + is($url->password, 'pass', ref($url) . '->as_string'); + is($url->host, 'xn--hst-ula', ref($url) . '->as_string'); + is($url->port, 12345, ref($url) . '->as_string'); # Can't really know how netloc is represented since it is partially escaped - #$url->_expect('netloc', 'anonymous:pass@hst:12345'); - $url->_expect('as_string' => 'ftp://anonymous:pass@xn--hst-ula:12345'); + #is($url->netloc, 'anonymous:pass@hst:12345', ref($url) . '->as_string'); + is($url->as_string, 'ftp://anonymous:pass@xn--hst-ula:12345', ref($url) . '->as_string'); # The '0' is sometimes tricky to get right $url->user(0); $url->password(0); $url->host(0); $url->port(0); - $url->_expect('netloc' => '0:0@0:0'); + is($url->netloc, '0:0@0:0', ref($url) . '->as_string'); $url->host(undef); - $url->_expect('netloc' => '0:0@:0'); + is($url->netloc, '0:0@:0', ref($url) . '->as_string'); $url->host('h'); $url->user(undef); - $url->_expect('netloc' => ':0@h:0'); + is($url->netloc, ':0@h:0', ref($url) . '->as_string'); $url->user(''); - $url->_expect('netloc' => ':0@h:0'); + is($url->netloc, ':0@h:0', ref($url) . '->as_string'); $url->password(''); - $url->_expect('netloc' => ':@h:0'); + is($url->netloc, ':@h:0', ref($url) . '->as_string'); $url->user('foo'); - $url->_expect('netloc' => 'foo:@h:0'); + is($url->netloc, 'foo:@h:0', ref($url) . '->as_string'); # Let's try a simple one $url->user('nemo'); $url->password('p2'); $url->host('hst2'); $url->port(2); - $url->_expect('netloc' => 'nemo:p2@hst2:2'); + is($url->netloc, 'nemo:p2@hst2:2', ref($url) . '->as_string'); $url->user(undef); $url->password(undef); $url->port(undef); - $url->_expect('netloc' => 'hst2'); - $url->_expect('port' => '21'); # the default ftp port + is($url->netloc, 'hst2', ref($url) . '->as_string'); + is($url->port, '21', ref($url) . '->as_string'); # the default ftp port $url->port(21); - $url->_expect('netloc' => 'hst2:21'); + is($url->netloc, 'hst2:21', ref($url) . '->as_string'); # Let's try some reserved chars $url->user("@"); $url->password(":-#-;-/-?"); - $url->_expect('as_string' => 'ftp://%40::-%23-;-%2F-%3F@hst2:21'); + is($url->as_string, 'ftp://%40::-%23-;-%2F-%3F@hst2:21', ref($url) . '->as_string'); } @@ -530,36 +501,26 @@ sub netloc_test { # Test port behaviour # sub port_test { - print "port_test:\n"; - $url = URI::URL->new('http://foo/root/dir/'); my $port = $url->port; - die "Port undefined" unless defined $port; - die "Wrong port $port" unless $port == 80; - die "Wrong string" unless $url->as_string eq - 'http://foo/root/dir/'; + is($port, 80, 'port'); + is($url->as_string, 'http://foo/root/dir/', 'string'); $url->port(8001); $port = $url->port; - die "Port undefined" unless defined $port; - die "Wrong port $port" unless $port == 8001; - die "Wrong string" unless $url->as_string eq - 'http://foo:8001/root/dir/'; + is($port, 8001, 'port'); + is($url->as_string, 'http://foo:8001/root/dir/', 'string'); $url->port(80); $port = $url->port; - die "Port undefined" unless defined $port; - die "Wrong port $port" unless $port == 80; - die "Wrong string" unless $url->canonical->as_string eq - 'http://foo/root/dir/'; + is($port, 80, 'port'); + is($url->canonical->as_string, 'http://foo/root/dir/', 'string'); $url->port(8001); $url->port(undef); $port = $url->port; - die "Port undefined" unless defined $port; - die "Wrong port $port" unless $port == 80; - die "Wrong string" unless $url->as_string eq - 'http://foo/root/dir/'; + is($port, 80, 'port'); + is($url->canonical->as_string, 'http://foo/root/dir/', 'string'); } @@ -570,72 +531,70 @@ sub port_test { # escaping functions sub escape_test { - print "escape_test:\n"; - # supply escaped URL $url = new URI::URL 'http://web/this%20has%20spaces'; # check component is unescaped - $url->_expect('path', '/this has spaces'); + is($url->path, '/this has spaces', ref($url) . '->as_string'); # modify the unescaped form $url->path('this ALSO has spaces'); # check whole url is escaped - $url->_expect('as_string', - 'http://web/this%20ALSO%20has%20spaces'); + is($url->as_string, + 'http://web/this%20ALSO%20has%20spaces', ref($url) . '->as_string'); $url = new URI::URL uri_escape('http://web/try %?#" those'); - $url->_expect('as_string', - 'http%3A%2F%2Fweb%2Ftry%20%25%3F%23%22%20those'); + is($url->as_string, + 'http%3A%2F%2Fweb%2Ftry%20%25%3F%23%22%20those', ref($url) . '->as_string'); my $all = pack('C*',0..255); my $esc = uri_escape($all); my $new = uri_unescape($esc); - die "uri_escape->uri_unescape mismatch" unless $all eq $new; + is($all, $new, "uri_escape->uri_unescape"), $url->path($all); - $url->_expect('full_path' => q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF)); + is($url->full_path, q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF), ref($url) . '->as_string'); # test escaping uses uppercase (preferred by rfc1837) $url = new URI::URL 'file://h/'; $url->path(chr(0x7F)); - $url->_expect('as_string', 'file://h/%7F'); + is($url->as_string, 'file://h/%7F', ref($url) . '->as_string'); return; # reserved characters differ per scheme ## XXX is this '?' allowed to be unescaped $url = new URI::URL 'file://h/test?ing'; - $url->_expect('path', '/test?ing'); + is($url->path, '/test?ing', ref($url) . '->as_string'); $url = new URI::URL 'file://h/'; $url->epath('question?mark'); - $url->_expect('as_string', 'file://h/question?mark'); + is($url->as_string, 'file://h/question?mark', ref($url) . '->as_string'); # XXX Why should this be any different??? # Perhaps we should not expect too much :-) $url->path('question?mark'); - $url->_expect('as_string', 'file://h/question%3Fmark'); + is($url->as_string, 'file://h/question%3Fmark', ref($url) . '->as_string'); # See what happens when set different elements to this ugly sting my $reserved = ';/?:@&=#%'; $url->path($reserved . "foo"); - $url->_expect('as_string', 'file://h/%3B/%3F%3A%40%26%3D%23%25foo'); + is($url->as_string, 'file://h/%3B/%3F%3A%40%26%3D%23%25foo', ref($url) . '->as_string'); $url->scheme('http'); $url->path(''); - $url->_expect('as_string', 'http://h/'); + is($url->as_string, 'http://h/', ref($url) . '->as_string'); $url->query($reserved); $url->params($reserved); $url->frag($reserved); - $url->_expect('as_string', 'http://h/;%3B%2F%3F%3A%40&=%23%25?%3B%2F%3F%3A%40&=%23%25#;/?:@&=#%'); + is($url->as_string, 'http://h/;%3B%2F%3F%3A%40&=%23%25?%3B%2F%3F%3A%40&=%23%25#;/?:@&=#%', ref($url) . '->as_string'); - $str = $url->as_string; + my $str = $url->as_string; $url = new URI::URL $str; die "URL changed" if $str ne $url->as_string; $url = new URI::URL 'ftp:foo'; $url->user($reserved); $url->host($reserved); - $url->_expect('as_string', 'ftp://%3B%2F%3F%3A%40%26%3D%23%25@%3B%2F%3F%3A%40%26%3D%23%25/foo'); + is($url->as_string, 'ftp://%3B%2F%3F%3A%40%26%3D%23%25@%3B%2F%3F%3A%40%26%3D%23%25/foo', ref($url) . '->as_string'); } @@ -648,13 +607,12 @@ sub escape_test { sub newlocal_test { return 1 if $^O eq "MacOS"; - print "newlocal_test:\n"; my $isMSWin32 = ($^O =~ /MSWin32/i); my $pwd = ($isMSWin32 ? 'cd' : ($^O eq 'qnx' ? '/usr/bin/fullpath -t' : ($^O eq 'VMS' ? 'show default' : (-e '/bin/pwd' ? '/bin/pwd' : 'pwd')))); - my $tmpdir = ($^O eq 'MSWin32' ? $ENV{TEMP} : '/tmp'); + my $tmpdir = tempdir(); if ( $^O eq 'qnx' ) { $tmpdir = `/usr/bin/fullpath -t $tmpdir`; chomp $tmpdir; @@ -684,23 +642,23 @@ sub newlocal_test { $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32 or $^O eq 'os2'; $url = newlocal URI::URL; my $ss = $isMSWin32 ? '//' : (($dir =~ m,^/,) ? '' : '///' ); - $url->_expect('as_string', URI::URL->new("file:$ss$dir/")->as_string); + is($url->as_string, URI::URL->new("file:$ss$dir/")->as_string, ref($url) . '->as_string'); - print "Local directory is ". $url->local_path . "\n"; + note "Local directory is ". $url->local_path . "\n"; if ($^O ne 'VMS') { # absolute dir chdir('/') or die $!; $url = newlocal URI::URL '/usr/'; - $url->_expect('as_string', 'file:/usr/'); + is($url->as_string, 'file:/usr/', ref($url) . '->as_string'); # absolute file $url = newlocal URI::URL '/vmunix'; - $url->_expect('as_string', 'file:/vmunix'); + is($url->as_string, 'file:/vmunix', ref($url) . '->as_string'); } # relative file - chdir($tmpdir) or die $!; + chdir($tmpdir) or fail $!; $dir = `$pwd`; $dir =~ tr|\\|/|; chomp $dir; if ($^O eq 'VMS') { @@ -711,10 +669,10 @@ sub newlocal_test { $dir = uri_escape($dir, ':'); $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32 or $^O eq 'os2'; $url = newlocal URI::URL 'foo'; - $url->_expect('as_string', "file:$ss$dir/foo"); + is($url->as_string, "file:$ss$dir/foo", ref($url) . '->as_string'); # relative dir - chdir($tmpdir) or die $!; + chdir($tmpdir) or fail $!; $dir = `$pwd`; $dir =~ tr|\\|/|; chomp $dir; if ($^O eq 'VMS') { @@ -725,59 +683,59 @@ sub newlocal_test { $dir = uri_escape($dir, ':'); $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32 or $^O eq 'os2'; $url = newlocal URI::URL 'bar/'; - $url->_expect('as_string', "file:$ss$dir/bar/"); + is($url->as_string, "file:$ss$dir/bar/", ref($url) . '->as_string'); # 0 if ($^O ne 'VMS') { - chdir('/') or die $!; + chdir('/') or fail $!; $dir = `$pwd`; $dir =~ tr|\\|/|; chomp $dir; $dir = uri_escape($dir, ':'); $dir =~ s/^(\w)%3A/$1:/ if $isMSWin32 or $^O eq 'os2'; $url = newlocal URI::URL '0'; - $url->_expect('as_string', "file:$ss${dir}0"); + is($url->as_string, "file:$ss${dir}0", ref($url) . '->as_string'); } # Test access methods for file URLs $url = new URI::URL 'file:/c:/dos'; - $url->_expect('dos_path', 'C:\\DOS'); - $url->_expect('unix_path', '/c:/dos'); - #$url->_expect('vms_path', '[C:]DOS'); - $url->_expect('mac_path', 'UNDEF'); + is($url->dos_path, 'C:\\DOS', ref($url) . '->as_string'); + is($url->unix_path, '/c:/dos', ref($url) . '->as_string'); + #is($url->vms_path, '[C:]DOS', ref($url) . '->as_string'); + is($url->mac_path, undef, ref($url) . '->as_string'); $url = new URI::URL 'file:/foo/bar'; - $url->_expect('unix_path', '/foo/bar'); - $url->_expect('mac_path', 'foo:bar'); + is($url->unix_path, '/foo/bar', ref($url) . '->as_string'); + is($url->mac_path, 'foo:bar', ref($url) . '->as_string'); # Some edge cases # $url = new URI::URL 'file:'; -# $url->_expect('unix_path', '/'); +# is($url->unix_path, '/', ref($url) . '->as_string'); $url = new URI::URL 'file:/'; - $url->_expect('unix_path', '/'); + is($url->unix_path, '/', ref($url) . '->as_string'); $url = new URI::URL 'file:.'; - $url->_expect('unix_path', '.'); + is($url->unix_path, '.', ref($url) . '->as_string'); $url = new URI::URL 'file:./foo'; - $url->_expect('unix_path', './foo'); + is($url->unix_path, './foo', ref($url) . '->as_string'); $url = new URI::URL 'file:0'; - $url->_expect('unix_path', '0'); + is($url->unix_path, '0', ref($url) . '->as_string'); $url = new URI::URL 'file:../../foo'; - $url->_expect('unix_path', '../../foo'); + is($url->unix_path, '../../foo', ref($url) . '->as_string'); $url = new URI::URL 'file:foo/../bar'; - $url->_expect('unix_path', 'foo/../bar'); + is($url->unix_path, 'foo/../bar', ref($url) . '->as_string'); # Relative files $url = new URI::URL 'file:foo/b%61r/Note.txt'; - $url->_expect('unix_path', 'foo/bar/Note.txt'); - $url->_expect('mac_path', ':foo:bar:Note.txt'); - $url->_expect('dos_path', 'FOO\\BAR\\NOTE.TXT'); - #$url->_expect('vms_path', '[.FOO.BAR]NOTE.TXT'); + is($url->unix_path, 'foo/bar/Note.txt', ref($url) . '->as_string'); + is($url->mac_path, ':foo:bar:Note.txt', ref($url) . '->as_string'); + is($url->dos_path, 'FOO\\BAR\\NOTE.TXT', ref($url) . '->as_string'); + #is($url->vms_path', '[.FOO.BAR]NOTE.TXT', ref($url) . '->as_string'); # The VMS path found in RFC 1738 (section 3.10) $url = new URI::URL 'file://vms.host.edu/disk$user/my/notes/note12345.txt'; -# $url->_expect('vms_path', 'DISK$USER:[MY.NOTES]NOTE12345.TXT'); -# $url->_expect('mac_path', 'disk$user:my:notes:note12345.txt'); +# is($url->vms_path, 'DISK$USER:[MY.NOTES]NOTE12345.TXT', ref($url) . '->as_string'); +# is($url->mac_path, 'disk$user:my:notes:note12345.txt', ref($url) . '->as_string'); - chdir($savedir) or die $!; + chdir($savedir) or fail $!; } @@ -786,9 +744,6 @@ sub newlocal_test { # absolute_test() # sub absolute_test { - - print "Test relative/absolute URI::URL parsing:\n"; - # Tests from draft-ietf-uri-relative-url-06.txt # Copied verbatim from the draft, parsed below @@ -796,7 +751,7 @@ sub absolute_test { my $base = 'http://a/b/c/d;p?q#f'; - $absolute_tests = < @@ -871,7 +826,8 @@ EOM # convert text to list like # @absolute_tests = ( ['g:h' => 'g:h'], ...) - for $line (split("\n", $absolute_tests)) { + my @absolute_tests; + for my $line (split("\n", $absolute_tests)) { next unless $line =~ /^\s{6}/; if ($line =~ /^\s+(\S+)\s*=\s*]*)>/) { my($rel, $abs) = ($1, $2); @@ -893,17 +849,17 @@ EOM # ['%2e%2e/a' => 'http://a/b/c/%2e%2e/a'], ); - print " Relative + Base => Expected Absolute URL\n"; - print "================================================\n"; - for $test (@absolute_tests) { + note " Relative + Base => Expected Absolute URL"; + note "------------------------------------------------\n"; + for my $test (@absolute_tests) { my($rel, $abs) = @$test; my $abs_url = new URI::URL $abs; my $abs_str = $abs_url->as_string; - printf(" %-10s + $base => %s\n", $rel, $abs); + note sprintf(" %-10s + $base => %s", $rel, $abs); my $u = new URI::URL $rel, $base; my $got = $u->abs; - $got->_expect('as_string', $abs_str); + is($got->as_string, $abs_str, ref($url) . '->as_string'); } # bug found and fixed in 1.9 by "J.E. Fritz" @@ -912,7 +868,7 @@ EOM my $result = $relative->abs; my ($a, $b) = ($base->path, $result->path); - die "'$a' and '$b' should be the same" unless $a eq $b; + is($a, $b, 'identity'); # Counter the expectation of least surprise, # section 6 of the draft says the URL should @@ -922,9 +878,9 @@ EOM $base = new URI::URL 'http://host/dir1/../dir2/file'; $relative = new URI::URL 'file', $base; $result = $relative->abs; - die 'URL not canonicalised' unless $result eq 'http://host/dir2/file'; + is($result, 'http://host/dir2/file', 'URL canonicalised'); - print "--------\n"; + note "--------"; # Test various other kinds of URLs and how they like to be absolutized for (["http://abc/", "news:45664545", "http://abc/"], ["news:abc", "http://abc/", "news:abc"], @@ -954,10 +910,10 @@ EOM my($url, $base, $expected_abs) = @$_; my $rel = new URI::URL $url, $base; my $abs = $rel->abs($base, 1); - printf(" %-12s+ $base => %s\n", $rel, $abs); - $abs->_expect('as_string', $expected_abs); + note sprintf(" %-12s+ $base => %s", $rel, $abs); + is($abs->as_string, $expected_abs, ref($url) . '->as_string'); } - print "absolute test ok\n"; + note "absolute test ok\n"; # Test relative function for ( @@ -984,11 +940,10 @@ EOM ) { my($abs, $base, $expect) = @$_; - printf "url('$abs', '$base')->rel eq '$expect'\n"; my $rel = URI::URL->new($abs, $base)->rel; - $rel->_expect('as_string', $expect); + is($rel->as_string, $expect, "url('$abs', '$base')->rel = '$expect'"); } - print "relative test ok\n"; + note "relative test ok\n"; } @@ -999,25 +954,25 @@ sub eq_test my $u3 = new URI::URL 'http://ABC.com:/%7esmith/home.html'; # Test all permutations of these tree - $u1->eq($u2) or die "1: $u1 ne $u2"; - $u1->eq($u3) or die "2: $u1 ne $u3"; - $u2->eq($u1) or die "3: $u2 ne $u1"; - $u2->eq($u3) or die "4: $u2 ne $u3"; - $u3->eq($u1) or die "5: $u3 ne $u1"; - $u3->eq($u2) or die "6: $u3 ne $u2"; + ok($u1->eq($u2), "1: $u1 ne $u2"); + ok($u1->eq($u3), "2: $u1 ne $u3"); + ok($u2->eq($u1), "3: $u2 ne $u1"); + ok($u2->eq($u3), "4: $u2 ne $u3"); + ok($u3->eq($u1), "5: $u3 ne $u1"); + ok($u3->eq($u2), "6: $u3 ne $u2"); # Test empty path my $u4 = new URI::URL 'http://www.sn.no'; - $u4->eq("HTTP://WWW.SN.NO:80/") or die "7: $u4"; - $u4->eq("http://www.sn.no:81") and die "8: $u4"; + ok($u4->eq("HTTP://WWW.SN.NO:80/"), "7: $u4"); + ok(!$u4->eq("http://www.sn.no:81"),"8: $u4"); # Test mailto # my $u5 = new URI::URL 'mailto:AAS@SN.no'; -# $u5->eq('mailto:aas@sn.no') or die "9: $u5"; +# ok($u5->eq('mailto:aas@sn.no'), "9: $u5"); + # Test reserved char my $u6 = new URI::URL 'ftp://ftp/%2Fetc'; - $u6->eq("ftp://ftp/%2fetc") or die "10: $u6"; - $u6->eq("ftp://ftp://etc") and die "11: $u6"; + ok($u6->eq("ftp://ftp/%2fetc"), "10: $u6"); + ok(!$u6->eq("ftp://ftp://etc"), "11: $u6"); } - diff --git a/t/old-file.t b/t/old-file.t index 6bcca86..e1ab8f5 100644 --- a/t/old-file.t +++ b/t/old-file.t @@ -1,9 +1,10 @@ -#!perl -w +use strict; +use warnings; use URI::file; $URI::file::DEFAULT_AUTHORITY = undef; -@tests = ( +my @tests = ( [ "file", "unix", "win32", "mac" ], #---------------- ------------ --------------- -------------- [ "file://localhost/foo/bar", @@ -12,7 +13,7 @@ $URI::file::DEFAULT_AUTHORITY = undef; "!/foo/bar", "!\\foo\\bar", "!foo:bar", ], [ "file:/foo/bar", "/foo/bar", "\\foo\\bar", "foo:bar", ], [ "foo/bar", "foo/bar", "foo\\bar", ":foo:bar",], -[ "file://foo/bar","!//foo/bar", "\\\\foo\\bar", "!foo:bar"], +[ "file://foo3445x/bar","!//foo3445x/bar", "\\\\foo3445x\\bar", "!foo3445x:bar"], [ "file://a:/", "!//a:/", "!A:\\", undef], [ "file:/", "/", "\\", undef], [ "file://A:relative/", "!//A:relative/", "A:", undef], @@ -22,7 +23,7 @@ $URI::file::DEFAULT_AUTHORITY = undef; [ "../%2E%2E", "!../..", "!..\\..", "::.."], ); if ($^O eq "MacOS") { -@extratests = ( +my @extratests = ( [ "../..", "../..", "..\\..", ":::"], [ "../../", "../../", "..\\..\\", "!:::"], [ "file:./foo.bar", "!./foo.bar", "!.\\foo.bar", "!:foo.bar"], @@ -39,22 +40,22 @@ if ($^O eq "MacOS") { push(@tests,@extratests); } -@os = @{shift @tests}; +my @os = @{shift @tests}; shift @os; # file my $num = @tests; print "1..$num\n"; -$testno = 1; +my $testno = 1; -for $t (@tests) { +for my $t (@tests) { my @t = @$t; my $file = shift @t; my $err; my $u = URI->new($file, "file"); my $i = 0; - for $os (@os) { + for my $os (@os) { my $f = $u->file($os); my $expect = $t[$i]; $f = "" unless defined $f; @@ -66,7 +67,7 @@ for $t (@tests) { $err++; } if (defined($t[$i]) && !$loose) { - $u2 = URI::file->new($t[$i], $os); + my $u2 = URI::file->new($t[$i], $os); unless ($u2->as_string eq $file) { print "URI::file->new('$t[$i]', '$os') ne $file, but $u2\n"; $err++; diff --git a/t/old-relbase.t b/t/old-relbase.t index 05db62f..3bd0ae8 100644 --- a/t/old-relbase.t +++ b/t/old-relbase.t @@ -1,4 +1,5 @@ -#!perl -w +use strict; +use warnings; print "1..5\n"; @@ -7,13 +8,13 @@ use URI::URL; # We used to have problems with URLs that used a base that was # not absolute itself. -$u1 = url("/foo/bar", "http://www.acme.com/"); -$u2 = url("../foo/", $u1); -$u3 = url("zoo/foo", $u2); +my $u1 = url("/foo/bar", "http://www.acme.com/"); +my $u2 = url("../foo/", $u1); +my $u3 = url("zoo/foo", $u2); -$a1 = $u1->abs->as_string; -$a2 = $u2->abs->as_string; -$a3 = $u3->abs->as_string; +my $a1 = $u1->abs->as_string; +my $a2 = $u2->abs->as_string; +my $a3 = $u3->abs->as_string; print "$a1\n$a2\n$a3\n"; @@ -25,8 +26,8 @@ print "not " unless $a3 eq "http://www.acme.com/foo/zoo/foo"; print "ok 3\n"; # We used to have problems with URI::URL as the base class :-( -$u4 = url("foo", "URI::URL"); -$a4 = $u4->abs; +my $u4 = url("foo", "URI::URL"); +my $a4 = $u4->abs; print "$a4\n"; print "not " unless $u4 eq "foo" && $a4 eq "uri:/foo"; print "ok 4\n"; diff --git a/t/path-segments.t b/t/path-segments.t new file mode 100755 index 0000000..ea9b4fa --- /dev/null +++ b/t/path-segments.t @@ -0,0 +1,33 @@ +use strict; +use warnings; + +use Test::More 'no_plan'; + +use URI (); + +{ + my $u = URI->new("http://www.example.org/a/b/c"); + + is_deeply [$u->path_segments], ['', qw(a b c)], 'path_segments in list context'; + is $u->path_segments, '/a/b/c', 'path_segments in scalar context'; + + is_deeply [$u->path_segments('', qw(z y x))], ['', qw(a b c)], 'set path_segments in list context'; + is $u->path_segments('/i/j/k'), '/z/y/x', 'set path_segments in scalar context'; + + $u->path_segments('', qw(q r s)); + is $u->path_segments, '/q/r/s', 'set path_segments in void context'; +} + +{ + my $u = URI->new("http://www.example.org/abc"); + $u->path_segments('', '%', ';', '/'); + is $u->path_segments, '/%25/%3B/%2F', 'escaping special characters'; +} + +{ + my $u = URI->new("http://www.example.org/abc;param1;param2"); + my @ps = $u->path_segments; + isa_ok $ps[1], 'URI::_segment'; + $u->path_segments(@ps); + is $u->path_segments, '/abc;param1;param2', 'dealing with URI segments'; +} diff --git a/t/pop.t b/t/pop.t index a8d446f..4519484 100644 --- a/t/pop.t +++ b/t/pop.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; print "1..8\n"; use URI; -$u = URI->new('pop://aas@pop.sn.no'); +my $u = URI->new('pop://aas@pop.sn.no'); print "not " unless $u->user eq "aas" && !defined($u->auth) && diff --git a/t/punycode.t b/t/punycode.t index dbb2881..d1e3084 100644 --- a/t/punycode.t +++ b/t/punycode.t @@ -1,6 +1,6 @@ -#!perl -w - use strict; +use warnings; + use utf8; use Test::More tests => 15; use URI::_punycode qw(encode_punycode decode_punycode); diff --git a/t/query-param.t b/t/query-param.t index 8d02263..fc852c0 100644 --- a/t/query-param.t +++ b/t/query-param.t @@ -1,6 +1,5 @@ -#!perl -w - use strict; +use warnings; use Test::More tests => 19; diff --git a/t/query.t b/t/query.t index 109ecee..2970814 100644 --- a/t/query.t +++ b/t/query.t @@ -1,6 +1,6 @@ -#!perl -w - use strict; +use warnings; + use Test::More tests => 23; use URI (); diff --git a/t/rel.t b/t/rel.t index 29f1642..104ae5d 100644 --- a/t/rel.t +++ b/t/rel.t @@ -1,21 +1,21 @@ -#!/usr/bin/perl -w +use strict; +use warnings; -use Test; +use Test::More; plan tests => 6; -use strict; use URI; my $uri; $uri = URI->new("http://www.example.com/foo/bar/"); -ok($uri->rel("http://www.example.com/foo/bar/"), "./"); -ok($uri->rel("HTTP://WWW.EXAMPLE.COM/foo/bar/"), "./"); -ok($uri->rel("HTTP://WWW.EXAMPLE.COM/FOO/BAR/"), "../../foo/bar/"); -ok($uri->rel("HTTP://WWW.EXAMPLE.COM:80/foo/bar/"), "./"); +is($uri->rel("http://www.example.com/foo/bar/"), "./"); +is($uri->rel("HTTP://WWW.EXAMPLE.COM/foo/bar/"), "./"); +is($uri->rel("HTTP://WWW.EXAMPLE.COM/FOO/BAR/"), "../../foo/bar/"); +is($uri->rel("HTTP://WWW.EXAMPLE.COM:80/foo/bar/"), "./"); $uri = URI->new("http://www.example.com/foo/bar"); -ok($uri->rel("http://www.example.com/foo/bar"), "bar"); -ok($uri->rel("http://www.example.com/foo"), "foo/bar"); +is($uri->rel("http://www.example.com/foo/bar"), "bar"); +is($uri->rel("http://www.example.com/foo"), "foo/bar"); diff --git a/t/rfc2732.t b/t/rfc2732.t index 0787e30..d69960a 100644 --- a/t/rfc2732.t +++ b/t/rfc2732.t @@ -1,8 +1,8 @@ -#!perl -w - # Test URIs containing IPv6 addresses use strict; +use warnings; + use Test::More tests => 19; use URI; diff --git a/t/roy-test.t b/t/roy-test.t index c3ca4aa..a7a9fdc 100644 --- a/t/roy-test.t +++ b/t/roy-test.t @@ -1,6 +1,6 @@ -#!perl -w - use strict; +use warnings; + use Test qw(plan ok); plan tests => 102; diff --git a/t/rsync.t b/t/rsync.t index b53e0cf..01e91d7 100644 --- a/t/rsync.t +++ b/t/rsync.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..4\n"; -use strict; use URI; my $u = URI->new('rsync://gisle@perl.com/foo/bar'); diff --git a/t/rtsp.t b/t/rtsp.t index c1eb342..208b63b 100644 --- a/t/rtsp.t +++ b/t/rtsp.t @@ -1,10 +1,11 @@ -#!perl -w +use strict; +use warnings; print "1..9\n"; use URI; -$u = URI->new(""); +my $u = URI->new(""); #print "$u\n"; print "not " unless $u eq "rtsp://media.perl.com/f%F4o.smi/"; @@ -14,7 +15,7 @@ print "not " unless $u->port == 554; print "ok 2\n"; # play with port -$old = $u->port(8554); +my $old = $u->port(8554); print "not " unless $old == 554 && $u eq "rtsp://media.perl.com:8554/f%F4o.smi/"; print "ok 3\n"; diff --git a/t/scheme-exceptions.t b/t/scheme-exceptions.t new file mode 100644 index 0000000..82740be --- /dev/null +++ b/t/scheme-exceptions.t @@ -0,0 +1,16 @@ +use strict; +use warnings; + +use Test::More; +use URI; + +plan skip_all => 'this test assumes that URI::javascript does not exist' + if eval { +require URI::javascript }; +plan tests => 4; + +for (0..1) { + my $uri = URI->new('javascript://foo/bar'); + + is($@, '', 'no exception when trying to load a scheme handler class'); + ok($uri->isa('URI'), 'but URI still instantiated as foreign'); +} diff --git a/t/sip.t b/t/sip.t index 302f4a7..506bba3 100644 --- a/t/sip.t +++ b/t/sip.t @@ -1,9 +1,9 @@ -#!perl -w +use strict; +use warnings; print "1..11\n"; use URI; -use strict; my $u = URI->new('sip:phone@domain.ext'); print "not " unless $u->user eq 'phone' && diff --git a/t/sort-hash-query-form.t b/t/sort-hash-query-form.t new file mode 100644 index 0000000..7c6f896 --- /dev/null +++ b/t/sort-hash-query-form.t @@ -0,0 +1,22 @@ +use strict; +use warnings; + +use Test::More; + +# ABSTRACT: Make sure query_form(\%hash) is sorted + +use URI; + +my $base = URI->new('http://example.org/'); + +my $i = 1; + +my $hash = { map { $_ => $i++ } qw( a b c d e f ) }; + +$base->query_form($hash); + +is("$base","http://example.org/?a=1&b=2&c=3&d=4&e=5&f=6", "Query parameters are sorted"); + +done_testing; + + diff --git a/t/split.t b/t/split.t index dcb43a4..34104b8 100644 --- a/t/split.t +++ b/t/split.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..17\n"; -use strict; use URI::Split qw(uri_split uri_join); sub j { join("-", map { defined($_) ? $_ : "" } @_) } diff --git a/t/storable-test.pl b/t/storable-test.pl index 45e0572..33deb6f 100644 --- a/t/storable-test.pl +++ b/t/storable-test.pl @@ -1,6 +1,5 @@ -#!perl -w - use strict; +use warnings; use Storable; if (@ARGV && $ARGV[0] eq "store") { diff --git a/t/storable.t b/t/storable.t index afe6837..d56c7c5 100644 --- a/t/storable.t +++ b/t/storable.t @@ -1,13 +1,8 @@ -#!perl -w +use strict; +use warnings; -eval { - require Storable; - print "1..3\n"; -}; -if ($@) { - print "1..0 # skipped: Needs the Storable module installed\n"; - exit; -} +use Test::Needs 'Storable'; +print "1..3\n"; system($^X, "-Iblib/lib", "t/storable-test.pl", "store"); system($^X, "-Iblib/lib", "t/storable-test.pl", "retrieve"); diff --git a/t/urn-isbn.t b/t/urn-isbn.t index 22f827f..f512bde 100644 --- a/t/urn-isbn.t +++ b/t/urn-isbn.t @@ -1,13 +1,7 @@ -#!perl -w - -eval { - require Business::ISBN; -}; -if ($@) { - print "1..0 # Skipped: Needs the Business::ISBN module installed\n\n"; - print $@; - exit; -} +use strict; +use warnings; + +use Test::Needs 'Business::ISBN'; print "1..13\n"; diff --git a/t/urn-oid.t b/t/urn-oid.t index 88e60ac..d35e524 100644 --- a/t/urn-oid.t +++ b/t/urn-oid.t @@ -1,8 +1,8 @@ -#!perl -w +use strict; +use warnings; print "1..4\n"; -use strict; use URI; my $u = URI->new("urn:oid"); diff --git a/t/utf8.t b/t/utf8.t index e6ca1e3..1453cfc 100644 --- a/t/utf8.t +++ b/t/utf8.t @@ -1,5 +1,3 @@ -#!perl - use strict; use warnings; diff --git a/uri-test b/uri-test index 1e4f4d8..ca30ef8 100755 --- a/uri-test +++ b/uri-test @@ -1,5 +1,8 @@ #!/usr/bin/perl -w +use strict; +use warnings; + sub usage { my $prog = $0; $prog =~ s,.*/,,; die "Usage: $prog [ []...]\n"; diff --git a/xt/author/00-compile.t b/xt/author/00-compile.t new file mode 100644 index 0000000..7f26715 --- /dev/null +++ b/xt/author/00-compile.t @@ -0,0 +1,112 @@ +use 5.006; +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 + +use Test::More 0.94; + +plan tests => 54; + +my @module_files = ( + 'URI.pm', + 'URI/Escape.pm', + 'URI/Heuristic.pm', + 'URI/IRI.pm', + 'URI/QueryParam.pm', + 'URI/Split.pm', + 'URI/URL.pm', + 'URI/WithBase.pm', + 'URI/_foreign.pm', + 'URI/_generic.pm', + 'URI/_idna.pm', + 'URI/_ldap.pm', + 'URI/_login.pm', + 'URI/_punycode.pm', + 'URI/_query.pm', + 'URI/_segment.pm', + 'URI/_server.pm', + 'URI/_userpass.pm', + 'URI/data.pm', + 'URI/file.pm', + 'URI/file/Base.pm', + 'URI/file/FAT.pm', + 'URI/file/Mac.pm', + 'URI/file/OS2.pm', + 'URI/file/QNX.pm', + 'URI/file/Unix.pm', + 'URI/file/Win32.pm', + 'URI/ftp.pm', + 'URI/gopher.pm', + 'URI/http.pm', + 'URI/https.pm', + 'URI/ldap.pm', + 'URI/ldapi.pm', + 'URI/ldaps.pm', + 'URI/mailto.pm', + 'URI/mms.pm', + 'URI/news.pm', + 'URI/nntp.pm', + 'URI/pop.pm', + 'URI/rlogin.pm', + 'URI/rsync.pm', + 'URI/rtsp.pm', + 'URI/rtspu.pm', + 'URI/sftp.pm', + 'URI/sip.pm', + 'URI/sips.pm', + 'URI/snews.pm', + 'URI/ssh.pm', + 'URI/telnet.pm', + 'URI/tn3270.pm', + 'URI/urn.pm', + 'URI/urn/isbn.pm', + 'URI/urn/oid.pm' +); + + + +# no fake home requested + +my @switches = ( + -d 'blib' ? '-Mblib' : '-Ilib', +); + +use File::Spec; +use IPC::Open3; +use IO::Handle; + +open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; + +my @warnings; +for my $lib (@module_files) +{ + # see L + my $stderr = IO::Handle->new; + + diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } + $^X, @switches, '-e', "require q[$lib]")) + if $ENV{PERL_COMPILE_TEST_DEBUG}; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); + binmode $stderr, ':crlf' if $^O eq 'MSWin32'; + my @_warnings = <$stderr>; + waitpid($pid, 0); + is($?, 0, "$lib loaded ok"); + + shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ + and not eval { +require blib; blib->VERSION('1.01') }; + + if (@_warnings) + { + warn @_warnings; + push @warnings, @_warnings; + } +} + + + +is(scalar(@warnings), 0, 'no warnings found') + or diag 'got warnings: ', explain(\@warnings); + +BAIL_OUT("Compilation problems") if !Test::More->builder->is_passing; diff --git a/xt/author/minimum-version.t b/xt/author/minimum-version.t new file mode 100644 index 0000000..6af92e0 --- /dev/null +++ b/xt/author/minimum-version.t @@ -0,0 +1,6 @@ +#!perl + +use Test::More; + +use Test::MinimumVersion; +all_minimum_version_from_metayml_ok(); diff --git a/xt/author/mojibake.t b/xt/author/mojibake.t new file mode 100644 index 0000000..5ef161e --- /dev/null +++ b/xt/author/mojibake.t @@ -0,0 +1,9 @@ +#!perl + +use strict; +use warnings qw(all); + +use Test::More; +use Test::Mojibake; + +all_files_encoding_ok(); diff --git a/xt/author/pod-coverage.t b/xt/author/pod-coverage.t new file mode 100644 index 0000000..b513733 --- /dev/null +++ b/xt/author/pod-coverage.t @@ -0,0 +1,118 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. + +use Test::Pod::Coverage 1.08; +use Test::More 0.88; + +BEGIN { + if ( $] <= 5.008008 ) { + plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; + } +} +use Pod::Coverage::TrustPod; + +my %skip = map { $_ => 1 } qw( URI::IRI URI::_foreign URI::_idna URI::_login URI::_ldap URI::file::QNX URI::nntp URI::urn::isbn URI::urn::oid URI::sftp ); + +my @modules; +for my $module ( all_modules() ) { + next if $skip{$module}; + + push @modules, $module; +} + +plan skip_all => 'All the modules we found were excluded from POD coverage test.' + unless @modules; + +plan tests => scalar @modules; + +my %trustme = ( + 'URI' => [ + qr/^(?:STORABLE_freeze|STORABLE_thaw|TO_JSON|implementor)$/ + ], + 'URI::Escape' => [ + qr/^(?:escape_char)$/ + ], + 'URI::Heuristic' => [ + qr/^(?:MY_COUNTRY|uf_url|uf_urlstr)$/ + ], + 'URI::URL' => [ + qr/^(?:address|article|crack|dos_path|encoded822addr|eparams|epath|frag)$/, + qr/^(?:full_path|groupart|keywords|local_path|mac_path|netloc|newlocal|params|path|path_components|print_on|query|strict|unix_path|url|vms_path)$/ + ], + 'URI::WithBase' => [ + qr/^(?:can|clone|eq|new_abs)$/ + ], + 'URI::_punycode' => [ + qr/^(?:adapt|code_point|digit_value|min)$/ + ], + 'URI::_query' => [ + qr/^(?:equery|query|query_form|query_form_hash|query_keywords|query_param|query_param_append|query_param_delete)$/ + ], + 'URI::_segment' => [ + qr/^(?:new)$/ + ], + 'URI::_userpass' => [ + qr/^(?:password|user)$/ + ], + 'URI::file' => [ + qr/^(?:os_class)$/ + ], + 'URI::file::Base' => [ + qr/^(?:dir|file|new)$/ + ], + 'URI::file::FAT' => [ + qr/^(?:fix_path)$/ + ], + 'URI::file::Mac' => [ + qr/^(?:dir|file)$/ + ], + 'URI::file::OS2' => [ + qr/^(?:file)$/ + ], + 'URI::file::Unix' => [ + qr/^(?:file)$/ + ], + 'URI::file::Win32' => [ + qr/^(?:file|fix_path)$/ + ], + 'URI::ftp' => [ + qr/^(?:password|user)$/ + ], + 'URI::gopher' => [ + qr/^(?:gopher_type|gtype|search|selector|string)$/ + ], + 'URI::ldapi' => [ + qr/^(?:un_path)$/ + ], + 'URI::mailto' => [ + qr/^(?:headers|to)$/ + ], + 'URI::news' => [ + qr/^(?:group|message)$/ + ], + 'URI::pop' => [ + qr/^(?:auth|user)$/ + ], + 'URI::sip' => [ + qr/^(?:params|params_form)$/ + ], + 'URI::urn' => [ + qr/^(?:nid|nss)$/ + ] + ); + +my @also_private; + +for my $module ( sort @modules ) { + pod_coverage_ok( + $module, + { + coverage_class => 'Pod::Coverage::TrustPod', + also_private => \@also_private, + trustme => $trustme{$module} || [], + }, + "pod coverage for $module" + ); +} + +done_testing(); diff --git a/xt/author/pod-spell.t b/xt/author/pod-spell.t new file mode 100644 index 0000000..e4c0544 --- /dev/null +++ b/xt/author/pod-spell.t @@ -0,0 +1,162 @@ +use strict; +use warnings; +use Test::More; + +# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 +use Test::Spelling 0.12; +use Pod::Wordlist; + +set_spell_cmd('aspell list'); +add_stopwords(); +all_pod_files_spelling_ok( qw( bin lib ) ); +__DATA__ +Aas +Adam +Alders +Alex +Base +Berners +Bonaccorso +Brendan +Byrd +Chase +David +Dubois +Escape +Etheridge +FAT +Fredric +Förtsch +Gisle +Herzog +Heuristic +Honma +IDNA +IRI +ISBNs +Ishigaki +Jan +John +Kaitlyn +Kaji +Kapranoff +Karen +Karr +Kenichi +Kent +Koster +Lawrence +Mac +Mark +Martijn +Masahiro +Masinter +Matt +Michael +Miller +Miyagawa +OIDs +OS2 +Olaf +OpenLDAP +Parkhurst +Perl +Peter +Piotr +Punycode +QNX +QueryParam +Rabbitson +Rezic +Roszatycki +Salvatore +Schmidt +Schwern +Shoichi +Skyttä +Slaven +Split +Stosberg +TCP +TLS +Tatsuhiko +Torsten +UDP +UNC +URI +URL +Unix +Ville +Whitener +Win32 +WithBase +_foreign +_generic +_idna +_ldap +_login +_punycode +_query +_segment +_server +_userpass +adam +brainbuz +capoeirab +carnil +data +davewood +ether +etype +evalue +file +ftp +gerard +gisle +gopher +hiratara +http +https +isbn +ishigaki +jand +john +kapranoff +kentfredric +ldap +ldapi +ldaps +lib +lowercasing +mailto +mark +matthewlawrence +miyagawa +mms +news +nntp +oid +olaf +piotr +pop +relativize +ribasushi +rlogin +rsync +rtsp +rtspu +schwern +sftp +sip +sips +skaji +slaven +snews +ssh +symkat +telnet +tn3270 +torsten +uppercasing +urn +ville diff --git a/xt/author/pod-syntax.t b/xt/author/pod-syntax.t new file mode 100644 index 0000000..e563e5d --- /dev/null +++ b/xt/author/pod-syntax.t @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. +use strict; use warnings; +use Test::More; +use Test::Pod 1.41; + +all_pod_files_ok(); diff --git a/xt/author/portability.t b/xt/author/portability.t new file mode 100644 index 0000000..c531252 --- /dev/null +++ b/xt/author/portability.t @@ -0,0 +1,10 @@ +use strict; +use warnings; + +use Test::More; + +eval 'use Test::Portability::Files'; +plan skip_all => 'Test::Portability::Files required for testing portability' + if $@; + +run_tests(); diff --git a/xt/author/test-version.t b/xt/author/test-version.t new file mode 100644 index 0000000..247ba9a --- /dev/null +++ b/xt/author/test-version.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +use Test::More; + +# generated by Dist::Zilla::Plugin::Test::Version 1.09 +use Test::Version; + +my @imports = qw( version_all_ok ); + +my $params = { + is_strict => 0, + has_version => 1, + multiple => 0, + +}; + +push @imports, $params + if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); + +Test::Version->import(@imports); + +version_all_ok; +done_testing; diff --git a/xt/release/changes_has_content.t b/xt/release/changes_has_content.t new file mode 100644 index 0000000..bbcdd1d --- /dev/null +++ b/xt/release/changes_has_content.t @@ -0,0 +1,42 @@ +use Test::More tests => 2; + +note 'Checking Changes'; +my $changes_file = 'Changes'; +my $newver = '1.74'; +my $trial_token = '-TRIAL'; +my $encoding = 'UTF-8'; + +SKIP: { + ok(-e $changes_file, "$changes_file file exists") + or skip 'Changes is missing', 1; + + ok(_get_changes($newver), "$changes_file has content for $newver"); +} + +done_testing; + +sub _get_changes +{ + my $newver = shift; + + # parse changelog to find commit message + open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; + my $changelog = join('', <$fh>); + if ($encoding) { + require Encode; + $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); + } + close $fh; + + my @content = + grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented + split /\n/, $changelog; + shift @content; # drop the version line + + # drop unindented last line and trailing blank lines + pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); + + # return number of non-blank lines + return scalar @content; +} + diff --git a/xt/release/distmeta.t b/xt/release/distmeta.t new file mode 100644 index 0000000..c2280dc --- /dev/null +++ b/xt/release/distmeta.t @@ -0,0 +1,6 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::MetaTests. + +use Test::CPAN::Meta; + +meta_yaml_ok(); -- 2.7.4