Text-Format-0.62000755000764000764 013742235532 14116 5ustar00shlomifshlomif000000000000README100644000764000764 56013742235532 15040 0ustar00shlomifshlomif000000000000Text-Format-0.62This archive contains the distribution Text-Format, version 0.62: Various subroutines to format text. This software is copyright (c) 2020 by Gabor Egressy. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v6.015. Changes100644000764000764 1326713742235532 15523 0ustar00shlomifshlomif000000000000Text-Format-0.62Revision history for Perl extension Text::Format. 0.62 2020-10-16 - dist.ini / weaver.ini / .tidyallrc / etc. cleanup - Move to @SHLOMIF - Inspired by Lady_Aleena. - Fix the URL to the VCS repository. 0.61 2018-05-21 - Convert to Dist-Zilla . 0.60 2016-08-22 - Apply a patch to correct a spelling error: - https://rt.cpan.org/Ticket/Display.html?id=117100 - Thanks to Salvatore Bonaccorso, Debian Perl Group. 0.59 2014-02-01 - Add the missing README to the distribution (CPANTS). - Add a LICENSE file (CPANTS). - Add a "=head1 LICENSE" section to the POD (CPANTS). - Minimum version of perl in META.yml (CPANTS). - Add "use warnings;" (CPANTS). - Add t/cpan-changes.t and t/style-trailing-space.t . 0.58 2012-09-04 - Apply a patch to correct a minor grammatical error: - https://rt.cpan.org/Ticket/Display.html?id=79400 - Thanks to Salvatore Bonaccorso, Debian Perl Group. 0.57 2012-09-04 - Clarified the documentation regarding noBreak and noBreakRegex. - Thanks to Anne Wainwright. 0.56 2012-05-31 - Add "use warnings;" to lib/Text/Format.pm . - Add t/pod.t . - Add t/pod-coverage.t . 0.55 2012-05-31 - Fix small spelling error in the POD: - closing https://rt.cpan.org/Ticket/Display.html?id=77481 - Thanks to Salvatore Bonaccorso and the Debian people for the report and the patch. - ( There were also some duplicate bug report in the rt.cpan.org queue by accident. ) 0.54 2012-05-25 - Convert t/justify.t and t/format.t to Test::More, "use strict;" and "use warnings;" and cleaned them up. - fix a warning generated by a call to defined(@array) - https://rt.cpan.org/Ticket/Display.html?id=77413 - thanks to H. Merijn Brand for the report. 0.53 2011-01-28 - Adopted by Shlomi Fish (while disclaiming all rights). - Convert the build system to Module-Build, while adding keywords and resources. - The archive name is now the more standard Text-Format-0.53.tar.gz. - Fix some typos in the documentation. 0.52 1998-03-29 - fixed some warnings that appeared when using hanging indents (tagged paragraphs). Also added tha ability to use a list as an argument to new() and config() so you can pass a hash ref or a list as long as the list length is mod 2 == 0 0.51 1998-02-24 - no real bug fix, just the MANIFEST was wrong, also I got a test script for testing the justify feature from the guy who originally wrote the code for justify 0.50 1998-02-21 - there were no bugs but I figured that the new feature should really have its own release. I also tried to make the justification a little faster, and the extra spaces are now added starting on the right side of the text instead of the left - fixed up the docs a little as well 0.46 1998-02-18 - fixed bug in justify when there was only one word left for the last line it would consider the previous line to be the last line and not justify it. :-( 0.45 1998-02-18 - changed the way hanging indents behave when there are more paragraphs than indent tags, previously the first tag was reused, now an empty text is used if there are no more tags available. - added the justify feature, this will jsutify the text to both margins, the rightAlign feture would jusstify to the rigght margin and default is to justify to the left margin. if rightAlign or rightFill are set then justify is ignored. rightFill fills the right side with spaces 0.44 1998-02-12 - added quotes to hash keys as 5.003 didn't like unquoted hash keys starting with an underscore 0.43 1998-02-07 - fixed some warnings that were occurring 0.42 1998-02-06 - no real changes as far as the user is concerned - changed some internal subroutines from being just a reference to being a real subroutine so Objects that inherit from Text::Format can use them 0.41 1998-02-02 - fixed non-breaking space bug - added some more error checking to new() and config() 0.40 1998-01-29 - added support for non-breaking space - made some changes that make the module incompatible with the previous version * firstIndent and bodyIndent now take a number as an argument and spaces are used for the indents at all times rather than the previously specified strings * expandTabs is gone - to expand tabs prior to using center() just use Text::Format->expand() first * subroutines wrap and fill renamed to format() and paragraphs() to reflect their usage - fixed the bug due to the right margin not being considered when doing right alignment 0.33 1998-01-21 - added left margin and right margin spec, left out by accident before 0.32 1998-01-17 - fixed another bug :-( 0.31 1998-01-16 - renamed module to Format.pm (was Manip.pm) fixed a warning; was operating on an undef'ed string without checking now check for defined strings 0.30 1998-01-14 - added ability to do hanging indents, fixed the interface for a better object oriented design, fixed some more bugs 0.23 1998-01-10 - few bug fixes 0.22 1998-01-10 - addition of expand/unexpand routines 0.21 1998-01-09 - addition of center routine 0.20 1998-01-08 - change to object oriented module 0.10 1998-01-06 - original version routines are : wrap, fill basically the same as Text::Wrap at this point just without the chance for dying, it's just a basic module - Andreas Koenig suggested to make it object oriented LICENSE100644000764000764 5013113742235532 15224 0ustar00shlomifshlomif000000000000Text-Format-0.62Terms of Perl 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" ---------------------------------------------------------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, 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 licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU 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. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), 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 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 show them these terms so they know 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. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 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 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 derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 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 License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 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. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary 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 License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 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 Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing 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 for copying, distributing or modifying the Program or works based on it. 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. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. 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 this 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 this License, you may choose any version ever published by the Free Software Foundation. 10. 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 11. 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. 12. 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 ---------------------------------------------------------------------------- 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 dist.ini100644000764000764 77213742235532 15631 0ustar00shlomifshlomif000000000000Text-Format-0.62name = Text-Format version = 0.62 author = Shlomi Fish license = Perl_5 copyright_holder = Gabor Egressy [@Filter] -bundle = @SHLOMIF -remove = License dist = Text-Format github_name = perl-Module-Format homepage = http://www.shlomifish.org/open-source/projects/Text-Format/ repository_url = https://github.com/shlomif/perl-Module-Format [Keywords] keyword = format keyword = formatting keyword = margin keyword = margins keyword = string keyword = text keyword = width [Test::TidyAll] META.yml100644000764000764 2677213742235532 15506 0ustar00shlomifshlomif000000000000Text-Format-0.62--- abstract: 'Various subroutines to format text.' author: - 'Shlomi Fish ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Module::Build: '0.28' Test::More: '0.88' configure_requires: ExtUtils::MakeMaker: '0' Module::Build: '0.28' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010' keywords: - format - formatting - margin - margins - string - text - width license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Text-Format provides: Text::Format: file: lib/Text/Format.pm version: '0.62' requires: Carp: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://github.com/shlomif/perl-Module-Format/issues homepage: http://www.shlomifish.org/open-source/projects/Text-Format/ repository: https://github.com/shlomif/perl-Module-Format version: '0.62' x_Dist_Zilla: perl: version: '5.032000' plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@Filter/TestMoreDoneTesting' version: '6.015' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Filter/AutoPrereqs' version: '6.015' - class: Dist::Zilla::Plugin::ExecDir name: '@Filter/ExecDir' version: '6.015' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . name: '@Filter/GatherDir' version: '6.015' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Filter/ManifestSkip' version: '6.015' - class: Dist::Zilla::Plugin::MetaYAML name: '@Filter/MetaYAML' version: '6.015' - class: Dist::Zilla::Plugin::PruneCruft name: '@Filter/PruneCruft' version: '6.015' - class: Dist::Zilla::Plugin::Readme name: '@Filter/Readme' version: '6.015' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::ShareDir name: '@Filter/ShareDir' version: '6.015' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/MakeMaker' version: '6.015' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@Filter/CheckChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Filter/ConfirmRelease' version: '6.015' - class: Dist::Zilla::Plugin::Manifest name: '@Filter/Manifest' version: '6.015' - class: Dist::Zilla::Plugin::MetaConfig name: '@Filter/MetaConfig' version: '6.015' - class: Dist::Zilla::Plugin::MetaJSON name: '@Filter/MetaJSON' version: '6.015' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.015' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000037' version: '0.006' name: '@Filter/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::MetaResources name: '@Filter/MetaResources' version: '6.015' - class: Dist::Zilla::Plugin::ModuleBuild config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Filter/ModuleBuild' version: '6.015' - class: Dist::Zilla::Plugin::PkgVersion name: '@Filter/PkgVersion' version: '6.015' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@Filter/PodCoverageTests' version: '6.015' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Filter/PodSyntaxTests' version: '6.015' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: test script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@Filter/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::Test::CPAN::Changes config: Dist::Zilla::Plugin::Test::CPAN::Changes: changelog: Changes name: '@Filter/Test::CPAN::Changes' version: '0.012' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':ExecFiles' - ':InstallModules' - ':TestFiles' trailing_whitespace: 1 name: '@Filter/Test::EOL' version: '0.19' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@Filter/Test::NoTabs' version: '0.15' - class: Dist::Zilla::Plugin::Test::TrailingSpace name: '@Filter/Test::TrailingSpace' version: 0.2.0 - class: Dist::Zilla::Plugin::TestRelease name: '@Filter/TestRelease' version: '6.015' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::SingleEncoding name: '@SHLOMIF/SingleEncoding' version: '4.015' - class: Pod::Weaver::Plugin::WikiDoc name: '@SHLOMIF/WikiDoc' version: '0.093004' - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.015' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Name' version: '4.015' - class: Pod::Weaver::Section::Version name: '@SHLOMIF/Version' version: '4.015' - class: Pod::Weaver::Section::Region name: '@SHLOMIF/Prelude' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Synopsis' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Description' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Usage' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Overview' version: '4.015' - class: Pod::Weaver::Section::Generic name: '@SHLOMIF/Stability' version: '4.015' - class: Pod::Weaver::Section::Collect name: Requirements version: '4.015' - class: Pod::Weaver::Section::Collect name: Attributes version: '4.015' - class: Pod::Weaver::Section::Collect name: Constructors version: '4.015' - class: Pod::Weaver::Section::Collect name: Methods version: '4.015' - class: Pod::Weaver::Section::Collect name: Functions version: '4.015' - class: Pod::Weaver::Section::Leftovers name: '@SHLOMIF/Leftovers' version: '4.015' - class: Pod::Weaver::Section::Region name: '@SHLOMIF/postlude' version: '4.015' - class: Pod::Weaver::Section::Support name: '@SHLOMIF/Support' version: '1.013' - class: Pod::Weaver::Section::Authors name: '@SHLOMIF/Authors' version: '4.015' - class: Pod::Weaver::Section::Bugs name: '@SHLOMIF/Bugs' version: '4.015' - class: Pod::Weaver::Section::Contributors name: '@SHLOMIF/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@SHLOMIF/Legal' version: '4.015' - class: Pod::Weaver::Plugin::Transformer name: '@SHLOMIF/List' version: '4.015' name: '@Filter/PodWeaver' version: '4.008' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Filter/UploadToCPAN' version: '6.015' - class: Dist::Zilla::Plugin::Keywords config: Dist::Zilla::Plugin::Keywords: keywords: - format - formatting - margin - margins - string - text - width name: Keywords version: '0.007' - class: Dist::Zilla::Plugin::Test::TidyAll name: Test::TidyAll version: '0.04' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.015' - class: Dist::Zilla::Plugin::FinderCode name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.015' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.015' x_generated_by_perl: v5.32.0 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' MANIFEST100644000764000764 65213742235532 15313 0ustar00shlomifshlomif000000000000Text-Format-0.62# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.015. Build.PL Changes LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README dist.ini inc/Test/Run/Builder.pm lib/Text/Format.pm t/00-compile.t t/format.t t/justify.t weaver.ini xt/author/eol.t xt/author/no-tabs.t xt/author/pod-coverage.t xt/author/pod-syntax.t xt/author/tidyall.t xt/release/cpan-changes.t xt/release/trailing-space.t Build.PL100644000764000764 231013742235532 15467 0ustar00shlomifshlomif000000000000Text-Format-0.62 # This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.015. use strict; use warnings; use Module::Build 0.28; my %module_build_args = ( "build_requires" => { "Module::Build" => "0.28" }, "configure_requires" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "dist_abstract" => "Various subroutines to format text.", "dist_author" => [ "Shlomi Fish " ], "dist_name" => "Text-Format", "dist_version" => "0.62", "license" => "perl", "module_name" => "Text::Format", "recursive_test_files" => 1, "requires" => { "Carp" => 0, "perl" => "5.006", "strict" => 0, "warnings" => 0 }, "test_requires" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => "0.88" } ); my %fallback_build_requires = ( "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Build" => "0.28", "Test::More" => "0.88" ); unless ( eval { Module::Build->VERSION(0.4004) } ) { delete $module_build_args{test_requires}; $module_build_args{build_requires} = \%fallback_build_requires; } my $build = Module::Build->new(%module_build_args); $build->create_build_script; META.json100644000764000764 4440413742235532 15646 0ustar00shlomifshlomif000000000000Text-Format-0.62{ "abstract" : "Various subroutines to format text.", "author" : [ "Shlomi Fish " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.015, CPAN::Meta::Converter version 2.150010", "keywords" : [ "format", "formatting", "margin", "margins", "string", "text", "width" ], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Text-Format", "prereqs" : { "build" : { "requires" : { "Module::Build" : "0.28" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Module::Build" : "0.28" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.19", "Test::Code::TidyAll" : "0.50", "Test::EOL" : "0", "Test::More" : "0.96", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::TrailingSpace" : "0.0203" } }, "runtime" : { "requires" : { "Carp" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::More" : "0.88" } } }, "provides" : { "Text::Format" : { "file" : "lib/Text/Format.pm", "version" : "0.62" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/shlomif/perl-Module-Format/issues" }, "homepage" : "http://www.shlomifish.org/open-source/projects/Text-Format/", "repository" : { "type" : "git", "url" : "https://github.com/shlomif/perl-Module-Format", "web" : "https://github.com/shlomif/perl-Module-Format" } }, "version" : "0.62", "x_Dist_Zilla" : { "perl" : { "version" : "5.032000" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@Filter/TestMoreDoneTesting", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@Filter/AutoPrereqs", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Filter/ExecDir", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "@Filter/GatherDir", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Filter/ManifestSkip", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Filter/MetaYAML", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Filter/PruneCruft", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@Filter/Readme", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Filter/ShareDir", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/MakeMaker", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@Filter/CheckChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Filter/ConfirmRelease", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Filter/Manifest", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Filter/MetaConfig", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Filter/MetaJSON", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.015" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000037", "version" : "0.006" } }, "name" : "@Filter/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Filter/MetaResources", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::ModuleBuild", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Filter/ModuleBuild", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Filter/PkgVersion", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@Filter/PodCoverageTests", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Filter/PodSyntaxTests", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "test", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@Filter/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", "config" : { "Dist::Zilla::Plugin::Test::CPAN::Changes" : { "changelog" : "Changes" } }, "name" : "@Filter/Test::CPAN::Changes", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":ExecFiles", ":InstallModules", ":TestFiles" ], "trailing_whitespace" : 1 } }, "name" : "@Filter/Test::EOL", "version" : "0.19" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@Filter/Test::NoTabs", "version" : "0.15" }, { "class" : "Dist::Zilla::Plugin::Test::TrailingSpace", "name" : "@Filter/Test::TrailingSpace", "version" : "0.2.0" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Filter/TestRelease", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@SHLOMIF/SingleEncoding", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::WikiDoc", "name" : "@SHLOMIF/WikiDoc", "version" : "0.093004" }, { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Name", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@SHLOMIF/Version", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@SHLOMIF/Prelude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Synopsis", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Description", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Usage", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Overview", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@SHLOMIF/Stability", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Requirements", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Attributes", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Constructors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Methods", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Functions", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@SHLOMIF/Leftovers", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@SHLOMIF/postlude", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Support", "name" : "@SHLOMIF/Support", "version" : "1.013" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@SHLOMIF/Authors", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Bugs", "name" : "@SHLOMIF/Bugs", "version" : "4.015" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@SHLOMIF/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@SHLOMIF/Legal", "version" : "4.015" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@SHLOMIF/List", "version" : "4.015" } ] } }, "name" : "@Filter/PodWeaver", "version" : "4.008" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Filter/UploadToCPAN", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::Keywords", "config" : { "Dist::Zilla::Plugin::Keywords" : { "keywords" : [ "format", "formatting", "margin", "margins", "string", "text", "width" ] } }, "name" : "Keywords", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Test::TidyAll", "name" : "Test::TidyAll", "version" : "0.04" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.015" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.015" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.015" } }, "x_generated_by_perl" : "v5.32.0", "x_serialization_backend" : "Cpanel::JSON::XS version 4.24", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } weaver.ini100644000764000764 1313742235532 16123 0ustar00shlomifshlomif000000000000Text-Format-0.62[@SHLOMIF] t000755000764000764 013742235532 14302 5ustar00shlomifshlomif000000000000Text-Format-0.62format.t100644000764000764 214013742235532 16114 0ustar00shlomifshlomif000000000000Text-Format-0.62/t# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. use strict; use warnings; # Should be 5. use Test::More tests => 5; use Text::Format; # TEST ok( 1, "Text::Format loaded." ); ######################### End of black magic. # Insert your test code below (better if it prints "ok 13" # (correspondingly "not ok 13") depending on the success of chunk 13 # of the test code): { my $text = Text::Format->new; my @results = $text->paragraphs( "hello world", "cool" ); # TEST is( scalar(@results), 2, "2 results." ); @results = $text->format( "hello world", "cool" ); # TEST is( scalar(@results), 1, "formatting as one line." ); @results = $text->center( "hello world", "cool" ); # TEST is( scalar(@results), 2, "center()" ); $text->columns(10); $text->bodyIndent(8); @results = $text->format( "hello world", "cool" ); # TEST is( scalar(@results), 3, "columns and bodyIndent" ); } justify.t100755000764000764 1425713742235532 16360 0ustar00shlomifshlomif000000000000Text-Format-0.62/t#!/usr/bin/perl # H.Merijn Brand, 23 Feb 1998 for PROCURA B.V., Heerhugowaard, The Netherlands # Testing Text::Format for justification only. # Running this script should yield the data after __END__ # This test does not use tabstops, hanging indents or extra indents use strict; use warnings; # Should be 8. use Test::More tests => 8; use Text::Format; # TEST ok( 1, "Loaded" ); # make test uses .../bin/perl # perl t/justify.t generates the part my $text = "gjyfg uergf au eg uyefg uayg uyger uge uvyger uvga erugf uevg ueyrgv " . "uaygerv uygaer uvygaervuy. aureyg aeurgv uayergv uegrv uyagr fuyg uyg" . " ruvyg aeruvg uevrg auygvre ayergv uyaergv uyagre vuyagervuygervuyg a" . "reuvg aervg eryvg revg yregv aregv ergv ugre vgerg aerug areuvg auerg" . " uyrgve uegr vuaguyf gaerfu ageruwf. augawfuygaweufyg rygg auydfg auy" . "efga uywef. auyefg uayergf uyagr yerg uger uweg g uyg uaygref uerg ae" . "gr uagr reg yeg ueg"; my $t = Text::Format->new( { columns => 40, firstIndent => 0 } ); my $test = 2; # TEST ok( !chk_data( fmt_text( 2, $t, 1, 0, 1, $text ) ), "2,1,0,1" ); # TEST ok( !chk_data( fmt_text( 3, $t, 1, 0, 0, $text ) ), "3,1,0,0" ); # TEST ok( !chk_data( fmt_text( 4, $t, 0, 1, 1, $text ) ), "4,0,1,1" ); # TEST ok( !chk_data( fmt_text( 5, $t, 0, 1, 0, $text ) ), "5,0,1,0" ); my @nat = ( "Nederlandse", "Duitse", "Tibetaanse", "Kiribatische", "Kongoleesche", "Burger van Nieuw West-Vlaanderland", "Verweggistaneesche" ); # TEST ok( !chk_data( fmt_natio( 6, $t, 47, 0, 1, @nat ) ), "fmt_natio 6" ); # TEST ok( !chk_data( fmt_natio( 7, $t, 25, 0, 1, @nat ) ), "fmt_natio 7" ); # TEST ok( !chk_data( fmt_natio( 8, $t, 25, 1, 0, @nat ) ), "fmt_natio 8" ); ### ########################################################################### { my @DATA; sub get_data { # get what should be the result of the next test my @data = (); unless (@DATA) { while () { chomp; s/^\s*=\s// && s/\s=$//; push( @DATA, $_ ); } } while ( $DATA[0] =~ m/^#/ ) { shift(@DATA); } until ( $DATA[0] =~ m/^# Test/ ) { push( @data, shift(@DATA) ); } @data; } # get_data } sub chk_data { my @gen = @_; my @dat = get_data(); scalar @gen == scalar @dat || return (1); join( "\n", @gen ) eq join( "\n", @dat ) || return (1); return (0); } sub fmt_text { my ( $tst, $t, $j, $f, $e, $text ) = @_; # $verbose && # print STDERR "# Test $tst: ", # $j ? "JUSTIFY" : "justify", ", ", # $f ? "FILL" : "fill", ", ", # $e ? "EXTRASPACE" : "extraspace", "\n"; $t->config( { justify => $j, extraSpace => $e, rightFill => $f } ); my @lines = split( "\n", $t->format($text) ); # $verbose && # print STDERR "= ", join (" =\n= ", @lines), " =\n"; @lines; } # fmt_text sub fmt_natio { my ( $tst, $t, $c, $j, $f, @nat ) = @_; # $verbose && # print STDERR "# Test $tst: ", # $j ? "JUSTIFY" : "justify", ", ", # $f ? "FILL" : "fill", "\n"; $t->config( { columns => $c, justify => $j, rightFill => $f } ); my @lines = split( "\n", $t->format( join( ", ", @nat ) ) ); # $verbose && # print STDERR "= ", join (" =\n= ", @lines), " =\n"; @lines; } # fmt_natio __END__ # Test 1: Loading Text::Format [Version] # Test 2: JUSTIFY, fill, EXTRASPACE = gjyfg uergf au eg uyefg uayg uyger uge = = uvyger uvga erugf uevg ueyrgv uaygerv = = uygaer uvygaervuy. aureyg aeurgv = = uayergv uegrv uyagr fuyg uyg ruvyg = = aeruvg uevrg auygvre ayergv uyaergv = = uyagre vuyagervuygervuyg areuvg aervg = = eryvg revg yregv aregv ergv ugre vgerg = = aerug areuvg auerg uyrgve uegr vuaguyf = = gaerfu ageruwf. augawfuygaweufyg rygg = = auydfg auyefga uywef. auyefg uayergf = = uyagr yerg uger uweg g uyg uaygref uerg = = aegr uagr reg yeg ueg = # Test 3: JUSTIFY, fill, extraspace = gjyfg uergf au eg uyefg uayg uyger uge = = uvyger uvga erugf uevg ueyrgv uaygerv = = uygaer uvygaervuy. aureyg aeurgv uayergv = = uegrv uyagr fuyg uyg ruvyg aeruvg uevrg = = auygvre ayergv uyaergv uyagre = = vuyagervuygervuyg areuvg aervg eryvg = = revg yregv aregv ergv ugre vgerg aerug = = areuvg auerg uyrgve uegr vuaguyf gaerfu = = ageruwf. augawfuygaweufyg rygg auydfg = = auyefga uywef. auyefg uayergf uyagr yerg = = uger uweg g uyg uaygref uerg aegr uagr = = reg yeg ueg = # Test 4: justify, FILL, EXTRASPACE = gjyfg uergf au eg uyefg uayg uyger uge = = uvyger uvga erugf uevg ueyrgv uaygerv = = uygaer uvygaervuy. aureyg aeurgv = = uayergv uegrv uyagr fuyg uyg ruvyg = = aeruvg uevrg auygvre ayergv uyaergv = = uyagre vuyagervuygervuyg areuvg aervg = = eryvg revg yregv aregv ergv ugre vgerg = = aerug areuvg auerg uyrgve uegr vuaguyf = = gaerfu ageruwf. augawfuygaweufyg rygg = = auydfg auyefga uywef. auyefg uayergf = = uyagr yerg uger uweg g uyg uaygref uerg = = aegr uagr reg yeg ueg = # Test 5: justify, FILL, extraspace = gjyfg uergf au eg uyefg uayg uyger uge = = uvyger uvga erugf uevg ueyrgv uaygerv = = uygaer uvygaervuy. aureyg aeurgv uayergv = = uegrv uyagr fuyg uyg ruvyg aeruvg uevrg = = auygvre ayergv uyaergv uyagre = = vuyagervuygervuyg areuvg aervg eryvg = = revg yregv aregv ergv ugre vgerg aerug = = areuvg auerg uyrgve uegr vuaguyf gaerfu = = ageruwf. augawfuygaweufyg rygg auydfg = = auyefga uywef. auyefg uayergf uyagr yerg = = uger uweg g uyg uaygref uerg aegr uagr = = reg yeg ueg = # Test 6: = Nederlandse, Duitse, Tibetaanse, Kiribatische, = = Kongoleesche, Burger van Nieuw = = West-Vlaanderland, Verweggistaneesche = # Test 7: = Nederlandse, Duitse, = = Tibetaanse, Kiribatische, = = Kongoleesche, Burger van = = Nieuw West-Vlaanderland, = = Verweggistaneesche = # Test 8: = Nederlandse, Duitse, = = Tibetaanse, Kiribatische, = = Kongoleesche, Burger van = = Nieuw West-Vlaanderland, = = Verweggistaneesche = # Test End Makefile.PL100644000764000764 251513742235532 16154 0ustar00shlomifshlomif000000000000Text-Format-0.62# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.015. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Various subroutines to format text.", "AUTHOR" => "Shlomi Fish ", "BUILD_REQUIRES" => { "Module::Build" => "0.28" }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Module::Build" => "0.28" }, "DISTNAME" => "Text-Format", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "Text::Format", "PREREQ_PM" => { "Carp" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => "0.88" }, "VERSION" => "0.62", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Module::Build" => "0.28", "Test::More" => "0.88", "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MANIFEST.SKIP100644000764000764 313742235532 16006 0ustar00shlomifshlomif000000000000Text-Format-0.62~$ 00-compile.t100644000764000764 263413742235532 16501 0ustar00shlomifshlomif000000000000Text-Format-0.62/tuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Text/Format.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: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; author000755000764000764 013742235532 15774 5ustar00shlomifshlomif000000000000Text-Format-0.62/xteol.t100644000764000764 46613742235532 17066 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/Text/Format.pm', 't/00-compile.t', 't/format.t', 't/justify.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; Text000755000764000764 013742235532 15531 5ustar00shlomifshlomif000000000000Text-Format-0.62/libFormat.pm100644000764000764 10000113742235532 17507 0ustar00shlomifshlomif000000000000Text-Format-0.62/lib/Textpackage Text::Format; $Text::Format::VERSION = '0.62'; require 5.006; use strict; use warnings; use Carp; # local abbreviations, you can add your own with abbrevs() my %abbrev = ( Mr => 1, Mrs => 1, Ms => 1, Jr => 1, Sr => 1, ); # formats text into a nice paragraph format. can set a variety of # attributes such as first line indent, body indent, left and right # margin, right align, right fill with spaces, non-breaking spaces, # justification to both margins sub format($@) { my $this = shift; croak "Bad method call" unless ref $this; my @wrap = @_ if @_ > 0; @wrap = @{ $_[0] } if ref $_[0] eq 'ARRAY'; @wrap = @{ $this->{'_text'} } if @wrap < 1; my $findent = ' ' x $this->{'_findent'}; my $bindent = ' ' x $this->{'_bindent'}; my @words = split /\s+/, join ' ', @wrap; shift @words unless defined( $words[0] ) && $words[0] ne ''; #if $words[0] eq ''; @wrap = (); my ( $line, $width, $abbrev ); $abbrev = 0; $width = $this->{'_cols'} - $this->{'_findent'} - $this->{'_lmargin'} - $this->{'_rmargin'}; $line = shift @words; $abbrev = $this->__is_abbrev($line) if defined $line; while ( defined( $_ = shift @words ) ) { if ( length($_) + length($line) < $width - 1 || ( $line !~ /[.?!]['"]?$/ || $abbrev ) && length($_) + length($line) < $width ) { $line .= ' ' if $line =~ /[.?!]['"]?$/ && !$abbrev; $line .= ' ' . $_; } else { last; } $abbrev = $this->__is_abbrev($_); } ( $line, $_ ) = $this->__do_break( $line, $_ ) if $this->{'_nobreak'} && defined $line; push @wrap, $this->__make_line( $line, $findent, $width, defined $_ ) if defined $line; $line = $_; $width = $this->{'_cols'} - $this->{'_bindent'} - $this->{'_lmargin'} - $this->{'_rmargin'}; $abbrev = 0; $abbrev = $this->__is_abbrev($line) if defined $line; while ( defined( $_ = shift @words ) ) { if ( length($_) + length($line) < $width - 1 || ( $line !~ /[.?!]['"]?$/ || $abbrev ) && length($_) + length($line) < $width ) { $line .= ' ' if $line =~ /[.?!]['"]?$/ && !$abbrev; $line .= ' ' . $_; } else { ( $line, $_ ) = $this->__do_break( $line, $_ ) if $this->{'_nobreak'}; push @wrap, $this->__make_line( $line, $bindent, $width, defined $_ ) if defined $line; $line = $_; } $abbrev = $this->__is_abbrev($_) if defined $_; } push @wrap, $this->__make_line( $line, $bindent, $width, 0 ) if defined $line; if ( $this->{'_hindent'} && @wrap > 0 ) { my $caller = ( caller 1 )[3]; $caller = '' unless defined $caller; $this->{'_hindcurr'} = $this->{'_hindtext'}->[0] if defined $this->{'_hindtext'}->[0] && length( $this->{'_hindcurr'} ) < 1 && $caller ne 'Text::Format::paragraphs'; my ($fchar) = $wrap[0] =~ /(\S)/; my $white = index $wrap[0], $fchar; if ( $white - $this->{'_lmargin'} - 1 > length( $this->{'_hindcurr'} ) ) { $white = length( $this->{'_hindcurr'} ) + $this->{'_lmargin'}; $wrap[0] =~ s/^ {$white}/' ' x $this->{'_lmargin'} . $this->{'_hindcurr'}/e; } else { unshift @wrap, ' ' x $this->{'_lmargin'} . $this->{'_hindcurr'} . "\n"; } } wantarray ? @wrap : join '', @wrap; } # format lines in text into paragraphs with each element of @wrap a # paragraph; uses Text::Format->format for the formatting sub paragraphs($@) { my $this = shift; croak "Bad method call" unless ref $this; my @wrap = @_ if @_ > 0; @wrap = @{ $_[0] } if ref $_[0] eq 'ARRAY'; @wrap = @{ $this->{'_text'} } if @wrap < 1; my ( @ret, $end, $cnt, $line ); # if indents are same, use newline between paragraphs if ( $this->{'_findent'} == $this->{'_bindent'} || $this->{'_hindent'} ) { $end = "\n"; } else { $end = ''; } $cnt = 0; for (@wrap) { $this->{'_hindcurr'} = $this->{'_hindtext'}->[$cnt] if $this->{'_hindent'}; $this->{'_hindcurr'} = '' unless defined $this->{'_hindcurr'}; $line = $this->format($_); push @ret, $line . $end if defined $line && length $line > 0; ++$cnt; } chop $ret[$#ret] if defined( $ret[$#ret] ) && $ret[$#ret] =~ /\n\n$/; #if $ret[$#ret] =~ /\n\n$/; wantarray ? @ret : join '', @ret; } # center text using spaces on left side to pad it out # empty lines are preserved sub center($@) { my $this = shift; croak "Bad method call" unless ref $this; my @center = @_ if @_ > 0; @center = @{ $this->{'_text'} } if @center < 1; my ($tabs); my $width = $this->{'_cols'} - $this->{'_lmargin'} - $this->{'_rmargin'}; for (@center) { s/(?:^\s+|\s+$)|\n//g; $tabs = tr/\t//; # count tabs substr( $_, 0, 0 ) = ' ' x int( ( $width - length($_) - $tabs * $this->{'_tabs'} + $tabs ) / 2 ) if length > 0; substr( $_, 0, 0 ) = ' ' x $this->{'_lmargin'} if length > 0; substr( $_, length ) = "\n"; } wantarray ? @center : join '', @center; } # expand tabs to spaces # should be similar to Text::Tabs::expand sub expand($@) { my $this = shift; croak "Bad method call" unless ref $this; my @lines = @_ if @_ > 0; @lines = @{ $this->{'_text'} } if @lines < 1; for (@lines) { s/\t/' ' x $this->{'_tabs'}/eg; } wantarray ? @lines : $lines[0]; } # turn tabstop number of spaces into tabs # should be similar to Text::Tabs::unexpand sub unexpand($@) { my $this = shift; croak "Bad method call" unless ref $this; my @lines = $this->expand(@_); for (@lines) { s/ {$this->{'_tabs'}}/\t/g; } wantarray ? @lines : $lines[0]; } # return a reference to the object, call as $text = Text::Format->new() # can be used to clone the current reference $ntext = $text->new() sub new($@) { my $this = shift; my $ref; if ( ref $_[0] eq 'HASH' ) { $ref = shift; } elsif ( scalar(@_) % 2 == 0 ) { my %ref = @_; $ref = \%ref; } else { $ref = ''; } my %clone = %{$this} if ref $this; my $conf = { _cols => 72, _tabs => 8, _findent => 4, _bindent => 0, _fill => 0, _align => 0, _justify => 0, _lmargin => 0, _rmargin => 0, _space => 0, _abbrs => {}, _text => [], _hindent => 0, _hindtext => [], _hindcurr => '', _nobreak => 0, _nobreakregex => {}, }; if ( ref $ref eq 'HASH' ) { $conf->{'_cols'} = abs int $ref->{'columns'} if defined $ref->{'columns'}; $conf->{'_tabs'} = abs int $ref->{'tabstop'} if defined $ref->{'tabstop'}; $conf->{'_findent'} = abs int $ref->{'firstIndent'} if defined $ref->{'firstIndent'}; $conf->{'_bindent'} = abs int $ref->{'bodyIndent'} if defined $ref->{'bodyIndent'}; $conf->{'_fill'} = abs int $ref->{'rightFill'} if defined $ref->{'rightFill'}; $conf->{'_align'} = abs int $ref->{'rightAlign'} if defined $ref->{'rightAlign'}; $conf->{'_justify'} = abs int $ref->{'justify'} if defined $ref->{'justify'}; $conf->{'_lmargin'} = abs int $ref->{'leftMargin'} if defined $ref->{'leftMargin'}; $conf->{'_rmargin'} = abs int $ref->{'rightMargin'} if defined $ref->{'rightMargin'}; $conf->{'_space'} = abs int $ref->{'extraSpace'} if defined $ref->{'extraSpace'}; $conf->{'_abbrs'} = $ref->{'abbrevs'} if defined $ref->{'abbrevs'} && ref $ref->{'abbrevs'} eq 'HASH'; $conf->{'_text'} = $ref->{'text'} if defined $ref->{'text'} && ref $ref->{'text'} eq 'ARRAY'; $conf->{'_hindent'} = abs int $ref->{'hangingIndent'} if defined $ref->{'hangingIndent'}; $conf->{'_hindtext'} = $ref->{'hangingText'} if defined $ref->{'hangingText'} && ref $ref->{'hangingText'} eq 'ARRAY'; $conf->{'_nobreak'} = abs int $ref->{'noBreak'} if defined $ref->{'noBreak'}; $conf->{'_nobreakregex'} = $ref->{'noBreakRegex'} if defined $ref->{'noBreakRegex'} && ref $ref->{'noBreakRegex'} eq 'HASH'; } ref $this ? bless \%clone, ref $this : bless $conf, $this; } # configure all the attributes of the object # returns the old object prior to configuration sub config($@) { my $this = shift; croak "Bad method call" unless ref $this; my $conf; if ( ref $_[0] eq 'HASH' ) { $conf = shift; } elsif ( scalar(@_) % 2 == 0 ) { my %conf = @_; $conf = \%conf; } else { croak "Bad hash ref"; } my %clone = %{$this}; $this->{'_cols'} = abs int $conf->{'columns'} if defined $conf->{'columns'}; $this->{'_tabs'} = abs int $conf->{'tabstop'} if defined $conf->{'tabstop'}; $this->{'_findent'} = abs int $conf->{'firstIndent'} if defined $conf->{'firstIndent'}; $this->{'_bindent'} = abs int $conf->{'bodyIndent'} if defined $conf->{'bodyIndent'}; $this->{'_fill'} = abs int $conf->{'rightFill'} if defined $conf->{'rightFill'}; $this->{'_align'} = abs int $conf->{'rightAlign'} if defined $conf->{'rightAlign'}; $this->{'_justify'} = abs int $conf->{'justify'} if defined $conf->{'justify'}; $this->{'_lmargin'} = abs int $conf->{'leftMargin'} if defined $conf->{'leftMargin'}; $this->{'_rmargin'} = abs int $conf->{'rightMargin'} if defined $conf->{'rightMargin'}; $this->{'_space'} = abs int $conf->{'extraSpace'} if defined $conf->{'extraSpace'}; $this->{'_abbrs'} = $conf->{'abbrevs'} if defined $conf->{'abbrevs'} && ref $conf->{'abbrevs'} eq 'HASH'; $this->{'_text'} = $conf->{'text'} if defined $conf->{'text'} && ref $conf->{'text'} eq 'ARRAY'; $this->{'_hindent'} = abs int $conf->{'hangingIndent'} if defined $conf->{'hangingIndent'}; $this->{'_hindtext'} = $conf->{'hangingText'} if defined $conf->{'hangingText'} && ref $conf->{'hangingText'} eq 'ARRAY'; $this->{'_nobreak'} = abs int $conf->{'noBreak'} if defined $conf->{'noBreak'}; $this->{'_nobreakregex'} = $conf->{'noBreakRegex'} if defined $conf->{'noBreakRegex'} && ref $conf->{'noBreakRegex'} eq 'HASH'; bless \%clone, ref $this; } sub columns($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_cols'} = abs int shift : $this->{'_cols'}; } sub tabstop($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_tabs'} = abs int shift : $this->{'_tabs'}; } sub firstIndent($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_findent'} = abs int shift : $this->{'_findent'}; } sub bodyIndent($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_bindent'} = abs int shift : $this->{'_bindent'}; } sub rightFill($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_fill'} = abs int shift : $this->{'_fill'}; } sub rightAlign($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_align'} = abs int shift : $this->{'_align'}; } sub justify($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_justify'} = abs int shift : $this->{'_justify'}; } sub leftMargin($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_lmargin'} = abs int shift : $this->{'_lmargin'}; } sub rightMargin($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_rmargin'} = abs int shift : $this->{'_rmargin'}; } sub extraSpace($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_space'} = abs int shift : $this->{'_space'}; } # takes a reference to your hash or takes a list of abbreviations, # returns the INTERNAL abbreviations sub abbrevs($@) { my $this = shift; croak "Bad method call" unless ref $this; if ( ref $_[0] eq 'HASH' ) { $this->{'_abbrs'} = shift; } elsif ( @_ > 0 ) { my %tmp; @tmp{@_} = @_; $this->{'_abbrs'} = \%tmp; } wantarray ? sort keys %abbrev : join ' ', sort keys %abbrev; } sub text($;$) { my $this = shift; croak "Bad method call" unless ref $this; my $text = shift; $this->{'_text'} = $text if ref $text eq 'ARRAY'; wantarray ? @{ $this->{'_text'} } : join ' ', @{ $this->{'_text'} }; } sub hangingIndent($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_hindent'} = abs int shift : $this->{'_hindent'}; } sub hangingText($;$) { my $this = shift; croak "Bad method call" unless ref $this; my $text = shift; $this->{'_hindtext'} = $text if ref $text eq 'ARRAY'; wantarray ? @{ $this->{'_hindtext'} } : join ' ', @{ $this->{'_hindtext'} }; } sub noBreak($;$) { my $this = shift; croak "Bad method call" unless ref $this; @_ ? $this->{'_nobreak'} = abs int shift : $this->{'_nobreak'}; } sub noBreakRegex($;$) { my $this = shift; croak "Bad method call" unless ref $this; my $nobreak = shift; $this->{'_nobreakregex'} = $nobreak if ref $nobreak eq 'HASH'; %{ $this->{'_nobreakregex'} }; } # internal routine, should not be called by an external routine sub __make_line($$$$$) { my $this = shift; croak "Bad method call" unless ref $this; my ( $line, $lead_white, $width, $not_last ) = @_; my $fill = ''; my $lmargin = ' ' x $this->{'_lmargin'}; $fill = ' ' x ( $width - length($line) ) if $this->{'_fill'} && !$this->{'_align'}; if ( $this->{'_justify'} && !( $this->{'_fill'} || $this->{'_align'} ) && defined $line && $line =~ /\S+\s+\S+/ && $not_last ) { my $spaces = $width - length($line); my @words = split /(\s+)/, $line; my $ws = int( $spaces / int( @words / 2 ) ); # for filling all gaps $spaces %= int( @words / 2 ) if $ws > 0; # if we must fill between every single word for ( reverse @words ) { next if /^\S/; substr( $_, 0, 0 ) = ' ' x $ws; $spaces || next; substr( $_, 0, 0 ) = ' '; --$spaces; } $line = join '', @words; } $line = $lmargin . $lead_white . $line . $fill . "\n" if defined $line; substr( $line, 0, 0 ) = ' ' x ( $this->{'_cols'} - $this->{'_rmargin'} - ( length($line) - 1 ) ) if $this->{'_align'} && !$this->{'_fill'} && defined $line; $line; } # internal routine, should not be called by an external routine sub __is_abbrev($$) { my $this = shift; croak "Bad method call" unless ref $this; my $word = shift; $word =~ s/\.$// if defined $word; # remove period if there is one # if we have an abbreviation OR no extra space is wanted after # sentence endings return 1 if !$this->{'_space'} || exists( $abbrev{$word} ) || exists( ${ $this->{'_abbrs'} }{$word} ); 0; } # internal routine, should not be called by an external routine sub __do_break($$$) { my $this = shift; croak "Bad method call" unless ref $this; my ( $line, $next_line ) = @_; my $no_break = 0; my @words = split /\s+/, $line if defined $line; my $last_word = $words[$#words]; for ( keys %{ $this->{'_nobreakregex'} } ) { $no_break = 1 if $last_word =~ m$_ && $next_line =~ m${$this->{'_nobreakregex'}}{$_}; } if ( $no_break && @words > 1 ) { my $i; for ( $i = $#words ; $i > 0 ; --$i ) { $no_break = 0; for ( keys %{ $this->{'_nobreakregex'} } ) { $no_break = 1 if $words[ $i - 1 ] =~ m$_ && $words[$i] =~ m${$this->{'_nobreakregex'}}{$_}; } last if !$no_break; } if ( $i > 0 ) { # found break point $line =~ s/((?:\S+\s+){$i})(.+)/$1/; $next_line = $2 . ' ' . $next_line; $line =~ s/\s+$//; } # else, no breakpoint found and must break here anyways :< } ( $line, $next_line ); } 1; __END__ =pod =encoding UTF-8 =head1 NAME B - Various subroutines to format text. =head1 VERSION version 0.62 =head1 SYNOPSIS use Text::Format; my $text = Text::Format->new ( { text => [], # all columns => 72, # format, paragraphs, center leftMargin => 0, # format, paragraphs, center rightMargin => 0, # format, paragraphs, center firstIndent => 4, # format, paragraphs bodyIndent => 0, # format, paragraphs rightFill => 0, # format, paragraphs rightAlign => 0, # format, paragraphs justify => 0, # format, paragraphs extraSpace => 0, # format, paragraphs abbrevs => {}, # format, paragraphs hangingIndent => 0, # format, paragraphs hangingText => [], # format, paragraphs noBreak => 0, # format, paragraphs noBreakRegex => {}, # format, paragraphs tabstop => 8, # expand, unexpand, center } ); # these are the default values my %abbr = (foo => 1, bar => 1); $text->abbrevs(\%abbr); $text->abbrevs(); $text->abbrevs({foo => 1,bar => 1}); $text->abbrevs(qw/foo bar/); $text->text(\@text); $text->columns(132); $text->tabstop(4); $text->extraSpace(1); $text->firstIndent(8); $text->bodyIndent(4); $text->config({tabstop => 4,firstIndent => 0}); $text->rightFill(0); $text->rightAlign(0); =head1 DESCRIPTION The B routine will format under all circumstances even if the width isn't enough to contain the longest words. I will die under these circumstances, although I am told this is fixed. If columns is set to a small number and words are longer than that and the leading 'whitespace' than there will be a single word on each line. This will let you make a simple word list which could be indented or right aligned. There is a chance for croaking if you try to subvert the module. If you don't pass in text then the internal text is worked on, though not modified. I is meant for more powerful text formatting than what I allows. I also have a module called I that is meant as a direct replacement for I. I requires I since it uses Iformat> to do the actual wrapping but gives you the interface of I. General setup should be explained with the below graph. columns <------------------------------------------------------------> <----------><------><---------------------------><-----------> leftMargin indent text is formatted into here rightMargin indent is firstIndent or bodyIndent depending on where we are in the paragraph. =over 4 =item B @ARRAY || \@ARRAY || [] || NOTHING Allows one to do some advanced formatting of text into a paragraph, with indent for first line and body set separately. Can specify total width of text, right fill with spaces or right align or justify (align to both margins), right margin and left margin, non-breaking space, two spaces at end of sentence, hanging indents (tagged paragraphs). Strips all leading and trailing whitespace before proceeding. Text is first split into words and then reassembled. If no text is passed in then the internal text in the object is formatted. =item B @ARRAY || \@ARRAY || [] || NOTHING Considers each element of text as a paragraph and if the indents are the same for first line and the body then the paragraphs are separated by a single empty line otherwise they follow one under the other. If hanging indent is set then a single empty line will separate each paragraph as well. Calls I to do the actual formatting. If no text is passed in then the internal text in the object is formatted, though not changed. =item B
@ARRAY || NOTHING Centers a list of strings in @ARRAY or internal text. Empty lines appear as, you guessed it, empty lines. Center strips all leading and trailing whitespace before proceeding. Left margin and right margin can be set. If no text is passed in then the internal text in the object is formatted. =item B @ARRAY || NOTHING Expand tabs in the list of text to tabstop number of spaces in @ARRAY or internal text. Doesn't modify the internal text just passes back the modified text. If no text is passed in then the internal text in the object is formatted. =item B @ARRAY || NOTHING Tabstop number of spaces are turned into tabs in @ARRAY or internal text. Doesn't modify the internal text just passes back the modified text. If no text is passed in then the internal text in the object is formatted. =item B \%HASH || NOTHING Instantiates the object. If you pass a reference to a hash, or an anonymous hash then it is used in setting attributes. =item B \%HASH Allows the configuration of all object attributes at once. Returns the object prior to configuration. You can use it to make a clone of your object before you change attributes. =item B NUMBER || NOTHING Set width of text or retrieve width. This is total width and includes indentation and the right and left margins. =item B NUMBER || NOTHING Set tabstop size or retrieve tabstop size, only used by expand, unexpand and center. =item B NUMBER || NOTHING Set or get indent for the first line of paragraph. This is the number of spaces to indent. =item B NUMBER || NOTHING Set or get indent for the body of paragraph. This is the number of spaces to indent. =item B NUMBER || NOTHING Set or get width of left margin. This is the number of spaces used for the margin. =item B NUMBER || NOTHING Set or get width of right margin. This is the number of spaces used for the margin. =item B 0 || 1 || NOTHING Set right fill or retrieve its value. The filling is done with spaces. Keep in mind that if I is also set then both I and I are ignored. =item B 0 || 1 || NOTHING Set right align or retrieve its value. Text is aligned with the right side of the margin. Keep in mind that if I is also set then both I and I are ignored. =item B 0 || 1 || NOTHING Set justify or retrieve its value. Text is aligned with both margins, adding extra spaces as necessary to align text with left and right margins. Keep in mind that if either of I or I are set then I is ignored, even if both are set in which case they are all ignored. =item B \@ARRAY || NOTHING Pass in a reference to your text, or an anonymous array of text that you want the routines to manipulate. Returns the text held in the object. =item B 0 || 1 || NOTHING Use hanging indents in front of a paragraph, returns current value of attribute. This is also called a tagged paragraph. =item B \@ARRAY || NOTHING The text that will be displayed in front of each paragraph, if you call I then only the first element is used, if you call I then I cycles through all of them. If you have more paragraphs than elements in your array than the remainder of the paragraphs will not have a hanging indented text. Pass a reference to your array. This is also called a tagged paragraph. =item B 0 || 1 || NOTHING Set whether you want to use the non-breaking space feature (see B below). =item B \%HASH || NOTHING Pass in a reference to a hash that would hold the regexes on which not to break. In order for this to happen, it requires B to be set to B - see above. Without any arguments, it returns the hash. E.g: {'^Mrs?\.$' => '^\S+$','^\S+$' => '^(?:S|J)r\.$'} don't break names such as Mr. Jones, Mrs. Jones, Jones Jr. The breaking algorithm is simple. If there should not be a break at the current end of sentence, then a backtrack is done till there are two words on which breaking is allowed. If no two such words are found then the end of sentence is broken anyhow. If there is a single word on current line then no backtrack is done and the word is stuck on the end. This is so you can make a list of names for example. B: this feature requires B to be set to true. =item B 0 || 1 || NOTHING Add extra space after end of sentence, normally I would add 1 space after end of sentence, if this is set to 1 then 2 spaces are used. Abbreviations are not followed by two spaces. There are a few internal abbreviations and you can add your own to the object with I =item B \%HASH || @ARRAY || NOTHING Add to the current abbreviations, takes a reference to your hash or an array of abbreviations, if called a second time the original reference is removed and replaced by the new one. Returns the current INTERNAL abbreviations. =back =head1 EXAMPLE use Text::Format; my $text = Text::Format->new; $text->rightFill(1); $text->columns(65); $text->tabstop(4); print $text->format("a line to format to an indented regular paragraph using 65 character wide display"); print $text->paragraphs("paragraph one","paragraph two"); print $text->center("hello world","nifty line 2"); print $text->expand("\t\thello world\n","hmm,\twell\n"); print $text->unexpand(" hello world\n"," hmm"); $text->config({columns => 132, tabstop => 4}); $text = Text::Format->new(); print $text->format(@text); print $text->paragraphs(@text); print $text->center(@text); print $text->format([]); print $text->format([$fh->getlines()]); print $text->paragraphs([]); print $text->expand(@text); print $text->unexpand(@text); $text = Text::Format->new ({tabstop => 4,bodyIndent => 4,text => \@text}); print $text->format(); print $text->paragraphs(); print $text->center(); print $text->expand(); print $text->unexpand(); print Text::Format->new({columns => 95})->format(@text); =head1 BUGS Line length can exceed the number of specified columns if columns is set to a small number and long words plus leading whitespace exceed the specified column length. Actually I see this as a feature since it can be used to make up a nice word list. =head1 LICENSE Copyright (c) 1998 Gabor Egressy. All rights reserved. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. =head1 AUTHOR Gabor Egressy B Copyright (c) 1998 Gabor Egressy. All rights reserved. All wrongs reversed. This program is free software; you can redistribute and/or modify it under the same terms as Perl itself. Adopted and modified by Shlomi Fish, L - all rights disclaimed. =head1 ACKNOWLEDGMENTS B Found a bug with code for two spaces at the end of the sentence and provided a code fragment for a better solution. Also some preliminary suggestions on the design. B Suggestion and explanation of hanging indents, suggestion for non-breaking whitespace, general suggestions with regard to interface design. B Suggestion for better interface design and object design, code for better implementation of getting abbreviations. B Suggestion for a justify feature and original code for doing the justification. I changed the code to take into account the extra space at end of sentence feature. B Inspired a documentation clarification about B required by B , thanks to a report with a problem. =head1 TODO =for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 SUPPORT =head2 Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L =item * CPAN Testers Matrix The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) L git clone https://github.com/shlomif/perl-Module-Format =head1 AUTHOR Shlomi Fish =head1 BUGS Please report any bugs or feature requests on the bugtracker website L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2020 by Gabor Egressy. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut no-tabs.t100644000764000764 43413742235532 17645 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/authoruse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Text/Format.pm', 't/00-compile.t', 't/format.t', 't/justify.t' ); notabs_ok($_) foreach @files; done_testing; tidyall.t100644000764000764 52213742235532 17742 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/author# This file was automatically generated by Dist::Zilla::Plugin::Test::TidyAll v$VERSION use Test::More 0.88; use Test::Code::TidyAll 0.24; tidyall_ok( verbose => ( exists $ENV{TEST_TIDYALL_VERBOSE} ? $ENV{TEST_TIDYALL_VERBOSE} : 0 ), jobs => ( exists $ENV{TEST_TIDYALL_JOBS} ? $ENV{TEST_TIDYALL_JOBS} : 1 ), ); done_testing; pod-syntax.t100644000764000764 25213742235532 20406 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/author#!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(); Run000755000764000764 013742235532 16273 5ustar00shlomifshlomif000000000000Text-Format-0.62/inc/TestBuilder.pm100644000764000764 316713742235532 20366 0ustar00shlomifshlomif000000000000Text-Format-0.62/inc/Test/Runpackage Test::Run::Builder; use strict; use warnings; use Module::Build; use vars qw(@ISA); @ISA = (qw(Module::Build)); sub ACTION_runtest { my ($self) = @_; my $p = $self->{properties}; $self->depends_on('code'); local @INC = @INC; # Make sure we test the module in blib/ unshift @INC, (File::Spec->catdir($p->{base_dir}, $self->blib, 'lib'), File::Spec->catdir($p->{base_dir}, $self->blib, 'arch')); $self->do_test_run_tests; } sub ACTION_distruntest { my ($self) = @_; $self->depends_on('distdir'); my $start_dir = $self->cwd; my $dist_dir = $self->dist_dir; chdir $dist_dir or die "Cannot chdir to $dist_dir: $!"; # XXX could be different names for scripts $self->run_perl_script('Build.PL') # XXX Should this be run w/ --nouse-rcfile or die "Error executing 'Build.PL' in dist directory: $!"; $self->run_perl_script('Build') or die "Error executing 'Build' in dist directory: $!"; $self->run_perl_script('Build', [], ['runtest']) or die "Error executing 'Build test' in dist directory"; chdir $start_dir; } sub do_test_run_tests { my $self = shift; require Test::Run::CmdLine::Iface; my $test_run = Test::Run::CmdLine::Iface->new( { 'test_files' => [glob("t/*.t")], } # 'backend_params' => $self->_get_backend_params(), ); return $test_run->run(); } sub ACTION_tags { return system(qw( ctags -f tags --recurse --totals --exclude=blib/** --exclude=t/lib/** --exclude=.svn --exclude='*~' --languages=Perl --langmap=Perl:+.t )); } 1; pod-coverage.t100644000764000764 33413742235532 20654 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/author#!perl # 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' }); release000755000764000764 013742235532 16112 5ustar00shlomifshlomif000000000000Text-Format-0.62/xtcpan-changes.t100644000764000764 34413742235532 20747 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/releaseuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 use Test::More 0.96 tests => 1; use Test::CPAN::Changes; subtest 'changes_ok' => sub { changes_file_ok('Changes'); }; trailing-space.t100644000764000764 103413742235532 21337 0ustar00shlomifshlomif000000000000Text-Format-0.62/xt/release#!perl use strict; use warnings; use Test::More; eval "use Test::TrailingSpace"; if ($@) { plan skip_all => "Test::TrailingSpace required for trailing space test."; } else { plan tests => 1; } # TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly # some other stuff. my $finder = Test::TrailingSpace->new( { root => '.', filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#, }, ); # TEST $finder->no_trailing_space( "No trailing space was found." );