Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/000755 000765 000024 00000000000 13014246634 021434 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/Changes000644 000765 000024 00000002652 13014246634 022734 0ustar00ryanstaff000000 000000 Revision history for Perl extension Pod-Weaver-Plugin-EnsureUniqueSections 0.163250 2016-11-19 23:15:36-08:00 America/Los_Angeles - Log content of duplicated sections to aid debugging 0.121550 2012-06-03 12:21:31 America/Los_Angeles - Fixed order-dependence in weaver.ini: Previously it was possible that plugins (specifically plugins doing the Pod::Weaver::Role::Finalizer role) could add more sections after EnsureUniqueSections had finished its checking. Obviously, such sections were not checked for duplicates. Unfortunately, the Leftovers plugin was liable to do this, and was also the most likely source of duplicate sections. Now [-EnsureUniqueSections] can be anywhere in weaver.ini and it should have the same effect. ( https://rt.cpan.org/Public/Bug/Display.html?id=77526 ) - Added a test suite. - Switched to using the logger for error messages instead of using "croak" 0.111220 2011-05-01 20:23:46 PST8PDT - Fixed a bug: Module no longer produces cryptic errors when encountering unknown POD elements (fix contributed by apocalypse) - Minor documentation formatting fixes that you won't notice 0.103531 2010-12-19 02:13:42 EST5EDT - More detailed documentation - No code changes 0.103520 2010-12-17 23:32:01 EST5EDT - Updated attr documentation to match code 0.103510 2010-12-17 15:38:47 EST5EDT - Initial CPAN release Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/dist.ini000644 000765 000024 00000000357 13014246634 023105 0ustar00ryanstaff000000 000000 ; dist.ini name = Pod-Weaver-Plugin-EnsureUniqueSections author = Ryan C. Thompson license = Perl_5 copyright_holder = Ryan C. Thompson copyright_year = 2010 [@Author::RTHOMPSON] synopsis_is_perl_code = false Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/INSTALL000644 000765 000024 00000002167 13014246634 022473 0ustar00ryanstaff000000 000000 This is the Perl distribution Pod-Weaver-Plugin-EnsureUniqueSections. Installing Pod-Weaver-Plugin-EnsureUniqueSections is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm Pod::Weaver::Plugin::EnsureUniqueSections If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S Pod::Weaver::Plugin::EnsureUniqueSections ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Pod::Weaver::Plugin::EnsureUniqueSections ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install ## Documentation Pod-Weaver-Plugin-EnsureUniqueSections documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc Pod::Weaver::Plugin::EnsureUniqueSections Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/lib/000755 000765 000024 00000000000 13014246634 022202 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/LICENSE000644 000765 000024 00000043671 13014246634 022454 0ustar00ryanstaff000000 000000 This software is copyright (c) 2010 by Ryan C. Thompson. 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) 2010 by Ryan C. Thompson. 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) 2010 by Ryan C. Thompson. 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 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/Makefile.PL000644 000765 000024 00000004545 13014246634 023416 0ustar00ryanstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.003. use strict; use warnings; use 5.012; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Ensure that POD has no duplicate section headers.", "AUTHOR" => "Ryan C. Thompson ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Pod-Weaver-Plugin-EnsureUniqueSections", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.012", "NAME" => "Pod::Weaver::Plugin::EnsureUniqueSections", "PREREQ_PM" => { "Carp" => 0, "Lingua::EN::Inflect::Number" => 0, "Moose" => 0, "Moose::Autobox" => "0.10", "MooseX::Has::Sugar" => 0, "Pod::Weaver::Role::Finalizer" => 0, "Pod::Weaver::Role::Preparer" => 0, "Text::Trim" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "PPI" => 0, "Pod::Elemental" => 0, "Pod::Elemental::Selectors" => 0, "Pod::Elemental::Transformer::Nester" => 0, "Pod::Elemental::Transformer::Pod5" => 0, "Pod::Weaver" => 0, "Scalar::Util" => 0, "Software::License::Artistic_1_0" => 0, "Test::Exception" => 0, "Test::More" => "0.94", "blib" => "1.01" }, "VERSION" => "0.163250", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Lingua::EN::Inflect::Number" => 0, "Moose" => 0, "Moose::Autobox" => "0.10", "MooseX::Has::Sugar" => 0, "PPI" => 0, "Pod::Elemental" => 0, "Pod::Elemental::Selectors" => 0, "Pod::Elemental::Transformer::Nester" => 0, "Pod::Elemental::Transformer::Pod5" => 0, "Pod::Weaver" => 0, "Pod::Weaver::Role::Finalizer" => 0, "Pod::Weaver::Role::Preparer" => 0, "Scalar::Util" => 0, "Software::License::Artistic_1_0" => 0, "Test::Exception" => 0, "Test::More" => "0.94", "Text::Trim" => 0, "blib" => "1.01", "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); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/MANIFEST000644 000765 000024 00000001126 13014246634 022565 0ustar00ryanstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.003. Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Pod/Weaver/Plugin/EnsureUniqueSections.pm t/00-compile.t t/000-report-versions.t t/author-critic.t t/author-pod-coverage.t t/author-pod-syntax.t t/eg/duplicate-leftovers.pod t/eg/duplicate-synopsis.pod t/eg/inexact-duplicate.pod t/eg/no-duplicates.pod t/eg/strict/weaver.ini t/eg/weaver.ini t/eg/with-author-section.pod t/main.t t/release-has-version.t t/release-kwalitee.t t/release-portability.t t/release-unused-vars.t weaver.ini Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/META.json000644 000765 000024 00000005130 13014246634 023054 0ustar00ryanstaff000000 000000 { "abstract" : "Ensure that POD has no duplicate section headers.", "author" : [ "Ryan C. Thompson " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.003, CPAN::Meta::Converter version 2.150005", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Pod-Weaver-Plugin-EnsureUniqueSections", "no_index" : { "directory" : [ "corpus" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.008" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::Kwalitee" : "1.21", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "Carp" : "0", "Lingua::EN::Inflect::Number" : "0", "Moose" : "0", "Moose::Autobox" : "0.10", "MooseX::Has::Sugar" : "0", "Pod::Weaver::Role::Finalizer" : "0", "Pod::Weaver::Role::Preparer" : "0", "Text::Trim" : "0", "perl" : "5.012", "strict" : "0", "utf8" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "PPI" : "0", "Pod::Elemental" : "0", "Pod::Elemental::Selectors" : "0", "Pod::Elemental::Transformer::Nester" : "0", "Pod::Elemental::Transformer::Pod5" : "0", "Pod::Weaver" : "0", "Scalar::Util" : "0", "Software::License::Artistic_1_0" : "0", "Test::Exception" : "0", "Test::More" : "0.94", "blib" : "1.01", "perl" : "5.012" } } }, "provides" : { "Pod::Weaver::Plugin::EnsureUniqueSections" : { "file" : "lib/Pod/Weaver/Plugin/EnsureUniqueSections.pm", "version" : "0.163250" } }, "release_status" : "stable", "resources" : { "homepage" : "https://github.com/DarwinAwardWinner/Pod-Weaver-Plugin-EnsureUniqueSections", "repository" : { "type" : "git", "url" : "https://github.com/DarwinAwardWinner/Pod-Weaver-Plugin-EnsureUniqueSections.git", "web" : "https://github.com/DarwinAwardWinner/Pod-Weaver-Plugin-EnsureUniqueSections" } }, "version" : "0.163250" } Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/META.yml000644 000765 000024 00000002662 13014246634 022713 0ustar00ryanstaff000000 000000 --- abstract: 'Ensure that POD has no duplicate section headers.' author: - 'Ryan C. Thompson ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' PPI: '0' Pod::Elemental: '0' Pod::Elemental::Selectors: '0' Pod::Elemental::Transformer::Nester: '0' Pod::Elemental::Transformer::Pod5: '0' Pod::Weaver: '0' Scalar::Util: '0' Software::License::Artistic_1_0: '0' Test::Exception: '0' Test::More: '0.94' blib: '1.01' perl: '5.012' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.008' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.003, CPAN::Meta::Converter version 2.150005' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Pod-Weaver-Plugin-EnsureUniqueSections no_index: directory: - corpus provides: Pod::Weaver::Plugin::EnsureUniqueSections: file: lib/Pod/Weaver/Plugin/EnsureUniqueSections.pm version: '0.163250' requires: Carp: '0' Lingua::EN::Inflect::Number: '0' Moose: '0' Moose::Autobox: '0.10' MooseX::Has::Sugar: '0' Pod::Weaver::Role::Finalizer: '0' Pod::Weaver::Role::Preparer: '0' Text::Trim: '0' perl: '5.012' strict: '0' utf8: '0' warnings: '0' resources: homepage: https://github.com/DarwinAwardWinner/Pod-Weaver-Plugin-EnsureUniqueSections repository: https://github.com/DarwinAwardWinner/Pod-Weaver-Plugin-EnsureUniqueSections.git version: '0.163250' Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/README000644 000765 000024 00000014236 13014246634 022322 0ustar00ryanstaff000000 000000 NAME Pod::Weaver::Plugin::EnsureUniqueSections - Ensure that POD has no duplicate section headers. VERSION version 0.163250 SYNOPSIS In weaver.ini [-EnsureUniqueSections] strict = 0 ; The default DESCRIPTION This plugin simply ensures that the POD after weaving has no duplicate top-level section headers. This can help you if you are converting from writing all your own POD to generating it with Pod::Weaver. If you begin generating a section with Pod::Weaver but you forget to delete the manually written section of the same name, this plugin will warn you. By default, this module does some tricks to detect similar headers, such as AUTHOR and AUTHORS. You can turn this off by setting strict = 1 in weaver.ini, in which case only exactly identical headers will be considered duplicates of each other. DIAGNOSTIC MESSAGES If any similar (or identical if strict is 1) section headers are found, all of their names will be listed on STDERR. Generally, you should take this list of modules and remove each from your POD. Then you should ensure that the sections generated by Pod::Weaver are suitable substitutes for those sections. In the case of similar names, only the first instance in each set of similar names will be listed. ATTRIBUTES strict If set to true (1), section headers will only be considered duplicates if they match exactly. If false (the default), certain similar section headers will be considered equivalent. The following similarities are considered (more may be added later): All whitespace and punctuation are equivalant For example, the following would all be considered duplicates of each other: SEE ALSO, SEE ALSO, SEE,ALSO:. Case-insensitive For example, Name and NAME would be considered duplicates. Sets of words separated by "AND". For example, "COPYRIGHT AND LICENSE" would be considered a duplicate of "LICENSE AND COPYRIGHT". Plurals A plural noun is considered equivalent to its singular. For example, "AUTHOR" and "AUTHORS" are the same section. A section header consisting of multiple words, such as "DISCLAIMER OF WARRANTY", is not affected by this rule. This rule uses Lingua::EN::Inflect::Number to interconvert between singular and plural forms. Hopefully you don't need to make a section called OCTOPI. Note that these rules apply recursively, so Authors; and Contributors would be a duplicate of CONTRIBUTORS AND AUTHOR. METHODS prepare_input This method modifies the weaver object by moving EnsureUniqueSections to the end of the weaver's plugin list to ensure that it gets to look at the final woven POD. THIS IS PURE EVIL. This is a hack to ensure that this plugin gets "the last word". Obviously if all plugins used this it would be total chaos. I welcome alternative suggestions. The main issue is that when other Finalizers, such as Section::Leftovers (which happens to be the most likely plugin to create duplicate sections), produce sections, this plugin will only see those sections if it runs after those Finalizers. Hence the need to be the last plugin on the list. finalize_document This method checks the document for duplicate headers, and throws an error if any are found. If no duplicates are found, it simply does nothing. It does not modify the POD in any way. BUGS AND LIMITATIONS Should also be available as a Dist::Zilla testing plugin I would like to convert this to a Dist::Zilla testing plugin, so that you can use it without enabling Pod::Weaver if you don't want to, but I haven't yet figured out how to find all files in a dist with POD and extract all their headers. If anyone knows, please tell me. No recursive duplicate checks This module only checks for duplicates in top-level headers (i.e. head1). It could be extended to check the head2 elements within each head1 section and so on, but generally Pod::Weaver is not called upon to generate subsections, so you are unlikely to end up with duplicates at any level other than the first. However, if there is demand for recursive duplicate detection, I will add it. Please report any bugs or feature requests to rct+perlbug@thompsonclan.org. SEE ALSO * Pod::Weaver - The module that this is a plugin for. * Lingua::EN::Inflect::Number - Used to determine the singular forms of plural nouns. INSTALLATION See perlmodinstall for information and options on installing Perl modules. AUTHOR Ryan C. Thompson COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Ryan C. Thompson. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "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 SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. 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 SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (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 SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/000755 000765 000024 00000000000 13014246634 021677 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/weaver.ini000644 000765 000024 00000000032 13014246634 023421 0ustar00ryanstaff000000 000000 ; weaver.ini [@RTHOMPSON] Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/00-compile.t000644 000765 000024 00000002363 13014246634 023735 0ustar00ryanstaff000000 000000 use 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Pod/Weaver/Plugin/EnsureUniqueSections.pm' ); # no fake home requested my $inc_switch = -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; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-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: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/000-report-versions.t000644 000765 000024 00000031270 13014246634 025545 0ustar00ryanstaff000000 000000 #!perl use warnings; use strict; use Test::More 0.94; # Include a cut-down version of YAML::Tiny so we don't introduce unnecessary # dependencies ourselves. package Local::YAML::Tiny; use strict; use Carp 'croak'; # UTF Support? sub HAVE_UTF8 () { $] >= 5.007003 } BEGIN { if ( HAVE_UTF8 ) { # The string eval helps hide this from Test::MinimumVersion eval "require utf8;"; die "Failed to load UTF-8 support" if $@; } # Class structure require 5.004; $YAML::Tiny::VERSION = '1.40'; # Error storage $YAML::Tiny::errstr = ''; } # Printable characters for escapes my %UNESCAPES = ( z => "\x00", a => "\x07", t => "\x09", n => "\x0a", v => "\x0b", f => "\x0c", r => "\x0d", e => "\x1b", '\\' => '\\', ); ##################################################################### # Implementation # Create an empty YAML::Tiny object sub new { my $class = shift; bless [ @_ ], $class; } # Create an object from a file sub read { my $class = ref $_[0] ? ref shift : shift; # Check the file my $file = shift or return $class->_error( 'You did not specify a file name' ); return $class->_error( "File '$file' does not exist" ) unless -e $file; return $class->_error( "'$file' is a directory, not a file" ) unless -f _; return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _; # Slurp in the file local $/ = undef; local *CFG; unless ( open(CFG, $file) ) { return $class->_error("Failed to open file '$file': $!"); } my $contents = ; unless ( close(CFG) ) { return $class->_error("Failed to close file '$file': $!"); } $class->read_string( $contents ); } # Create an object from a string sub read_string { my $class = ref $_[0] ? ref shift : shift; my $self = bless [], $class; my $string = $_[0]; unless ( defined $string ) { return $self->_error("Did not provide a string to load"); } # Byte order marks # NOTE: Keeping this here to educate maintainers # my %BOM = ( # "\357\273\277" => 'UTF-8', # "\376\377" => 'UTF-16BE', # "\377\376" => 'UTF-16LE', # "\377\376\0\0" => 'UTF-32LE' # "\0\0\376\377" => 'UTF-32BE', # ); if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) { return $self->_error("Stream has a non UTF-8 BOM"); } else { # Strip UTF-8 bom if found, we'll just ignore it $string =~ s/^\357\273\277//; } # Try to decode as utf8 utf8::decode($string) if HAVE_UTF8; # Check for some special cases return $self unless length $string; unless ( $string =~ /[\012\015]+\z/ ) { return $self->_error("Stream does not end with newline character"); } # Split the file into lines my @lines = grep { ! /^\s*(?:\#.*)?\z/ } split /(?:\015{1,2}\012|\015|\012)/, $string; # Strip the initial YAML header @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines; # A nibbling parser while ( @lines ) { # Do we have a document header? if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) { # Handle scalar documents shift @lines; if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) { push @$self, $self->_read_scalar( "$1", [ undef ], \@lines ); next; } } if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) { # A naked document push @$self, undef; while ( @lines and $lines[0] !~ /^---/ ) { shift @lines; } } elsif ( $lines[0] =~ /^\s*\-/ ) { # An array at the root my $document = [ ]; push @$self, $document; $self->_read_array( $document, [ 0 ], \@lines ); } elsif ( $lines[0] =~ /^(\s*)\S/ ) { # A hash at the root my $document = { }; push @$self, $document; $self->_read_hash( $document, [ length($1) ], \@lines ); } else { croak("YAML::Tiny failed to classify the line '$lines[0]'"); } } $self; } # Deparse a scalar string to the actual scalar sub _read_scalar { my ($self, $string, $indent, $lines) = @_; # Trim trailing whitespace $string =~ s/\s*\z//; # Explitic null/undef return undef if $string eq '~'; # Quotes if ( $string =~ /^\'(.*?)\'\z/ ) { return '' unless defined $1; $string = $1; $string =~ s/\'\'/\'/g; return $string; } if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) { # Reusing the variable is a little ugly, # but avoids a new variable and a string copy. $string = $1; $string =~ s/\\"/"/g; $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex; return $string; } # Special cases if ( $string =~ /^[\'\"!&]/ ) { croak("YAML::Tiny does not support a feature in line '$lines->[0]'"); } return {} if $string eq '{}'; return [] if $string eq '[]'; # Regular unquoted string return $string unless $string =~ /^[>|]/; # Error croak("YAML::Tiny failed to find multi-line scalar content") unless @$lines; # Check the indent depth $lines->[0] =~ /^(\s*)/; $indent->[-1] = length("$1"); if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } # Pull the lines my @multiline = (); while ( @$lines ) { $lines->[0] =~ /^(\s*)/; last unless length($1) >= $indent->[-1]; push @multiline, substr(shift(@$lines), length($1)); } my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n"; my $t = (substr($string, 1, 1) eq '-') ? '' : "\n"; return join( $j, @multiline ) . $t; } # Parse an array sub _read_array { my ($self, $array, $indent, $lines) = @_; while ( @$lines ) { # Check for a new document if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { while ( @$lines and $lines->[0] !~ /^---/ ) { shift @$lines; } return 1; } # Check the indent level $lines->[0] =~ /^(\s*)/; if ( length($1) < $indent->[-1] ) { return 1; } elsif ( length($1) > $indent->[-1] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) { # Inline nested hash my $indent2 = length("$1"); $lines->[0] =~ s/-/ /; push @$array, { }; $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) { # Array entry with a value shift @$lines; push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines ); } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) { shift @$lines; unless ( @$lines ) { push @$array, undef; return 1; } if ( $lines->[0] =~ /^(\s*)\-/ ) { my $indent2 = length("$1"); if ( $indent->[-1] == $indent2 ) { # Null array entry push @$array, undef; } else { # Naked indenter push @$array, [ ]; $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines ); } } elsif ( $lines->[0] =~ /^(\s*)\S/ ) { push @$array, { }; $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); } else { croak("YAML::Tiny failed to classify line '$lines->[0]'"); } } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) { # This is probably a structure like the following... # --- # foo: # - list # bar: value # # ... so lets return and let the hash parser handle it return 1; } else { croak("YAML::Tiny failed to classify line '$lines->[0]'"); } } return 1; } # Parse an array sub _read_hash { my ($self, $hash, $indent, $lines) = @_; while ( @$lines ) { # Check for a new document if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { while ( @$lines and $lines->[0] !~ /^---/ ) { shift @$lines; } return 1; } # Check the indent level $lines->[0] =~ /^(\s*)/; if ( length($1) < $indent->[-1] ) { return 1; } elsif ( length($1) > $indent->[-1] ) { croak("YAML::Tiny found bad indenting in line '$lines->[0]'"); } # Get the key unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) { if ( $lines->[0] =~ /^\s*[?\'\"]/ ) { croak("YAML::Tiny does not support a feature in line '$lines->[0]'"); } croak("YAML::Tiny failed to classify line '$lines->[0]'"); } my $key = $1; # Do we have a value? if ( length $lines->[0] ) { # Yes $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines ); } else { # An indent shift @$lines; unless ( @$lines ) { $hash->{$key} = undef; return 1; } if ( $lines->[0] =~ /^(\s*)-/ ) { $hash->{$key} = []; $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines ); } elsif ( $lines->[0] =~ /^(\s*)./ ) { my $indent2 = length("$1"); if ( $indent->[-1] >= $indent2 ) { # Null hash entry $hash->{$key} = undef; } else { $hash->{$key} = {}; $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); } } } } return 1; } # Set error sub _error { $YAML::Tiny::errstr = $_[1]; undef; } # Retrieve error sub errstr { $YAML::Tiny::errstr; } ##################################################################### # Use Scalar::Util if possible, otherwise emulate it BEGIN { eval { require Scalar::Util; }; if ( $@ ) { # Failed to load Scalar::Util eval <<'END_PERL'; sub refaddr { my $pkg = ref($_[0]) or return undef; if (!!UNIVERSAL::can($_[0], 'can')) { bless $_[0], 'Scalar::Util::Fake'; } else { $pkg = undef; } "$_[0]" =~ /0x(\w+)/; my $i = do { local $^W; hex $1 }; bless $_[0], $pkg if defined $pkg; $i; } END_PERL } else { Scalar::Util->import('refaddr'); } } ##################################################################### # main test ##################################################################### package main; BEGIN { # Skip modules that either don't want to be loaded directly, such as # Module::Install, or that mess with the test count, such as the Test::* # modules listed here. # # Moose::Role conflicts if Moose is loaded as well, but Moose::Role is in # the Moose distribution and it's certain that someone who uses # Moose::Role also uses Moose somewhere, so if we disallow Moose::Role, # we'll still get the relevant version number. my %skip = map { $_ => 1 } qw( App::FatPacker Class::Accessor::Classy Devel::Cover Module::Install Moose::Role POE::Loop::Tk Template::Test Test::Kwalitee Test::Pod::Coverage Test::Portability::Files Test::YAML::Meta open ); my $Test = Test::Builder->new; $Test->plan(skip_all => "META.yml could not be found") unless -f 'META.yml' and -r _; my $meta = (Local::YAML::Tiny->read('META.yml'))->[0]; my %requires; for my $require_key (grep { /requires/ } keys %$meta) { my %h = %{ $meta->{$require_key} }; $requires{$_}++ for keys %h; } delete $requires{perl}; diag("Testing with Perl $], $^X"); for my $module (sort keys %requires) { if ($skip{$module}) { note "$module doesn't want to be loaded directly, skipping"; next; } local $SIG{__WARN__} = sub { note "$module: $_[0]" }; require_ok $module or BAIL_OUT("can't load $module"); my $version = $module->VERSION; $version = 'undefined' unless defined $version; diag(" $module version is $version"); } done_testing; } Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/author-critic.t000644 000765 000024 00000000666 13014246634 024651 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/author-pod-coverage.t000644 000765 000024 00000000565 13014246634 025745 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/author-pod-syntax.t000644 000765 000024 00000000503 13014246634 025470 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } # 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(); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/000755 000765 000024 00000000000 13014246634 022272 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/main.t000644 000765 000024 00000004201 13014246634 023005 0ustar00ryanstaff000000 000000 use strict; use warnings; use Test::More; use Test::Exception; use Moose::Autobox 0.10; use PPI; use Pod::Elemental; use Pod::Elemental::Selectors -all; use Pod::Elemental::Transformer::Pod5; use Pod::Elemental::Transformer::Nester; use Pod::Weaver; require Software::License::Artistic_1_0; sub slurp_file { do { local $/; open my $fh, '<', shift; <$fh> }; } sub read_pod { Pod::Elemental->read_string(slurp_file(shift)); } my $perl_document = do { local $/; }; my $ppi_document = PPI::Document->new(\$perl_document); sub try_weave { my ($weaver, $pod_document) = @_; my $woven = $weaver->weave_document({ pod_document => $pod_document, ppi_document => $ppi_document, version => '1.012078', authors => [ 'Ricardo Signes ', 'Molly Millions ', ], license => Software::License::Artistic_1_0->new({ holder => 'Ricardo Signes', year => 1999, }), }); return $woven; } my $no_dups_pod = read_pod 't/eg/no-duplicates.pod'; my $inexact_dup_pod = read_pod 't/eg/inexact-duplicate.pod'; my @dup_pods = map { read_pod "t/eg/$_" } qw( duplicate-leftovers.pod duplicate-synopsis.pod with-author-section.pod ); my $weaver = Pod::Weaver->new_from_config({ root => 't/eg' }); my $strict_weaver = Pod::Weaver->new_from_config({ root => 't/eg/strict' }); my $error_regex = qr{The following headers appear multiple times}; lives_ok { try_weave($weaver, $no_dups_pod); } "doesn't throw error on a POD document with no duplicated headings."; throws_ok { try_weave($weaver, $inexact_dup_pod); } $error_regex, 'Non-strict mode throws error on inexact duplicate headers'; lives_ok { try_weave($strict_weaver, $inexact_dup_pod); } 'Strict mode does not throw error on inexact duplicate headers'; for my $pod (@dup_pods) { throws_ok{ try_weave($weaver, $pod); } $error_regex, 'throws error on pod with duplicate sections, whether pre-existing or generated.'; } done_testing; __DATA__ package Module::Name; # ABSTRACT: abstract text my $this = 'a test'; Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/release-has-version.t000644 000765 000024 00000000473 13014246634 025744 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More; eval "use Test::HasVersion"; plan skip_all => "Test::HasVersion required for testing version numbers" if $@; all_pm_version_ok(); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/release-kwalitee.t000644 000765 000024 00000000533 13014246634 025310 0ustar00ryanstaff000000 000000 BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok(); done_testing; Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/release-portability.t000644 000765 000024 00000000535 13014246634 026047 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } 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(); Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/release-unused-vars.t000644 000765 000024 00000000620 13014246634 025754 0ustar00ryanstaff000000 000000 #!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } use Test::More 0.96 tests => 1; eval { require Test::Vars }; SKIP: { skip 1 => 'Test::Vars required for testing for unused vars' if $@; Test::Vars->import; subtest 'unused vars' => sub { all_vars_ok(); }; }; Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/duplicate-leftovers.pod000644 000765 000024 00000000473 13014246634 026763 0ustar00ryanstaff000000 000000 =pod =head1 SYNOPSIS This is a synopsis. =head1 DESCRIPTION This is a simple document meant to be used in testing Pod::Weaver::Plugin::EnsureUniqueSections. It does not do very much. =head1 MORE INFO This extra section has some more info. =head1 MORE INFO This extra section also has some more info. =cut Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/duplicate-synopsis.pod000644 000765 000024 00000000417 13014246634 026637 0ustar00ryanstaff000000 000000 =pod =head1 SYNOPSIS This is a synopsis =head1 SYNOPSIS This is another synopsis. Having two synopses is a problem. =head1 DESCRIPTION This is a simple document meant to be used in testing Pod::Weaver::Plugin::EnsureUniqueSections. It does not do very much. =cut Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/inexact-duplicate.pod000644 000765 000024 00000000654 13014246634 026406 0ustar00ryanstaff000000 000000 =pod =head1 SYNOPSIS This is a synopsis. =head1 DESCRIPTION This is a simple document meant to be used in testing Pod::Weaver::Plugin::EnsureUniqueSections. It does not do very much. =head1 BUGS AND LIMITATIONS This section should be considered a duplicate of the next in non-strict checking mode. =head1 LIMITATION AND This section should be considered a duplicate of the last in non-strict checking mode. =cut Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/no-duplicates.pod000644 000765 000024 00000000302 13014246634 025540 0ustar00ryanstaff000000 000000 =pod =head1 SYNOPSIS This is a synopsis. =head1 DESCRIPTION This is a simple document meant to be used in testing Pod::Weaver::Plugin::EnsureUniqueSections. It does not do very much. =cut Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/strict/000755 000765 000024 00000000000 13014246634 023602 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/weaver.ini000644 000765 000024 00000000571 13014246634 024267 0ustar00ryanstaff000000 000000 ; Putting this first in order to test its ability to move itself to ; the end of the list when needed. [-EnsureUniqueSections] [@CorePrep] [Name] [Version] [Region / prelude] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Generic / OVERVIEW] [Collect / ATTRIBUTES] command = attr [Collect / METHODS] command = method [Leftovers] [Region / postlude] [Authors] [Legal] Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/with-author-section.pod000644 000765 000024 00000000672 13014246634 026720 0ustar00ryanstaff000000 000000 =pod =head1 SYNOPSIS This is a synopsis. =head1 DESCRIPTION This is a simple document meant to be used in testing Pod::Weaver::Plugin::EnsureUniqueSections. This POD already has an AUTHORS section, but a second one will be generated when it is processed by Pod::Weaver. Hopefully this problem will be caught. =head1 AUTHORS =over 4 =item * Ricardo Signes =item * Molly Millions =back =cut Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/t/eg/strict/weaver.ini000644 000765 000024 00000000604 13014246634 025574 0ustar00ryanstaff000000 000000 ; Putting this first in order to test its ability to move itself to ; the end of the list when needed. [-EnsureUniqueSections] strict = 1 [@CorePrep] [Name] [Version] [Region / prelude] [Generic / SYNOPSIS] [Generic / DESCRIPTION] [Generic / OVERVIEW] [Collect / ATTRIBUTES] command = attr [Collect / METHODS] command = method [Leftovers] [Region / postlude] [Authors] [Legal] Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/lib/Pod/000755 000765 000024 00000000000 13014246634 022724 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/lib/Pod/Weaver/000755 000765 000024 00000000000 13014246634 024155 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/lib/Pod/Weaver/Plugin/000755 000765 000024 00000000000 13014246634 025413 5ustar00ryanstaff000000 000000 Pod-Weaver-Plugin-EnsureUniqueSections-0.163250/lib/Pod/Weaver/Plugin/EnsureUniqueSections.pm000644 000765 000024 00000020577 13014246634 032124 0ustar00ryanstaff000000 000000 use strict; use warnings; use utf8; package Pod::Weaver::Plugin::EnsureUniqueSections; $Pod::Weaver::Plugin::EnsureUniqueSections::VERSION = '0.163250'; use Moose; use MooseX::Has::Sugar; use Moose::Autobox 0.10; use Text::Trim; use Lingua::EN::Inflect::Number qw(to_S); use Carp; with 'Pod::Weaver::Role::Finalizer'; with 'Pod::Weaver::Role::Preparer'; # ABSTRACT: Ensure that POD has no duplicate section headers. has strict => ( ro, lazy, isa => 'Bool', default => sub { 0 }, ); sub _header_key { my ($self, $text) = @_; if (!$self->strict) { # Replace all non-words with a single space $text =~ s{\W+}{ }xsmg; # Trim leading and trailing whitespace $text = trim $text; # All to uppercase $text = uc $text; # Reorder "AND" lists and singularize nouns $text = $text ->split(qr{ AND }i) ->map(sub { m{\W} ? $_ : to_S $_; }) ->sort->join(' AND '); } return $text; } sub prepare_input { my $self = shift; # Put EnsureUniqueSections plugins at the end my $plugins = $self->weaver->plugins; @$plugins = ((grep { $_ != $self } @$plugins), $self); } sub finalize_document { my ($self, $document) = @_; my $headers = $document->children ->grep(sub{ $_->can( 'command' ) and $_->command eq 'head1' }) ->map(sub{ $_->content }); my %header_group; for my $h (@$headers) { push @{$header_group{$self->_header_key($h)}}, $h; } my $duplicate_headers = [ keys %header_group ] ->map(sub{ @{$header_group{$_}} > 1 ? $header_group{$_}->head : () }) ->sort; if (@$duplicate_headers > 0) { my $pod_string = ""; for my $h (@$duplicate_headers) { for my $node (@{ $document->children->grep( sub { $_->can('command') && $_->command eq 'head1' && $_->content eq $h }) }) { $pod_string .= $node->as_pod_string; } } $self->log_debug(["POD of duplicated headers:\n\n%s", $pod_string]); my $message = "Error: The following headers appear multiple times: '" . $duplicate_headers->join(q{', '}) . q{'}; $self->log_fatal($message); } } 1; # Magic true value required at end of module __END__ =pod =head1 NAME Pod::Weaver::Plugin::EnsureUniqueSections - Ensure that POD has no duplicate section headers. =head1 VERSION version 0.163250 =head1 SYNOPSIS In F [-EnsureUniqueSections] strict = 0 ; The default =head1 DESCRIPTION This plugin simply ensures that the POD after weaving has no duplicate top-level section headers. This can help you if you are converting from writing all your own POD to generating it with L. If you begin generating a section with L but you forget to delete the manually written section of the same name, this plugin will warn you. By default, this module does some tricks to detect similar headers, such as C and C. You can turn this off by setting C in F, in which case only I headers will be considered duplicates of each other. =head2 DIAGNOSTIC MESSAGES If any similar (or identical if C is 1) section headers are found, all of their names will be listed on STDERR. Generally, you should take this list of modules and remove each from your POD. Then you should ensure that the sections generated by L are suitable substitutes for those sections. In the case of similar names, only the first instance in each set of similar names will be listed. =head1 ATTRIBUTES =head2 strict If set to true (1), section headers will only be considered duplicates if they match exactly. If false (the default), certain similar section headers will be considered equivalent. The following similarities are considered (more may be added later): =over 4 =item All whitespace and punctuation are equivalant For example, the following would all be considered duplicates of each other: C< SEE ALSO>, C, C. =item Case-insensitive For example, C and C would be considered duplicates. =item Sets of words separated by "AND". For example, "COPYRIGHT AND LICENSE" would be considered a duplicate of "LICENSE AND COPYRIGHT". =item Plurals A plural noun is considered equivalent to its singular. For example, "AUTHOR" and "AUTHORS" are the same section. A section header consisting of multiple words, such as "DISCLAIMER OF WARRANTY", is not affected by this rule. This rule uses L to interconvert between singular and plural forms. Hopefully you don't need to make a section called C. =back Note that these rules apply recursively, so C would be a duplicate of C< CONTRIBUTORS AND AUTHOR>. =head1 METHODS =head2 prepare_input This method modifies the weaver object by moving EnsureUniqueSections to the end of the weaver's plugin list to ensure that it gets to look at the final woven POD. THIS IS PURE EVIL. This is a hack to ensure that this plugin gets "the last word". Obviously if all plugins used this it would be total chaos. I welcome alternative suggestions. The main issue is that when other Finalizers, such as Section::Leftovers (which happens to be the most likely plugin to create duplicate sections), produce sections, this plugin will only see those sections if it runs after those Finalizers. Hence the need to be the last plugin on the list. =head2 finalize_document This method checks the document for duplicate headers, and throws an error if any are found. If no duplicates are found, it simply does nothing. It does not modify the POD in any way. =head1 BUGS AND LIMITATIONS =head2 Should also be available as a L testing plugin I would like to convert this to a L testing plugin, so that you can use it without enabling L if you don't want to, but I haven't yet figured out how to find all files in a dist with POD and extract all their headers. If anyone knows, please tell me. =head2 No recursive duplicate checks This module only checks for duplicates in top-level headers (i.e. C). It could be extended to check the C elements within each C section and so on, but generally L is not called upon to generate subsections, so you are unlikely to end up with duplicates at any level other than the first. However, if there is demand for recursive duplicate detection, I will add it. Please report any bugs or feature requests to C. =head1 SEE ALSO =over 4 =item * L - The module that this is a plugin for. =item * L - Used to determine the singular forms of plural nouns. =back =head1 INSTALLATION See perlmodinstall for information and options on installing Perl modules. =head1 AUTHOR Ryan C. Thompson =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Ryan C. Thompson. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "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 SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. 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 SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (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 SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut