Pod::W...ections(3pm)

πŸ“¦
version 0.163250 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

Pod::Weaver::Plugin::EnsureUniqueSections πŸ’–

okay bestie, gather round, because this is a Perl module and its whole entire job is making sure your POD doesn't have two sections with the same name. that's it. that's the vibe. it lives in the Pod::Weaver::Plugin::EnsureUniqueSections namespace and it is version 0.163250 ✨


🌸 NAME 🌸

Pod::Weaver::Plugin::EnsureUniqueSections β€” make sure your POD has no duplicate section headers, periodt. no cap. πŸ’…


πŸ¦‹ VERSION πŸ¦‹

version 0.163250


✨ SYNOPSIS ✨

so in your weaver.ini you just drop this in:

[-EnsureUniqueSections]
strict = 0 ; The default

and boom, you're protected. 🫢


πŸŽ€ DESCRIPTION πŸŽ€

this plugin literally just makes sure that the POD you get after weaving has zero duplicate top-level section headers. that's the whole thing. πŸ’–

ngl it's a lifesaver if you're in your "converting from writing all my own POD by hand to generating it with Pod::Weaver" era. like, imagine you start generating a section with Pod::Weaver but you forget to delete the manually-written section with the same name β€” now you've got two of the same thing and it's giving chaos. this plugin will warn you about it. it's the friend who texts you "bestie you posted that twice." 😭

by default this module does some little tricks to catch similar headers, like "AUTHOR" and "AUTHORS". if that's too much for you, set strict = 1 in weaver.ini and then only headers that are exactly identical count as duplicates. simple as that.

πŸ’€ DIAGNOSTIC MESSAGES πŸ’€

if any similar (or identical, when strict is 1) section headers get found, all of their names get listed on STDERR. πŸ“’

generally you should take this list of modules and remove each one from your POD. then you should make sure the sections generated by Pod::Weaver are suitable substitutes for those sections. and in the case of similar names, only the first instance in each set of similar names will be listed. iykyk.


πŸ’œ ATTRIBUTES πŸ’œ

🧚 strict

if it's set to true (1), section headers only count as duplicates if they match exactly. if it's false (which is the default), certain similar section headers get considered equivalent. here's what similarities are considered (and more may be added later, so stay tuned bestie):

  • 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. but heads up: 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". the recursion is recursive. we love to see it. πŸ’…

πŸ”₯ METHODS πŸ”₯

πŸ‘‘ prepare_input

this method modifies the weaver object by moving EnsureUniqueSections to the end of the weaver's plugin list, so it gets to look at the final woven POD. it simply must be the last one to speak.

THIS IS PURE EVIL. 😈

this is a hack to ensure that this plugin gets "the last word". obviously if all plugins did 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. main character energy, honestly. ✨

πŸ¦‹ 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. truly a "if you have nothing to say, say nothing" icon. πŸ’–


😭 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 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. pinky promise. πŸ’…

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. it's giving "read the docs" but in the nicest way. πŸŽ€


πŸ’– AUTHOR πŸ’–

Ryan C. Thompson <rct@thompsonclan.org>


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. slay. 🫢


🚨 DISCLAIMER OF WARRANTY 🚨

okay bestie this next part is the legal bit so we're keeping it word for word, no edits, no vibes, just facts. read it. it matters. πŸ‘‘

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.


and that's the whole page, bestie πŸ’… this fine piece of documentation was generated by perl v5.34.0 on 2022-06-16, so go forth and let no section header ever be duplicated again. mwah. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from