Config-INI-0.027/000755 000765 000024 00000000000 14064516053 013453 5ustar00rjbsstaff000000 000000 Config-INI-0.027/LICENSE000644 000765 000024 00000043663 14064516053 014474 0ustar00rjbsstaff000000 000000 This software is copyright (c) 2007 by Ricardo Signes. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2007 by Ricardo Signes. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2007 by Ricardo Signes. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Config-INI-0.027/Changes000644 000765 000024 00000006264 14064516053 014756 0ustar00rjbsstaff000000 000000 Changelog for Config-INI 0.027 2021-06-22 22:27:53-04:00 America/New_York - require Mixin::Linewise v0.110 to cope with new error message 0.026 2021-06-20 17:14:32-04:00 America/New_York - update author contact info 0.025 2014-11-16 14:29:37-05:00 America/New_York - run preprocess_line before can_ignore - bump up required Mixin::Linewise to help out Win32 users 0.024 2014-04-05 21:31:54-04:00 America/New_York - MIGHT BREAK YOUR CODE (but probably won't): handle_unparsed_line now receives its arguments in reversed order - new methods exist and more methods now receive the filehandle to make subclassing more flexible 0.023 2014-03-13 10:21:15+01:00 Europe/Paris - specify minimum Mixin::Linewise requirement (thanks, Andreas Koenig and Smylers) 0.022 2014-01-30 16:57:43-05:00 America/New_York - remove the last few places IO::String was used (thanks, Graham Knop) 0.021 2013-10-20 11:33:59 America/New_York - throw an exception if line 1 appears to start with a UTF-8 BOM - typo fixes in docs (thanks, David Steinbrunner!) 0.020 2013-07-01 21:30:50 America/New_York update bugtracker 0.019 2011-12-15 17:03:14 America/New_York provide handle_unparsed_line 0.018 2011-06-02 21:51:50 America/New_York bump up version of IO::File required (thanks, ABH!) 0.017 2010-12-11 10:20:34 America/New_York avoid test failures on Win32 by using . instead of TMPDIR for writing test files (thanks, Ahmad M. Zawawi) 0.016 2010-09-04 add Mixin::Linewise to CARP_NOT -- better reporting of error location 0.015 2010-08-22 documentation improvements (thanks, castaway) 0.014 2009-01-16 add repo to metadata 0.013 2008-06-05 refactored some of the read_* write_* stuff to Mixin::Linewise 0.012 2008-04-12 BUG FIX: allow for different error message on cygwin fixed typo in docs (thanks HDP) 0.011 2007-11-19 BUG FIX: "0" was not a valid section name 0.010 2007-11-04 BUG FIX: detect when we're dumping something we won't be able to read BUG FIX: fix tests when filetest.pm is not available (pre-5.6) (thanks to CPAN tester srezic) DOCS: documentation of core file format in Config::INI 0.009 2007-11-01 add placeholding Config::INI (content soon!) 0.008 2007-10-31 update Module::Install 0.007 2007-08-21 use filetest.pm in tests to avoid -r-related failures on Cygwin 0.006 2007-08-15 use -T instead of -t in tests; -t is a perl 5.008 feature 0.005 2007-08-13 add finalize method, lazy-load starting section method (this means that you can have starting_section die to prevent properties outside of explicity setting) added Config::INI::Writer (largely done by Florian Ragwitz) further improved subclassability of Reader (thanks again, Florian!) 0.004 2007-05-12 fix asinine error in test, poorly adapted from Config::Tiny 0.003 2007-05-10 first release Config-INI-0.027/MANIFEST000644 000765 000024 00000000621 14064516053 014603 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.021. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini examples/simple.ini examples/utf8-bom.ini lib/Config/INI.pm lib/Config/INI/Reader.pm lib/Config/INI/Writer.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/reader-err.t t/reader.t t/writer.t xt/author/pod-syntax.t xt/release/changes_has_content.t Config-INI-0.027/t/000755 000765 000024 00000000000 14064516053 013716 5ustar00rjbsstaff000000 000000 Config-INI-0.027/xt/000755 000765 000024 00000000000 14064516053 014106 5ustar00rjbsstaff000000 000000 Config-INI-0.027/README000644 000765 000024 00000000545 14064516053 014337 0ustar00rjbsstaff000000 000000 This archive contains the distribution Config-INI, version 0.027: simple .ini-file format This software is copyright (c) 2007 by Ricardo Signes. 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.021. Config-INI-0.027/examples/000755 000765 000024 00000000000 14064516053 015271 5ustar00rjbsstaff000000 000000 Config-INI-0.027/META.yml000644 000765 000024 00000027566 14064516053 014744 0ustar00rjbsstaff000000 000000 --- abstract: 'simple .ini-file format' author: - 'Ricardo Signes ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' IO::File: '0' Test::More: '0.96' configure_requires: ExtUtils::MakeMaker: '6.78' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.021, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Config-INI requires: Carp: '0' Mixin::Linewise::Readers: '0.110' Mixin::Linewise::Writers: '0' strict: '0' warnings: '0' resources: bugtracker: https://github.com/rjbs/Config-INI/issues homepage: https://github.com/rjbs/Config-INI repository: https://github.com/rjbs/Config-INI.git version: '0.027' x_Dist_Zilla: perl: version: '5.035001' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: [] exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: '@RJBS/Git::GatherDir' version: '2.047' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@RJBS/CheckPrereqsIndexed' version: '0.021' - class: Dist::Zilla::Plugin::CheckExtraTests name: '@RJBS/CheckExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla::PluginBundle::RJBS phase: build run_under_travis: 0 skip: [] name: '@RJBS/RJBS-Outdated' version: '0.057' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 1 check_all_prereqs: 0 modules: [] phase: release run_under_travis: 0 skip: - Dist::Zilla::Plugin::RJBSMisc name: '@RJBS/CPAN-Outdated' version: '0.057' - class: Dist::Zilla::Plugin::PruneCruft name: '@RJBS/@Filter/PruneCruft' version: '6.021' - class: Dist::Zilla::Plugin::ManifestSkip name: '@RJBS/@Filter/ManifestSkip' version: '6.021' - class: Dist::Zilla::Plugin::MetaYAML name: '@RJBS/@Filter/MetaYAML' version: '6.021' - class: Dist::Zilla::Plugin::License name: '@RJBS/@Filter/License' version: '6.021' - class: Dist::Zilla::Plugin::Readme name: '@RJBS/@Filter/Readme' version: '6.021' - class: Dist::Zilla::Plugin::ExecDir name: '@RJBS/@Filter/ExecDir' version: '6.021' - class: Dist::Zilla::Plugin::ShareDir name: '@RJBS/@Filter/ShareDir' version: '6.021' - class: Dist::Zilla::Plugin::Manifest name: '@RJBS/@Filter/Manifest' version: '6.021' - class: Dist::Zilla::Plugin::TestRelease name: '@RJBS/@Filter/TestRelease' version: '6.021' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RJBS/@Filter/ConfirmRelease' version: '6.021' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RJBS/@Filter/UploadToCPAN' version: '6.021' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 9 name: '@RJBS/MakeMaker' version: '6.021' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RJBS/AutoPrereqs' version: '6.021' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: 1 version_regexp: (?^:^([0-9]+\.[0-9]+)$) Dist::Zilla::Role::Git::Repo: git_version: '2.30.1 (Apple Git-130)' repo_root: . name: '@RJBS/Git::NextVersion' version: '2.047' - class: Dist::Zilla::Plugin::PkgVersion name: '@RJBS/PkgVersion' version: '6.021' - class: Dist::Zilla::Plugin::MetaConfig name: '@RJBS/MetaConfig' version: '6.021' - class: Dist::Zilla::Plugin::MetaJSON name: '@RJBS/MetaJSON' version: '6.021' - class: Dist::Zilla::Plugin::NextRelease name: '@RJBS/NextRelease' version: '6.021' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: '@RJBS/Test::ChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RJBS/PodSyntaxTests' version: '6.021' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@RJBS/Test::ReportPrereqs' version: '0.028' - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@RJBS/TestMoreWithSubtests' version: '6.021' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@RJBS' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.018' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.018' - class: Pod::Weaver::Plugin::SingleEncoding name: '@RJBS/SingleEncoding' version: '4.018' - class: Pod::Weaver::Section::Name name: '@RJBS/Name' version: '4.018' - class: Pod::Weaver::Section::Version name: '@RJBS/Version' version: '4.018' - class: Pod::Weaver::Section::Region name: '@RJBS/Prelude' version: '4.018' - class: Pod::Weaver::Section::Generic name: '@RJBS/Synopsis' version: '4.018' - class: Pod::Weaver::Section::Generic name: '@RJBS/Description' version: '4.018' - class: Pod::Weaver::Section::Generic name: '@RJBS/Overview' version: '4.018' - class: Pod::Weaver::Section::Generic name: '@RJBS/Stability' version: '4.018' - class: Pod::Weaver::Section::GenerateSection name: '@RJBS/PerlSupport' version: '4.018' - class: Pod::Weaver::Section::Collect name: Attributes version: '4.018' - class: Pod::Weaver::Section::Collect name: Methods version: '4.018' - class: Pod::Weaver::Section::Collect name: Functions version: '4.018' - class: Pod::Weaver::Section::Leftovers name: '@RJBS/Leftovers' version: '4.018' - class: Pod::Weaver::Section::Region name: '@RJBS/postlude' version: '4.018' - class: Pod::Weaver::Section::Authors name: '@RJBS/Authors' version: '4.018' - class: Pod::Weaver::Section::Contributors name: '@RJBS/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@RJBS/Legal' version: '4.018' - class: Pod::Weaver::Plugin::Transformer name: '@RJBS/List' version: '4.018' name: '@RJBS/PodWeaver' version: '4.009' - class: Dist::Zilla::Plugin::RJBSMisc name: '@RJBS/RJBSMisc' version: '5.019' - class: Dist::Zilla::Plugin::GithubMeta name: '@RJBS/GithubMeta' version: '0.58' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: '2.30.1 (Apple Git-130)' repo_root: . name: '@RJBS/@Git/Check' version: '2.047' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c signoff: '0' Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: '2.30.1 (Apple Git-130)' repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Commit' version: '2.047' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: '0.027' tag_format: '%v' tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: '2.30.1 (Apple Git-130)' repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Tag' version: '2.047' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - 'github :' remotes_must_exist: 0 Dist::Zilla::Role::Git::Repo: git_version: '2.30.1 (Apple Git-130)' repo_root: . name: '@RJBS/@Git/Push' version: '2.047' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: '2.30.1 (Apple Git-130)' include_authors: 0 include_releaser: 1 order_by: name paths: [] name: '@RJBS/Git::Contributors' version: '0.036' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.021' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.021' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.021' x_contributors: - 'castaway ' - 'David Steinbrunner ' - 'Florian Ragwitz ' - 'George Hartzell ' - 'Graham Knop ' - 'Ricardo SIGNES ' - 'Smylers ' x_generated_by_perl: v5.35.1 x_rjbs_perl_support: long-term x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Config-INI-0.027/lib/000755 000765 000024 00000000000 14064516053 014221 5ustar00rjbsstaff000000 000000 Config-INI-0.027/Makefile.PL000644 000765 000024 00000002532 14064516053 015427 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.021. use strict; use warnings; use ExtUtils::MakeMaker 6.78; my %WriteMakefileArgs = ( "ABSTRACT" => "simple .ini-file format", "AUTHOR" => "Ricardo Signes ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.78" }, "DISTNAME" => "Config-INI", "LICENSE" => "perl", "NAME" => "Config::INI", "PREREQ_PM" => { "Carp" => 0, "Mixin::Linewise::Readers" => "0.110", "Mixin::Linewise::Writers" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IO::File" => 0, "Test::More" => "0.96" }, "VERSION" => "0.027", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Carp" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IO::File" => 0, "Mixin::Linewise::Readers" => "0.110", "Mixin::Linewise::Writers" => 0, "Test::More" => "0.96", "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); Config-INI-0.027/META.json000644 000765 000024 00000044700 14064516053 015101 0ustar00rjbsstaff000000 000000 { "abstract" : "simple .ini-file format", "author" : [ "Ricardo Signes " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.021, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Config-INI", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.78" } }, "develop" : { "requires" : { "Encode" : "0", "Test::More" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Carp" : "0", "Mixin::Linewise::Readers" : "0.110", "Mixin::Linewise::Writers" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "IO::File" : "0", "Test::More" : "0.96" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/rjbs/Config-INI/issues" }, "homepage" : "https://github.com/rjbs/Config-INI", "repository" : { "type" : "git", "url" : "https://github.com/rjbs/Config-INI.git", "web" : "https://github.com/rjbs/Config-INI" } }, "version" : "0.027", "x_Dist_Zilla" : { "perl" : { "version" : "5.035001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "@RJBS/Git::GatherDir", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@RJBS/CheckPrereqsIndexed", "version" : "0.021" }, { "class" : "Dist::Zilla::Plugin::CheckExtraTests", "name" : "@RJBS/CheckExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla::PluginBundle::RJBS" ], "phase" : "build", "run_under_travis" : 0, "skip" : [] } }, "name" : "@RJBS/RJBS-Outdated", "version" : "0.057" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 1, "check_all_prereqs" : 0, "modules" : [], "phase" : "release", "run_under_travis" : 0, "skip" : [ "Dist::Zilla::Plugin::RJBSMisc" ] } }, "name" : "@RJBS/CPAN-Outdated", "version" : "0.057" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@RJBS/@Filter/PruneCruft", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@RJBS/@Filter/ManifestSkip", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RJBS/@Filter/MetaYAML", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RJBS/@Filter/License", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@RJBS/@Filter/Readme", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RJBS/@Filter/ExecDir", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RJBS/@Filter/ShareDir", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RJBS/@Filter/Manifest", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RJBS/@Filter/TestRelease", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RJBS/@Filter/ConfirmRelease", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RJBS/@Filter/UploadToCPAN", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 9 } }, "name" : "@RJBS/MakeMaker", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RJBS/AutoPrereqs", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : 1, "version_regexp" : "(?^:^([0-9]+\\.[0-9]+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.30.1 (Apple Git-130)", "repo_root" : "." } }, "name" : "@RJBS/Git::NextVersion", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@RJBS/PkgVersion", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RJBS/MetaConfig", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RJBS/MetaJSON", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RJBS/NextRelease", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "@RJBS/Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RJBS/PodSyntaxTests", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@RJBS/Test::ReportPrereqs", "version" : "0.028" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@RJBS/TestMoreWithSubtests", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@RJBS" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@RJBS/SingleEncoding", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@RJBS/Name", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@RJBS/Version", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/Prelude", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Synopsis", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Description", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Overview", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@RJBS/Stability", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::GenerateSection", "name" : "@RJBS/PerlSupport", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Attributes", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Methods", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "Functions", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@RJBS/Leftovers", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RJBS/postlude", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@RJBS/Authors", "version" : "4.018" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@RJBS/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@RJBS/Legal", "version" : "4.018" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@RJBS/List", "version" : "4.018" } ] } }, "name" : "@RJBS/PodWeaver", "version" : "4.009" }, { "class" : "Dist::Zilla::Plugin::RJBSMisc", "name" : "@RJBS/RJBSMisc", "version" : "5.019" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@RJBS/GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.30.1 (Apple Git-130)", "repo_root" : "." } }, "name" : "@RJBS/@Git/Check", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c", "signoff" : 0 }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.30.1 (Apple Git-130)", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Commit", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "0.027", "tag_format" : "%v", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.30.1 (Apple Git-130)", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Tag", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "github :" ], "remotes_must_exist" : 0 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.30.1 (Apple Git-130)", "repo_root" : "." } }, "name" : "@RJBS/@Git/Push", "version" : "2.047" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.30.1 (Apple Git-130)", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "@RJBS/Git::Contributors", "version" : "0.036" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.021" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.021" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.021" } }, "x_contributors" : [ "castaway ", "David Steinbrunner ", "Florian Ragwitz ", "George Hartzell ", "Graham Knop ", "Ricardo SIGNES ", "Smylers " ], "x_generated_by_perl" : "v5.35.1", "x_rjbs_perl_support" : "long-term", "x_serialization_backend" : "Cpanel::JSON::XS version 4.26", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Config-INI-0.027/dist.ini000644 000765 000024 00000000362 14064516053 015120 0ustar00rjbsstaff000000 000000 name = Config-INI author = Ricardo Signes license = Perl_5 copyright_holder = Ricardo Signes copyright_year = 2007 [@RJBS] perl-support = long-term package-name-version = 0 ; I believe this should be turned on. Config-INI-0.027/lib/Config/000755 000765 000024 00000000000 14064516053 015426 5ustar00rjbsstaff000000 000000 Config-INI-0.027/lib/Config/INI/000755 000765 000024 00000000000 14064516053 016045 5ustar00rjbsstaff000000 000000 Config-INI-0.027/lib/Config/INI.pm000644 000765 000024 00000016100 14064516053 016401 0ustar00rjbsstaff000000 000000 use strict; use warnings; package Config::INI; # ABSTRACT: simple .ini-file format $Config::INI::VERSION = '0.027'; #pod =head1 SYNOPSIS #pod #pod Config-INI comes with code for reading F<.ini> files: #pod #pod my $config_hash = Config::INI::Reader->read_file('config.ini'); #pod #pod ...and for writing C<.ini> files: #pod #pod Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini'); #pod #pod See L and L for more examples. #pod #pod =head1 GRAMMAR #pod #pod This section describes the format parsed and produced by Config::INI::Reader #pod and ::Writer. It is not an exhaustive and rigorously tested formal grammar, #pod it's just a description of this particular implementation of the #pod not-quite-standardized "INI" format. #pod #pod ini-file = {
| } #pod #pod empty-line = [ ] #pod #pod section = { | } #pod #pod section-header = [ ] "[" "]" [ ] #pod section-name = string #pod #pod value-assignment = [ ] [ ] #pod "=" #pod [ ] [ ] #pod #pod property-name = string-without-equals #pod value = string #pod #pod comment = ";" [ ] #pod line-ending = [ ] #pod #pod space = ( | " " ) * #pod string-without-equals = string - "=" #pod string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ? #pod #pod Of special note is the fact that I escaping mechanism is defined, meaning #pod that there is no way to include an EOL or semicolon (for example) in a value, #pod property name, or section name. If you need this, either subclass, wait for a #pod subclass to be written for you, or find one of the many other INI-style parsers #pod on the CPAN. #pod #pod The order of sections and value assignments within a section are not #pod significant, except that given multiple assignments to one property name within #pod a section, only the final one is used. A section name may be used more than #pod once; this will have the identical meaning as having all property assignments #pod in all sections of that name in sequence. #pod #pod =head1 DON'T FORGET #pod #pod The definitions above refer to the format used by the Reader and Writer classes #pod bundled in the Config-INI distribution. These classes are designed for easy #pod subclassing, so it should be easy to replace their behavior with whatever #pod behavior your want. #pod #pod Patches, feature requests, and bug reports are welcome -- but I'm more #pod interested in making sure you can write a subclass that does what you need, and #pod less in making Config-INI do what you want directly. #pod #pod =head1 THANKS #pod #pod Thanks to Florian Ragwitz for improving the subclassability of Config-INI's #pod modules, and for helping me do some of my first merging with git(7). #pod #pod =head1 ORIGIN #pod #pod Originaly derived from L, by Adam Kennedy. #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::INI - simple .ini-file format =head1 VERSION version 0.027 =head1 SYNOPSIS Config-INI comes with code for reading F<.ini> files: my $config_hash = Config::INI::Reader->read_file('config.ini'); ...and for writing C<.ini> files: Config::INI::Writer->write_file({ somekey => 'somevalue' }, 'config.ini'); See L and L for more examples. =head1 PERL VERSION SUPPORT This module has a long-term perl support period. That means it will not require a version of perl released fewer than five years ago. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 GRAMMAR This section describes the format parsed and produced by Config::INI::Reader and ::Writer. It is not an exhaustive and rigorously tested formal grammar, it's just a description of this particular implementation of the not-quite-standardized "INI" format. ini-file = {
| } empty-line = [ ] section = { | } section-header = [ ] "[" "]" [ ] section-name = string value-assignment = [ ] [ ] "=" [ ] [ ] property-name = string-without-equals value = string comment = ";" [ ] line-ending = [ ] space = ( | " " ) * string-without-equals = string - "=" string = ? 1+ characters; not ";" or EOL; begins and ends with non-space ? Of special note is the fact that I escaping mechanism is defined, meaning that there is no way to include an EOL or semicolon (for example) in a value, property name, or section name. If you need this, either subclass, wait for a subclass to be written for you, or find one of the many other INI-style parsers on the CPAN. The order of sections and value assignments within a section are not significant, except that given multiple assignments to one property name within a section, only the final one is used. A section name may be used more than once; this will have the identical meaning as having all property assignments in all sections of that name in sequence. =head1 DON'T FORGET The definitions above refer to the format used by the Reader and Writer classes bundled in the Config-INI distribution. These classes are designed for easy subclassing, so it should be easy to replace their behavior with whatever behavior your want. Patches, feature requests, and bug reports are welcome -- but I'm more interested in making sure you can write a subclass that does what you need, and less in making Config-INI do what you want directly. =head1 THANKS Thanks to Florian Ragwitz for improving the subclassability of Config-INI's modules, and for helping me do some of my first merging with git(7). =head1 ORIGIN Originaly derived from L, by Adam Kennedy. =head1 AUTHOR Ricardo Signes =head1 CONTRIBUTORS =for stopwords castaway David Steinbrunner Florian Ragwitz George Hartzell Graham Knop Ricardo SIGNES Smylers =over 4 =item * castaway =item * David Steinbrunner =item * Florian Ragwitz =item * George Hartzell =item * Graham Knop =item * Ricardo SIGNES =item * Smylers =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2007 by Ricardo Signes. 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 Config-INI-0.027/lib/Config/INI/Reader.pm000644 000765 000024 00000033033 14064516053 017607 0ustar00rjbsstaff000000 000000 use strict; use warnings; package Config::INI::Reader; $Config::INI::Reader::VERSION = '0.027'; use Mixin::Linewise::Readers 0.110; # ABSTRACT: a subclassable .ini-file parser #pod =head1 SYNOPSIS #pod #pod If F contains: #pod #pod admin = rjbs #pod #pod [rjbs] #pod awesome = yes #pod height = 5' 10" #pod #pod [mj] #pod awesome = totally #pod height = 23" #pod #pod Then when your program contains: #pod #pod my $hash = Config::INI::Reader->read_file('family.ini'); #pod #pod C<$hash> will contain: #pod #pod { #pod '_' => { admin => 'rjbs' }, #pod rjbs => { #pod awesome => 'yes', #pod height => q{5' 10"}, #pod }, #pod mj => { #pod awesome => 'totally', #pod height => '23"', #pod }, #pod } #pod #pod =head1 DESCRIPTION #pod #pod Config::INI::Reader is I config module implementing I #pod slightly different take on the undeniably easy to read L<".ini" file #pod format|Config::INI>. Its default behavior is quite similar to that of #pod L, on which it is based. #pod #pod The chief difference is that Config::INI::Reader is designed to be subclassed #pod to allow for side-effects and self-reconfiguration to occur during the course #pod of reading its input. #pod #pod =cut use Carp (); our @CARP_NOT = qw(Mixin::Linewise::Readers); #pod =head1 METHODS FOR READING CONFIG #pod #pod These methods are all that most users will need: they read configuration from a #pod source of input, then they return the data extracted from that input. There #pod are three reader methods, C, C, and C. #pod The first two are implemented in terms of the third. It iterates over lines in #pod a file, calling methods on the reader when events occur. Those events are #pod detailed below in the L section. #pod #pod All of the reader methods return an unblessed reference to a hash. #pod #pod All throw an exception when they encounter an error. #pod #pod =head2 read_file #pod #pod my $hash_ref = Config::INI::Reader->read_file($filename); #pod #pod Given a filename, this method returns a hashref of the contents of that file. #pod #pod =head2 read_string #pod #pod my $hash_ref = Config::INI::Reader->read_string($string); #pod #pod Given a string, this method returns a hashref of the contents of that string. #pod #pod =head2 read_handle #pod #pod my $hash_ref = Config::INI::Reader->read_handle($io_handle); #pod #pod Given an IO::Handle, this method returns a hashref of the contents of that #pod handle. #pod #pod =cut sub read_handle { my ($invocant, $handle) = @_; my $self = ref $invocant ? $invocant : $invocant->new; # parse the file LINE: while (my $line = $handle->getline) { if ($handle->input_line_number == 1 && $line =~ /\A\x{FEFF}/) { Carp::confess("input handle appears to start with a BOM"); } $self->preprocess_line(\$line); next LINE if $self->can_ignore($line, $handle); # Handle section headers if (defined (my $name = $self->parse_section_header($line, $handle))) { # Create the sub-hash if it doesn't exist. # Without this sections without keys will not # appear at all in the completed struct. $self->change_section($name); next LINE; } if (my ($name, $value) = $self->parse_value_assignment($line, $handle)) { $self->set_value($name, $value); next LINE; } $self->handle_unparsed_line($line, $handle); } $self->finalize; return $self->{data}; } #pod =head1 METHODS FOR SUBCLASSING #pod #pod These are the methods you need to understand and possibly change when #pod subclassing Config::INI::Reader to handle a different format of input. #pod #pod =head2 current_section #pod #pod my $section_name = $reader->current_section; #pod #pod This method returns the name of the current section. If no section has yet #pod been set, it returns the result of calling the C method. #pod #pod =cut sub current_section { defined $_[0]->{section} ? $_[0]->{section} : $_[0]->starting_section; } #pod =head2 parse_section_header #pod #pod my $name = $reader->parse_section_header($line, $handle); #pod #pod Given a line of input, this method decides whether the line is a section-change #pod declaration. If it is, it returns the name of the section to which to change. #pod If the line is not a section-change, the method returns false. #pod #pod =cut sub parse_section_header { return $1 if $_[1] =~ /^\s*\[\s*(.+?)\s*\]\s*$/; return; } #pod =head2 change_section #pod #pod $reader->change_section($section_name); #pod #pod This method is called whenever a section change occurs in the file. #pod #pod The default implementation is to change the current section into which data is #pod being read and to initialize that section to an empty hashref. #pod #pod =cut sub change_section { my ($self, $section) = @_; $self->{section} = $section; if (!exists $self->{data}{$section}) { $self->{data}{$section} = {}; } } #pod =head2 parse_value_assignment #pod #pod my ($name, $value) = $reader->parse_value_assignment($line, $handle); #pod #pod Given a line of input, this method decides whether the line is a property #pod value assignment. If it is, it returns the name of the property and the value #pod being assigned to it. If the line is not a property assignment, the method #pod returns false. #pod #pod =cut sub parse_value_assignment { return ($1, $2) if $_[1] =~ /^\s*([^=\s\pC][^=\pC]*?)\s*=\s*(.*?)\s*$/; return; } #pod =head2 set_value #pod #pod $reader->set_value($name, $value); #pod #pod This method is called whenever an assignment occurs in the file. The default #pod behavior is to change the value of the named property to the given value. #pod #pod =cut sub set_value { my ($self, $name, $value) = @_; $self->{data}{ $self->current_section }{$name} = $value; } #pod =head2 starting_section #pod #pod my $section = Config::INI::Reader->starting_section; #pod #pod This method returns the name of the starting section. The default is: C<_> #pod #pod =cut sub starting_section { q{_} } #pod =head2 can_ignore #pod #pod do_nothing if $reader->can_ignore($line, $handle) #pod #pod This method returns true if the given line of input is safe to ignore. The #pod default implementation ignores lines that contain only whitespace or comments. #pod #pod This is run I L. #pod #pod =cut sub can_ignore { my ($self, $line, $handle) = @_; # Skip comments and empty lines return $line =~ /\A\s*(?:;|$)/ ? 1 : 0; } #pod =head2 preprocess_line #pod #pod $reader->preprocess_line(\$line); #pod #pod This method is called to preprocess each line after it's read but before it's #pod parsed. The default implementation just strips inline comments. Alterations #pod to the line are made in place. #pod #pod =cut sub preprocess_line { my ($self, $line) = @_; # Remove inline comments ${$line} =~ s/\s+;.*$//g; } #pod =head2 handle_unparsed_line #pod #pod $reader->handle_unparsed_line( $line, $handle ); #pod #pod This method is called when the reader encounters a line that doesn't look like #pod anything it recognizes. By default, it throws an exception. #pod #pod =cut sub handle_unparsed_line { my ($self, $line, $handle) = @_; my $lineno = $handle->input_line_number; Carp::croak "Syntax error at line $lineno: '$line'"; } #pod =head2 finalize #pod #pod $reader->finalize; #pod #pod This method is called when the reader has finished reading in every line of the #pod file. #pod #pod =cut sub finalize { } #pod =head2 new #pod #pod my $reader = Config::INI::Reader->new; #pod #pod This method returns a new reader. This generally does not need to be called by #pod anything but the various C methods, which create a reader object only #pod ephemerally. #pod #pod =cut sub new { my ($class) = @_; my $self = { data => {}, }; bless $self => $class; } #pod =head1 ORIGIN #pod #pod Originaly derived from L, by Adam Kennedy. #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::INI::Reader - a subclassable .ini-file parser =head1 VERSION version 0.027 =head1 SYNOPSIS If F contains: admin = rjbs [rjbs] awesome = yes height = 5' 10" [mj] awesome = totally height = 23" Then when your program contains: my $hash = Config::INI::Reader->read_file('family.ini'); C<$hash> will contain: { '_' => { admin => 'rjbs' }, rjbs => { awesome => 'yes', height => q{5' 10"}, }, mj => { awesome => 'totally', height => '23"', }, } =head1 DESCRIPTION Config::INI::Reader is I config module implementing I slightly different take on the undeniably easy to read L<".ini" file format|Config::INI>. Its default behavior is quite similar to that of L, on which it is based. The chief difference is that Config::INI::Reader is designed to be subclassed to allow for side-effects and self-reconfiguration to occur during the course of reading its input. =head1 PERL VERSION SUPPORT This module has a long-term perl support period. That means it will not require a version of perl released fewer than five years ago. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 METHODS FOR READING CONFIG These methods are all that most users will need: they read configuration from a source of input, then they return the data extracted from that input. There are three reader methods, C, C, and C. The first two are implemented in terms of the third. It iterates over lines in a file, calling methods on the reader when events occur. Those events are detailed below in the L section. All of the reader methods return an unblessed reference to a hash. All throw an exception when they encounter an error. =head2 read_file my $hash_ref = Config::INI::Reader->read_file($filename); Given a filename, this method returns a hashref of the contents of that file. =head2 read_string my $hash_ref = Config::INI::Reader->read_string($string); Given a string, this method returns a hashref of the contents of that string. =head2 read_handle my $hash_ref = Config::INI::Reader->read_handle($io_handle); Given an IO::Handle, this method returns a hashref of the contents of that handle. =head1 METHODS FOR SUBCLASSING These are the methods you need to understand and possibly change when subclassing Config::INI::Reader to handle a different format of input. =head2 current_section my $section_name = $reader->current_section; This method returns the name of the current section. If no section has yet been set, it returns the result of calling the C method. =head2 parse_section_header my $name = $reader->parse_section_header($line, $handle); Given a line of input, this method decides whether the line is a section-change declaration. If it is, it returns the name of the section to which to change. If the line is not a section-change, the method returns false. =head2 change_section $reader->change_section($section_name); This method is called whenever a section change occurs in the file. The default implementation is to change the current section into which data is being read and to initialize that section to an empty hashref. =head2 parse_value_assignment my ($name, $value) = $reader->parse_value_assignment($line, $handle); Given a line of input, this method decides whether the line is a property value assignment. If it is, it returns the name of the property and the value being assigned to it. If the line is not a property assignment, the method returns false. =head2 set_value $reader->set_value($name, $value); This method is called whenever an assignment occurs in the file. The default behavior is to change the value of the named property to the given value. =head2 starting_section my $section = Config::INI::Reader->starting_section; This method returns the name of the starting section. The default is: C<_> =head2 can_ignore do_nothing if $reader->can_ignore($line, $handle) This method returns true if the given line of input is safe to ignore. The default implementation ignores lines that contain only whitespace or comments. This is run I L. =head2 preprocess_line $reader->preprocess_line(\$line); This method is called to preprocess each line after it's read but before it's parsed. The default implementation just strips inline comments. Alterations to the line are made in place. =head2 handle_unparsed_line $reader->handle_unparsed_line( $line, $handle ); This method is called when the reader encounters a line that doesn't look like anything it recognizes. By default, it throws an exception. =head2 finalize $reader->finalize; This method is called when the reader has finished reading in every line of the file. =head2 new my $reader = Config::INI::Reader->new; This method returns a new reader. This generally does not need to be called by anything but the various C methods, which create a reader object only ephemerally. =head1 ORIGIN Originaly derived from L, by Adam Kennedy. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2007 by Ricardo Signes. 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 Config-INI-0.027/lib/Config/INI/Writer.pm000644 000765 000024 00000052212 14064516053 017661 0ustar00rjbsstaff000000 000000 use strict; use warnings; package Config::INI::Writer; $Config::INI::Writer::VERSION = '0.027'; use Mixin::Linewise::Writers; # ABSTRACT: a subclassable .ini-file emitter use Carp (); our @CARP_NOT = qw(Mixin::Linewise::Writers); #pod =head1 SYNOPSIS #pod #pod If <$hash> contains: #pod #pod { #pod '_' => { admin => 'rjbs' }, #pod rjbs => { #pod awesome => 'yes', #pod height => q{5' 10"}, #pod }, #pod mj => { #pod awesome => 'totally', #pod height => '23"', #pod }, #pod } #pod #pod Then when your program contains: #pod #pod Config::INI::Writer->write_file($hash, 'family.ini'); #pod #pod F will contains: #pod #pod admin = rjbs #pod #pod [rjbs] #pod awesome = yes #pod height = 5' 10" #pod #pod [mj] #pod awesome = totally #pod height = 23" #pod #pod =head1 DESCRIPTION #pod #pod Config::INI::Writer is I config module implementing I #pod slightly different take on the undeniably easy to read L<".ini" file #pod format|Config::INI>. Its default behavior is quite similar to that of #pod L, on which it is based. #pod #pod The chief difference is that Config::INI::Writer is designed to be subclassed #pod to allow for side-effects and self-reconfiguration to occur during the course #pod of reading its input. #pod #pod =head1 METHODS FOR WRITING CONFIG #pod #pod There are three writer methods, C, C, and #pod C. The first two are implemented in terms of the third. It #pod iterates over a collection of data, emitting lines to the filehandle as it #pod goes. The lines are generated by events produced by iterating over the data. #pod Those events are detailed below in the L section. #pod #pod The given data should be a hashref of hashrefs: #pod #pod { #pod section_name_1 => { prop1 => 'value1', prop2 => 'value2' }, #pod section_name_2 => ... #pod } #pod #pod ...or an arrayref of section name and arrayref pairs: #pod #pod [ #pod section_name_1 => [ prop1 => 'value1', prop2 => 'value2' ], #pod section_name_2 => ... #pod ] #pod #pod ...or a combination of those: #pod #pod [ #pod section_name_1 => { prop1 => 'value1', prop2 => 'value2' }, #pod section_name_2 => [ prop3 => 'value3', prop4 => 'value4' ], #pod section_name_3 => ... #pod ] #pod #pod #pod All the reader methods throw an exception when they encounter an error. #pod #pod =head2 write_file #pod #pod Config::INI::Writer->write_file($input, $filename); #pod #pod This method writes out the configuration represented by C<$data> to the file #pod named by C<$filename>. If a file by that name exists, it is overwritten. #pod #pod This method will either succeed or raise an exception. (Its return value is #pod not defined.) #pod #pod =head2 write_string #pod #pod my $string = Config::INI::Writer->write_string($input); #pod #pod This method returns a string containing the INI content describing the given #pod data. #pod #pod =head2 write_handle #pod #pod Config::INI::Writer->write_handle($input, $handle); #pod #pod This method writes the data in C<$data> to the IO::Handle-like object in #pod C<$handle>. This method should either succeed or throw an exception. #pod #pod =cut sub write_handle { my ($invocant, $input, $handle) = @_; my $self = ref $invocant ? $invocant : $invocant->new; $input = $self->preprocess_input($input); $self->validate_input($input); my $starting_section_name = $self->starting_section; SECTION: for (my $i = 0; $i < $#$input; $i += 2) { my ($section_name, $section_data) = @$input[ $i, $i + 1 ]; $self->change_section($section_name); $handle->print($self->stringify_section($section_data)) or Carp::croak "error writing section $section_name: $!"; $self->finish_section; } } #pod =head1 METHODS FOR SUBCLASSING #pod #pod These are the methods you need to understand and possibly change when #pod subclassing Config::INI::Reader to handle a different format of input. #pod #pod =head2 preprocess_input #pod #pod my $processed_input = $writer->preprocess_input($input_data); #pod #pod This method is called to ensure that the data given to the C methods #pod are in a canonical form for processing and emitting. The default #pod implementation converts hashrefs to arrayrefs and, if the input is a hashref, #pod moves the L to the beginning of the produced arrayref. #pod #pod In other words, given: #pod #pod { #pod section_1 => { a => 1, b => 2 }, #pod section_2 => { c => 3, c => 4 }, #pod _ => { d => 5, e => 6 }, #pod } #pod #pod This method will return: #pod #pod [ #pod _ => [ d => 5, e => 6 ], #pod section_2 => [ c => 3, c => 4 ], #pod section_1 => [ a => 1, b => 2 ], #pod ] #pod #pod The only guaranteed ordering when hashes are provided as input is that the #pod starting section will appear first. #pod #pod =cut sub preprocess_input { my ($self, $data) = @_; my @new_data; if (ref $data eq 'HASH') { my $starting_section_name = $self->starting_section; for my $name ( $starting_section_name, grep { $_ ne $starting_section_name } keys %$data ) { my $props = $data->{ $name }; next unless defined $props; push @new_data, $name => ((ref($props) || '') eq 'HASH') ? [ %$props ] : $props; } } elsif (ref $data eq 'ARRAY') { for (my $i = 0; $i < $#$data; $i += 2) { my ($name, $props) = @$data[ $i, $i + 1 ]; push @new_data, $name, (ref $props eq 'HASH') ? [ %$props ] : $props; } } else { my $class = ref $self; Carp::croak "can't output $data via $class"; } return \@new_data; } #pod =head2 validate_section_name #pod #pod Carp::croak "section name contains illegal character" #pod if not $writer->is_valid_section_name($name); #pod #pod =cut sub is_valid_section_name { my ($self, $name) = @_; return $name !~ qr/(?:\n|\s;|^\s|\s$)/; } #pod =head2 is_valid_property_name #pod #pod Carp::croak "property name contains illegal character" #pod if not $writer->is_valid_property_name($name); #pod #pod =cut sub is_valid_property_name { my ($self, $property) = @_; return $property !~ qr/(?:\n|\s;|^\s|\s|=$)/; } #pod =head2 is_valid_value #pod #pod Carp::croak "value contains illegal character" #pod if not $writer->is_valid_value($name); #pod #pod =cut sub is_valid_value { my ($self, $value) = @_; return $value !~ qr/(?:\n|\s;|^\s|\s$)/; } #pod =head2 validate_input #pod #pod $writer->validate_input($input); #pod #pod This method is called on the input data once they've been preprocessed by #pod C>. #pod #pod It ensures that the processed input is structurally sound before beginning to #pod output it. For example, it ensures that no property is ever assigned more than #pod once in a given section. #pod #pod This method either raises an exception or it doesn't. #pod #pod =cut sub validate_input { my ($self, $input) = @_; my %seen; for (my $i = 0; $i < $#$input; $i += 2) { my ($name, $props) = @$input[ $i, $i + 1 ]; $seen{ $name } ||= {}; Carp::croak "illegal section name '$name'" if not $self->is_valid_section_name($name); for (my $j = 0; $j < $#$props; $j += 2) { my $property = $props->[ $j ]; my $value = $props->[ $j + 1 ]; Carp::croak "property name '$property' contains illegal character" if not $self->is_valid_property_name($property); Carp::croak "value for $name.$property contains illegal character" if defined $value and not $self->is_valid_value($value); if ( $seen{ $name }{ $property }++ ) { Carp::croak "multiple assignments found for $name.$property"; } } } } #pod =head2 change_section #pod #pod $writer->change_section($section_name); #pod #pod This method is called each time a new section is going to be written out. If #pod the same section appears twice in a row in the input, this method will still be #pod called between instances of that section. #pod #pod In other words, given this input: #pod #pod [ #pod section_1 => [ a => 1 ], #pod section_1 => [ b => 2 ], #pod ] #pod #pod C will be called twice: once before the first C and #pod once before the second C. #pod #pod =cut sub change_section { my ($self, $section_name) = @_; $self->{current_section} = $section_name; } #pod =head2 current_section #pod #pod $writer->current_section #pod #pod This method returns the section currently being written out. #pod #pod =cut sub current_section { my ($self) = @_; return $self->{current_section}; } #pod =head2 finish_section #pod #pod $writer->finish_section #pod #pod This method is called after all of the current section's properties have been #pod written. #pod #pod =cut sub finish_section { my ($self) = @_; return $self->{did_section}{ $self->current_section }++; } #pod =head2 done_sections #pod #pod my @names = $writer->done_sections; #pod #pod This method returns a list of all sections that have been written out and #pod finished. The fact that a section name is returned by C does #pod not mean that there will be no more data for that section, but that at least #pod one entire set of data has been written out for it. #pod #pod =cut sub done_sections { my ($self) = @_; return keys %{ $self->{did_section} }; } #pod =head2 stringify_section #pod #pod my $string = $writer->stringify_section($props); #pod #pod This method returns a string assigning all the properties set in the given #pod data. This still will include the section header, if needed. (The only case #pod in which it is not needed is when the C> method #pod returns false, no other sections have been done, and the section about to be #pod stringified is the C>. #pod #pod This method is implemented in terms of C> and #pod C>. #pod #pod =cut sub stringify_section { my ($self, $section_data) = @_; my $output = ''; my $current_section_name = $self->current_section; my $starting_section_name = $self->starting_section; unless ( $starting_section_name and $starting_section_name eq $current_section_name and ! $self->done_sections and ! $self->explicit_starting_header ) { $output .= $self->stringify_section_header($self->current_section); } $output .= $self->stringify_section_data($section_data); return $output; } #pod =head2 stringify_section_data #pod #pod my $string = $writer->stringify_section_data($props) #pod #pod This method returns a string containing a series of lines, each containing a #pod value assignment for the given properties. #pod #pod =cut sub stringify_section_data { my ($self, $values) = @_; my $output = ''; for (my $i = 0; $i < $#$values; $i += 2) { $output .= $self->stringify_value_assignment(@$values[ $i, $i + 1]); } return $output; } #pod =head2 stringify_value_assignment #pod #pod my $string = $writer->stringify_value_assignment($name => $value); #pod #pod This method returns a string that assigns a value to a named property. If the #pod value is undefined, an empty string is returned. #pod #pod =cut sub stringify_value_assignment { my ($self, $name, $value) = @_; return '' unless defined $value; return $name . ' = ' . $self->stringify_value($value) . "\n"; } #pod =head2 stringify_value #pod #pod my $string = $writer->stringify_value($value); #pod #pod This method returns the string that will represent the given value in a #pod property assignment. #pod #pod =cut sub stringify_value { my ($self, $value) = @_; $value = defined $value ? $value : ''; return $value; } #pod =head2 stringify_section_header #pod #pod my $string = $writer->stringify_section_header($section_name); #pod #pod This method returns the string (a line) that represents the given section name. #pod Basically, this returns: #pod #pod [section_name] #pod #pod =cut sub stringify_section_header { my ($self, $section_name) = @_; my $output = ''; $output .= "\n" if $self->done_sections; $output .= "[$section_name]\n"; return $output; } #pod =head2 starting_section #pod #pod This method returns the name of the starting section. If this section appears #pod first (as it will, when given a hashref as input) and if #pod C> returns false, its section header can be #pod omitted. #pod #pod =cut sub starting_section { return '_' } #pod =head2 explicit_starting_header #pod #pod If this method returns true (which it does I, by default), then the #pod section header for the starting section will be emitted, even if it appears #pod first. #pod #pod =cut sub explicit_starting_header { 0 } #pod =head2 new #pod #pod #pod my $reader = Config::INI::Writer->new; #pod #pod This method returns a new writer. This generally does not need to be called by #pod anything but the various C methods, which create a writer object only #pod ephemerally. #pod #pod =cut sub new { my ($class) = @_; my $self = bless { did_section => {} } => $class; return $self; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::INI::Writer - a subclassable .ini-file emitter =head1 VERSION version 0.027 =head1 SYNOPSIS If <$hash> contains: { '_' => { admin => 'rjbs' }, rjbs => { awesome => 'yes', height => q{5' 10"}, }, mj => { awesome => 'totally', height => '23"', }, } Then when your program contains: Config::INI::Writer->write_file($hash, 'family.ini'); F will contains: admin = rjbs [rjbs] awesome = yes height = 5' 10" [mj] awesome = totally height = 23" =head1 DESCRIPTION Config::INI::Writer is I config module implementing I slightly different take on the undeniably easy to read L<".ini" file format|Config::INI>. Its default behavior is quite similar to that of L, on which it is based. The chief difference is that Config::INI::Writer is designed to be subclassed to allow for side-effects and self-reconfiguration to occur during the course of reading its input. =head1 PERL VERSION SUPPORT This module has a long-term perl support period. That means it will not require a version of perl released fewer than five years ago. Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. =head1 METHODS FOR WRITING CONFIG There are three writer methods, C, C, and C. The first two are implemented in terms of the third. It iterates over a collection of data, emitting lines to the filehandle as it goes. The lines are generated by events produced by iterating over the data. Those events are detailed below in the L section. The given data should be a hashref of hashrefs: { section_name_1 => { prop1 => 'value1', prop2 => 'value2' }, section_name_2 => ... } ...or an arrayref of section name and arrayref pairs: [ section_name_1 => [ prop1 => 'value1', prop2 => 'value2' ], section_name_2 => ... ] ...or a combination of those: [ section_name_1 => { prop1 => 'value1', prop2 => 'value2' }, section_name_2 => [ prop3 => 'value3', prop4 => 'value4' ], section_name_3 => ... ] All the reader methods throw an exception when they encounter an error. =head2 write_file Config::INI::Writer->write_file($input, $filename); This method writes out the configuration represented by C<$data> to the file named by C<$filename>. If a file by that name exists, it is overwritten. This method will either succeed or raise an exception. (Its return value is not defined.) =head2 write_string my $string = Config::INI::Writer->write_string($input); This method returns a string containing the INI content describing the given data. =head2 write_handle Config::INI::Writer->write_handle($input, $handle); This method writes the data in C<$data> to the IO::Handle-like object in C<$handle>. This method should either succeed or throw an exception. =head1 METHODS FOR SUBCLASSING These are the methods you need to understand and possibly change when subclassing Config::INI::Reader to handle a different format of input. =head2 preprocess_input my $processed_input = $writer->preprocess_input($input_data); This method is called to ensure that the data given to the C methods are in a canonical form for processing and emitting. The default implementation converts hashrefs to arrayrefs and, if the input is a hashref, moves the L to the beginning of the produced arrayref. In other words, given: { section_1 => { a => 1, b => 2 }, section_2 => { c => 3, c => 4 }, _ => { d => 5, e => 6 }, } This method will return: [ _ => [ d => 5, e => 6 ], section_2 => [ c => 3, c => 4 ], section_1 => [ a => 1, b => 2 ], ] The only guaranteed ordering when hashes are provided as input is that the starting section will appear first. =head2 validate_section_name Carp::croak "section name contains illegal character" if not $writer->is_valid_section_name($name); =head2 is_valid_property_name Carp::croak "property name contains illegal character" if not $writer->is_valid_property_name($name); =head2 is_valid_value Carp::croak "value contains illegal character" if not $writer->is_valid_value($name); =head2 validate_input $writer->validate_input($input); This method is called on the input data once they've been preprocessed by C>. It ensures that the processed input is structurally sound before beginning to output it. For example, it ensures that no property is ever assigned more than once in a given section. This method either raises an exception or it doesn't. =head2 change_section $writer->change_section($section_name); This method is called each time a new section is going to be written out. If the same section appears twice in a row in the input, this method will still be called between instances of that section. In other words, given this input: [ section_1 => [ a => 1 ], section_1 => [ b => 2 ], ] C will be called twice: once before the first C and once before the second C. =head2 current_section $writer->current_section This method returns the section currently being written out. =head2 finish_section $writer->finish_section This method is called after all of the current section's properties have been written. =head2 done_sections my @names = $writer->done_sections; This method returns a list of all sections that have been written out and finished. The fact that a section name is returned by C does not mean that there will be no more data for that section, but that at least one entire set of data has been written out for it. =head2 stringify_section my $string = $writer->stringify_section($props); This method returns a string assigning all the properties set in the given data. This still will include the section header, if needed. (The only case in which it is not needed is when the C> method returns false, no other sections have been done, and the section about to be stringified is the C>. This method is implemented in terms of C> and C>. =head2 stringify_section_data my $string = $writer->stringify_section_data($props) This method returns a string containing a series of lines, each containing a value assignment for the given properties. =head2 stringify_value_assignment my $string = $writer->stringify_value_assignment($name => $value); This method returns a string that assigns a value to a named property. If the value is undefined, an empty string is returned. =head2 stringify_value my $string = $writer->stringify_value($value); This method returns the string that will represent the given value in a property assignment. =head2 stringify_section_header my $string = $writer->stringify_section_header($section_name); This method returns the string (a line) that represents the given section name. Basically, this returns: [section_name] =head2 starting_section This method returns the name of the starting section. If this section appears first (as it will, when given a hashref as input) and if C> returns false, its section header can be omitted. =head2 explicit_starting_header If this method returns true (which it does I, by default), then the section header for the starting section will be emitted, even if it appears first. =head2 new my $reader = Config::INI::Writer->new; This method returns a new writer. This generally does not need to be called by anything but the various C methods, which create a writer object only ephemerally. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2007 by Ricardo Signes. 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 Config-INI-0.027/examples/utf8-bom.ini000644 000765 000024 00000000120 14064516053 017424 0ustar00rjbsstaff000000 000000 stupid = this ; This file should be saved with a BOM even though it's UTF-8! Config-INI-0.027/examples/simple.ini000644 000765 000024 00000000223 14064516053 017260 0ustar00rjbsstaff000000 000000 root=something [section] one=two Foo=Bar this=Your Mother! blank= [section] moo=kooh [Section Two] something else=blah remove = whitespace Config-INI-0.027/xt/author/000755 000765 000024 00000000000 14064516053 015410 5ustar00rjbsstaff000000 000000 Config-INI-0.027/xt/release/000755 000765 000024 00000000000 14064516053 015526 5ustar00rjbsstaff000000 000000 Config-INI-0.027/xt/release/changes_has_content.t000644 000765 000024 00000002101 14064516053 021702 0ustar00rjbsstaff000000 000000 use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.027'; my $trial_token = '-TRIAL'; my $encoding = 'UTF-8'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); if ($encoding) { require Encode; $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); } close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } Config-INI-0.027/xt/author/pod-syntax.t000644 000765 000024 00000000252 14064516053 017702 0ustar00rjbsstaff000000 000000 #!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(); Config-INI-0.027/t/reader.t000644 000765 000024 00000004203 14064516053 015344 0ustar00rjbsstaff000000 000000 #!perl use strict; use IO::File; use Test::More tests => 8; # Check their perl version use_ok('Config::INI::Reader'); # Try to read in a config my $hashref = Config::INI::Reader->read_file( 'examples/simple.ini' ); isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_file"); # Check the structure of the config my $expected = { '_' => { root => 'something', }, section => { one => 'two', Foo => 'Bar', this => 'Your Mother!', blank => '', moo => 'kooh', }, 'Section Two' => { 'something else' => 'blah', 'remove' => 'whitespace', }, }; is_deeply($hashref, $expected, 'Config structure matches expected'); # Add some stuff to the trivial config and check read_string() for it my $Trivial = {}; $Trivial->{_} = { root1 => 'root2' }; $Trivial->{section} = { foo => 'bar', this => 'that', blank => '', }; $Trivial->{section2} = { 'this little piggy' => 'went to market' }; my $string = <read_string( $string ); isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_string"); is_deeply( $hashref, $Trivial, '->read_string returns expected value' ); } { # Test read_handle my $fh = IO::File->new('examples/simple.ini', 'r'); my $data = do { local $/ = undef; <$fh> }; open my $io, '<', \$data or die "can't open in memory string: $!"; is_deeply( Config::INI::Reader->new->read_handle( $io ), $expected, '->read_handle returns expected value' ); } ##################################################################### # Bugs that happened we don't want to happen again { # Reading in an empty file, or a defined but zero length string, should yield # a valid, but empty, object. my $empty = Config::INI::Reader->read_string(''); is_deeply($empty, {}, "an empty string gets an empty hashref"); } { # "0" is a valid section name my $config = Config::INI::Reader->read_string("[0]\nfoo = 1\n"); is_deeply( $config, { 0 => { foo => 1 } }, "we can use 0 as a section name", ); } Config-INI-0.027/t/reader-err.t000644 000765 000024 00000003574 14064516053 016144 0ustar00rjbsstaff000000 000000 #!perl use strict; use warnings; use Config::INI::Reader; use Test::More tests => 9; eval { Config::INI::Reader->read_file; }; like($@, qr/no filename specified/i, 'read_file without args'); { my $filename = q{t/does/not/exist}; Carp::croak "unexpected file found in test directory t" if -e 't/does/not/exist'; eval { Config::INI::Reader->read_file($filename); }; like( $@, qr/file '$filename' does not exist/i, 'read_file with non-existent file' ); } { my $filename = 'lib'; eval { Config::INI::Reader->read_file($filename); }; like($@, qr/not readable/i, 'read_file on non-readable thing'); } SKIP: { eval "require File::Temp;" or skip "File::Temp not available", 1; # This could probably be limited to being required for Cygwin. eval "require filetest;" or skip "filetest.pm not available", 1; filetest->import('access'); my ($fh, $fn) = File::Temp::tempfile('tempXXXXX', UNLINK => 1); close $fh; chmod 0222, $fn; if (-r $fn) { chmod 0666, $fh; skip "chmoding file 0222 left it -r", 1; } eval { Config::INI::Reader->read_file($fn); }; like($@, qr/not readable/, "can't read an unreadable file"); chmod 0666, $fh; } eval { Config::INI::Reader->read_string; }; like($@, qr/no string provided/i, 'read_string without args'); { my $input = 'foo bar moo'; eval { Config::INI::Reader->read_string($input); }; like($@, qr/Syntax error at line 1: '$input'/i, 'syntax error'); } { # looks like a comment my $input = "[foo ; bar]\nvalue = 1\n"; my $data = eval { Config::INI::Reader->read_string($input); }; like($@, qr/Syntax error at line 1:/i, 'syntax error'); } { my $ok = eval { my $hashref = Config::INI::Reader->read_file( 'examples/utf8-bom.ini' ); 1; }; my $error = $@; ok( ! $ok, "we can't read a UTF-8 file that starts with a BOM"); like($error, qr/BOM/, "the error message mentions a BOM"); } Config-INI-0.027/t/00-report-prereqs.t000644 000765 000024 00000013452 14064516053 017317 0ustar00rjbsstaff000000 000000 #!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.028 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass('Reported prereqs'); # vim: ts=4 sts=4 sw=4 et: Config-INI-0.027/t/writer.t000644 000765 000024 00000007155 14064516053 015427 0ustar00rjbsstaff000000 000000 #!perl use strict; use Test::More tests => 20; my $R = 'Config::INI::Reader'; my $W = 'Config::INI::Writer'; use_ok($_) for $R, $W; my $data = { _ => { a => 1, b => 2, c => 3, }, foo => { bar => 'baz', baz => 'bar', }, }; is_deeply( $R->read_string($W->write_string($data)), $data, 'we can round-trip hashy data', ); is_deeply( $R->read_string($W->new->write_string($data)), $data, 'we can round-trip hashy data, object method', ); my $starting_first = [ _ => [ a => 1, b => 2, c => 3, ], foo => [ bar => 'baz', baz => 'bar', quux => undef, ], ]; my $expected = <<'END_INI'; a = 1 b = 2 c = 3 [foo] bar = baz baz = bar END_INI is( $W->write_string($starting_first), $expected, 'stringifying AOA, _ first', ); is( $W->new->write_string($starting_first), $expected, 'stringifying AOA, _ first, object method', ); { my $expected = <<'END_INI'; [foo] bar = baz baz = bar [_] a = 1 b = 2 c = 3 [foo] fer = agin END_INI my $starting_later = [ foo => [ bar => 'baz', baz => 'bar', quux => undef, ], _ => [ a => 1, b => 2, c => 3, ], foo => [ fer => 'agin', ], ]; is( $W->write_string($starting_later), $expected, 'stringifying AOA, _ later', ); is( $W->new->write_string($starting_later), $expected, 'stringifying AOA, _ later, object method', ); } { my @possibilities = ( [ a => [ b => 1 ] ], [ a => { b => 1 } ], { a => { b => 1 } }, { a => [ b => 1 ] }, ); my $reference = $W->write_string(shift @possibilities); my $failures = 0; $failures++ unless $W->write_string(shift @possibilities) eq $reference; ok(!$failures, "all array/hash combinations seem miscible"); } eval { $W->write_string([ A => [ B => 1 ], A => [ B => 2 ] ]); }; like($@, qr/multiple/, "you can't set property B in section A more than once"); SKIP: { eval "require File::Temp;" or skip "File::Temp not availabe", 3; # This could probably be limited to being required for Cygwin. eval "require filetest;" or skip "filetest.pm not available", 3; filetest->import('access'); my ($fh, $fn) = File::Temp::tempfile('tempXXXXX', UNLINK => 1); close $fh; unlink $fn; $W->write_file($data, $fn); is_deeply( $R->read_file($fn), $data, "round-trip data->file->data", ); my $new_data = { foo => { a => 1, b => 69101 } }; $W->write_file($new_data, $fn); is_deeply( $R->read_file($fn), $new_data, "round-trip data->file->data, clobbering file", ); chmod 0444, $fn; if (-w $fn) { chmod 0666, $fh; skip "chmoding file 0444 left it -w", 1; } eval { Config::INI::Writer->write_file($data, $fn); }; like($@, qr/couldn't write/, "can't clobber an unwriteable file"); chmod 0666, $fh; } eval { $W->write_file($data); }; like($@, qr/no filename/, "you can't set write to a file without a filename"); eval { $W->write_file($data, 't'); }; like($@, qr/not a plain file/, "you can't write to a file that's -e -d"); eval { $W->write_string(sub { 1 }) }; like($@, qr/can't output CODE/, "you can't write out non-ARRAY/HASH data"); eval { $W->write_string({ "[=]" => { a => 1 } }) }; is($@, '', "a stupid section header ([=]) is allowed"); eval { $W->write_string({ "[\n]" => { a => 1 } }) }; like($@, qr/illegal/, "...but an impossible to parse one is not"); eval { $W->write_string({ "[foo ;bar]" => { a => 1 } }) }; like($@, qr/illegal/, "...we also can't emit things that would be comments"); eval { $W->write_string({ "[foo;bar]" => { a => 1 } }) }; is($@, '', "...but things -almost- like comments are okay"); Config-INI-0.027/t/00-report-prereqs.dd000644 000765 000024 00000002642 14064516053 017442 0ustar00rjbsstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.78' } }, 'develop' => { 'requires' => { 'Encode' => '0', 'Test::More' => '0', 'Test::Pod' => '1.41' } }, 'runtime' => { 'requires' => { 'Carp' => '0', 'Mixin::Linewise::Readers' => '0.110', 'Mixin::Linewise::Writers' => '0', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'IO::File' => '0', 'Test::More' => '0.96' } } }; $x; }