Config-MVP-2.200013/000755 000765 000024 00000000000 14354101747 013717 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/LICENSE000644 000765 000024 00000043656 14354101747 014742 0ustar00rjbsstaff000000 000000 This software is copyright (c) 2022 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) 2022 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) 2022 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 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Config-MVP-2.200013/Changes000644 000765 000024 00000012667 14354101747 015226 0ustar00rjbsstaff000000 000000 Revision history for Config-MVP 2.200013 2022-12-31 13:48:05-05:00 America/New_York - update packaging and metadata - minimum required Perl is now v5.12 - I know, there are still some open issues at this point, but I am mostly looking to get metadata updated on many dists, and not carefully reading bug reports. Sorry! 2.200012 2021-01-09 19:51:18-05:00 America/New_York - don't try to array-dereference non-array references (thanks, Sven Kirmess) 2.200011 2018-04-21 10:12:06+02:00 Europe/Oslo - cwd is now locally added to @INC during config reading (but this can be disabled by setting add_cwd_to_lib to false) 2.200010 2015-03-17 07:43:04-04:00 America/New_York - copypaste code! apply section_name fix from Section to WithBundles (thanks, Karen Etheridge) 2.200009 2015-03-07 17:18:10-05:00 America/New_York - module-loading exceptions now include a section_name attribute for the name of the section being assembled 2.200008 2014-07-02 19:24:59-04:00 America/New_York - fix a busted link - be more consistent in exception-throwing on missing packages - fix a dumb test that failed in a git checkout 2.200007 2014-01-29 21:04:25-05:00 America/New_York - throw an exception when a bundle reports an impossible situation, like { value => [] }; https://github.com/rjbs/Config-MVP/issues/5 2.200006 2013-09-17 08:58:53 Asia/Tokyo - fix repository data 2.200005 2013-09-17 08:56:36 Asia/Tokyo - removed use of deprecated Class::MOP::load_class (thanks, Karen Etheridge) 2.200004 2013-08-27 12:09:19 America/New_York - pass the arguments to missing_plugin in the right order 2.200003 2013-01-30 21:35:34 America/New_York - doc fixes (Thanks, George Hartzell!) 2.200002 2012-03-15 21:16:16 America/New_York - documentation fixes (Thanks, Gregor Herrmann of Debian!) - depend on at least version 0.17 of Class::Load, to work around a bug with perl5.8.8 and Module::Runtime 0.012. (Karen Etheridge) 2.200001 2011-02-11 11:13:20 America/New_York - when throwing "package not installed", add a "package" attribute to Error 2.200000 2011-02-08 11:05:12 America/New_York - add Config::MVP::Error for common exceptions - allow class loading and class-not-found handling to be subclassed (thanks, Kent Fredric!) 2.101650 2010-06-14 20:22:42 America/New_York - require Moose 0.91 for native trait support 2.101540 2010-06-03 00:28:57 America/New_York - improve if_none to return from the proper scope (i.e., now it works) 2.101480 2010-05-28 22:59:18 America/New_York - add an if_none callback to Reader::Finder; for now, private 2.101460 2010-05-26 22:29:43 America/New_York [BREAKS BACKWARD COMPATIBILITY] - I apologize for breaking backcompat twice in a week. I do not expect this to happen again. -- rjbs - Config::MVP::Reader is now a base class rather than a role. This significantly simplifies the use of Config::MVP readers and makes things easier to document. 1.101451 2010-05-25 22:38:06 America/New_York - always finalize sections added by bundles 1.101450 2010-05-25 18:13:19 America/New_York [BREAKS BACKWARD COMPATIBILITY] - The Reader interface has been substantially overhauled. - Readers no longer have persistent Assembler, but now must be handed one (or will generate one as needed) - the arguments for Reader->read_config have changed - classes implementing Reader are required to provide a read_into_assembler method, now - Reader::Findable has been broken into Findable and Findable::ByExtension 0.101410 2010-05-21 22:09:48 America/New_York Sections, Sequences, and Assemblers can now be finalized the Assembler finalizes things as appropriate Sections can refer to their containing Sequence Sequences can refer to their constructing Assembler bundles now can (and should) provide payload as an arrayref Assembler->begin_section can be given a reference to a package name to skip rewriting the replace_bundle_with_contents method is used by Assembler::WithBundles to convert bundle sections into contents 0.100780 2010-03-19 22:16:16 America/New_York the alias attr on Section is now lazy so that mvp_aliases is called 0.093350 2009-12-01 06:58:48 America/New_York added Config::MVP::Reader::Hash for use by adapter writers 0.093330 2009-11-29 17:40:08 America/New_York rebuild to include META.yml for sake of cpandeps scanner 0.093120 2009-11-08 add missing prereq 0.093000 2009-10-27 bundles for Assembler::WithBundles can now be nested 0.092990 2009-10-26 add Config::MVP::Reader and associated packages, from Dist::Zilla 0.092360 2009-08-24 add "begin_section" and "end_section" methods, mostly for wrapping with extra behavior in subclasses 0.092211 2009-08-09 much more documentation yet again 0.092210 2009-08-09 package interrogation (for mvp_* settings) is now done in Section initialization; this means you don't need to use the Assembler to benefit from this feature much more documentation Config-MVP-2.200013/MANIFEST000644 000765 000024 00000001544 14354101747 015054 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.029. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Config/MVP.pm lib/Config/MVP/Assembler.pm lib/Config/MVP/Assembler/WithBundles.pm lib/Config/MVP/Error.pm lib/Config/MVP/Reader.pm lib/Config/MVP/Reader/Findable.pm lib/Config/MVP/Reader/Findable/ByExtension.pm lib/Config/MVP/Reader/Finder.pm lib/Config/MVP/Reader/Hash.pm lib/Config/MVP/Section.pm lib/Config/MVP/Sequence.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/eg/config.mvp-test t/final-hooks.t t/hash.t t/lib/Config/MVP/Reader/Test.pm t/lib/Foo/Bar.pm t/lib/Foo/Baz.pm t/lib/Foo/Boo1.pm t/lib/Foo/Boo2.pm t/lib/Foo/Boondle.pm t/lib/Foo/BoondleHref.pm t/lib/Foo/CompileError.pm t/lib/Foo/Metaboondle.pm t/lib/Foo/Quux.pm t/reader.t xt/author/pod-syntax.t xt/release/changes_has_content.t Config-MVP-2.200013/t/000755 000765 000024 00000000000 14354101747 014162 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/xt/000755 000765 000024 00000000000 14354101747 014352 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/README000644 000765 000024 00000000603 14354101747 014576 0ustar00rjbsstaff000000 000000 This archive contains the distribution Config-MVP, version 2.200013: multivalue-property package-oriented configuration This software is copyright (c) 2022 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.029. Config-MVP-2.200013/META.yml000644 000765 000024 00000030642 14354101747 015175 0ustar00rjbsstaff000000 000000 --- abstract: 'multivalue-property package-oriented configuration' author: - 'Ricardo Signes ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::Fatal: '0' Test::More: '0.96' lib: '0' configure_requires: ExtUtils::MakeMaker: '6.78' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.029, 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-MVP requires: Class::Load: '0.17' Cwd: '0' File::Spec: '0' Module::Pluggable::Object: '0' Moose: '0.91' Moose::Role: '0' Moose::Util::TypeConstraints: '0' MooseX::OneArgNew: '0' Params::Util: '0' Role::HasMessage: '0' Role::Identifiable::HasIdent: '0' StackTrace::Auto: '0' Test::More: '0.96' Throwable: '0' Tie::IxHash: '0' Try::Tiny: '0' overload: '0' perl: '5.012' strict: '0' warnings: '0' resources: bugtracker: https://github.com/rjbs/Config-MVP/issues homepage: https://github.com/rjbs/Config-MVP repository: https://github.com/rjbs/Config-MVP.git version: '2.200013' x_Dist_Zilla: perl: version: '5.037002' plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: runtime type: requires name: Prereqs version: '6.029' - 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.048' - 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.029' - class: Dist::Zilla::Plugin::ManifestSkip name: '@RJBS/@Filter/ManifestSkip' version: '6.029' - class: Dist::Zilla::Plugin::MetaYAML name: '@RJBS/@Filter/MetaYAML' version: '6.029' - class: Dist::Zilla::Plugin::License name: '@RJBS/@Filter/License' version: '6.029' - class: Dist::Zilla::Plugin::Readme name: '@RJBS/@Filter/Readme' version: '6.029' - class: Dist::Zilla::Plugin::ExecDir name: '@RJBS/@Filter/ExecDir' version: '6.029' - class: Dist::Zilla::Plugin::ShareDir name: '@RJBS/@Filter/ShareDir' version: '6.029' - class: Dist::Zilla::Plugin::Manifest name: '@RJBS/@Filter/Manifest' version: '6.029' - class: Dist::Zilla::Plugin::TestRelease name: '@RJBS/@Filter/TestRelease' version: '6.029' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RJBS/@Filter/ConfirmRelease' version: '6.029' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RJBS/@Filter/UploadToCPAN' version: '6.029' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 9 name: '@RJBS/MakeMaker' version: '6.029' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RJBS/AutoPrereqs' version: '6.029' - 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.38.0 repo_root: . name: '@RJBS/Git::NextVersion' version: '2.048' - class: Dist::Zilla::Plugin::PkgVersion name: '@RJBS/PkgVersion' version: '6.029' - class: Dist::Zilla::Plugin::MetaConfig name: '@RJBS/MetaConfig' version: '6.029' - class: Dist::Zilla::Plugin::MetaJSON name: '@RJBS/MetaJSON' version: '6.029' - class: Dist::Zilla::Plugin::NextRelease name: '@RJBS/NextRelease' version: '6.029' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: '@RJBS/Test::ChangesHasContent' version: '0.011' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RJBS/PodSyntaxTests' version: '6.029' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@RJBS/Test::ReportPrereqs' version: '0.028' - class: Dist::Zilla::Plugin::Git::Remote::Check name: '@RJBS/Git::Remote::Check' version: 0.1.2 - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@RJBS/TestMoreWithSubtests' version: '6.029' - 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.020' - 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.38.0 repo_root: . name: '@RJBS/@Git/Check' version: '2.048' - 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.38.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Commit' version: '2.048' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: '2.200013' tag_format: '%v' tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.38.0 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@RJBS/@Git/Tag' version: '2.048' - 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.38.0 repo_root: . name: '@RJBS/@Git/Push' version: '2.048' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.38.0 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.029' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.029' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.029' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: '6.029' x_contributors: - 'Alexandr Ciornii ' - 'George Hartzell ' - 'Karen Etheridge ' - 'Kent Fredric ' - 'Philippe Bruhat (BooK) ' - 'Ricardo Signes ' - 'Sven Kirmess ' x_generated_by_perl: v5.37.2 x_rjbs_perl_window: standard x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later' Config-MVP-2.200013/lib/000755 000765 000024 00000000000 14354101747 014465 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/Makefile.PL000644 000765 000024 00000004134 14354101747 015673 0ustar00rjbsstaff000000 000000 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.029. use strict; use warnings; use 5.012; use ExtUtils::MakeMaker 6.78; my %WriteMakefileArgs = ( "ABSTRACT" => "multivalue-property package-oriented configuration", "AUTHOR" => "Ricardo Signes ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.78" }, "DISTNAME" => "Config-MVP", "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.012", "NAME" => "Config::MVP", "PREREQ_PM" => { "Class::Load" => "0.17", "Cwd" => 0, "File::Spec" => 0, "Module::Pluggable::Object" => 0, "Moose" => "0.91", "Moose::Role" => 0, "Moose::Util::TypeConstraints" => 0, "MooseX::OneArgNew" => 0, "Params::Util" => 0, "Role::HasMessage" => 0, "Role::Identifiable::HasIdent" => 0, "StackTrace::Auto" => 0, "Test::More" => "0.96", "Throwable" => 0, "Tie::IxHash" => 0, "Try::Tiny" => 0, "overload" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "lib" => 0 }, "VERSION" => "2.200013", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Class::Load" => "0.17", "Cwd" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Module::Pluggable::Object" => 0, "Moose" => "0.91", "Moose::Role" => 0, "Moose::Util::TypeConstraints" => 0, "MooseX::OneArgNew" => 0, "Params::Util" => 0, "Role::HasMessage" => 0, "Role::Identifiable::HasIdent" => 0, "StackTrace::Auto" => 0, "Test::Fatal" => 0, "Test::More" => "0.96", "Throwable" => 0, "Tie::IxHash" => 0, "Try::Tiny" => 0, "lib" => 0, "overload" => 0, "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-MVP-2.200013/META.json000644 000765 000024 00000046622 14354101747 015352 0ustar00rjbsstaff000000 000000 { "abstract" : "multivalue-property package-oriented configuration", "author" : [ "Ricardo Signes " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Config-MVP", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.78" } }, "develop" : { "requires" : { "Encode" : "0", "Test::More" : "0", "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Class::Load" : "0.17", "Cwd" : "0", "File::Spec" : "0", "Module::Pluggable::Object" : "0", "Moose" : "0.91", "Moose::Role" : "0", "Moose::Util::TypeConstraints" : "0", "MooseX::OneArgNew" : "0", "Params::Util" : "0", "Role::HasMessage" : "0", "Role::Identifiable::HasIdent" : "0", "StackTrace::Auto" : "0", "Test::More" : "0.96", "Throwable" : "0", "Tie::IxHash" : "0", "Try::Tiny" : "0", "overload" : "0", "perl" : "5.012", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::Fatal" : "0", "Test::More" : "0.96", "lib" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/rjbs/Config-MVP/issues" }, "homepage" : "https://github.com/rjbs/Config-MVP", "repository" : { "type" : "git", "url" : "https://github.com/rjbs/Config-MVP.git", "web" : "https://github.com/rjbs/Config-MVP" } }, "version" : "2.200013", "x_Dist_Zilla" : { "perl" : { "version" : "5.037002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "runtime", "type" : "requires" } }, "name" : "Prereqs", "version" : "6.029" }, { "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.048" }, { "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.029" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@RJBS/@Filter/ManifestSkip", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RJBS/@Filter/MetaYAML", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RJBS/@Filter/License", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@RJBS/@Filter/Readme", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RJBS/@Filter/ExecDir", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RJBS/@Filter/ShareDir", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RJBS/@Filter/Manifest", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RJBS/@Filter/TestRelease", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RJBS/@Filter/ConfirmRelease", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RJBS/@Filter/UploadToCPAN", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 9 } }, "name" : "@RJBS/MakeMaker", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RJBS/AutoPrereqs", "version" : "6.029" }, { "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.38.0", "repo_root" : "." } }, "name" : "@RJBS/Git::NextVersion", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@RJBS/PkgVersion", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RJBS/MetaConfig", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RJBS/MetaJSON", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RJBS/NextRelease", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "@RJBS/Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RJBS/PodSyntaxTests", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@RJBS/Test::ReportPrereqs", "version" : "0.028" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "@RJBS/Git::Remote::Check", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@RJBS/TestMoreWithSubtests", "version" : "6.029" }, { "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.020" }, { "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.38.0", "repo_root" : "." } }, "name" : "@RJBS/@Git/Check", "version" : "2.048" }, { "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.38.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Commit", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "2.200013", "tag_format" : "%v", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.38.0", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@RJBS/@Git/Tag", "version" : "2.048" }, { "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.38.0", "repo_root" : "." } }, "name" : "@RJBS/@Git/Push", "version" : "2.048" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.38.0", "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.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.029" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.029" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.029" } }, "x_contributors" : [ "Alexandr Ciornii ", "George Hartzell ", "Karen Etheridge ", "Kent Fredric ", "Philippe Bruhat (BooK) ", "Ricardo Signes ", "Sven Kirmess " ], "x_generated_by_perl" : "v5.37.2", "x_rjbs_perl_window" : "standard", "x_serialization_backend" : "Cpanel::JSON::XS version 4.30", "x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later" } Config-MVP-2.200013/dist.ini000644 000765 000024 00000000511 14354101747 015360 0ustar00rjbsstaff000000 000000 name = Config-MVP author = Ricardo Signes license = Perl_5 copyright_holder = Ricardo Signes [Prereqs] Moose = 0 ; min ver unknown Tie::IxHash = 0 ; min ver unknown Module::Pluggable::Object = 0 ; min ver unknown Test::More = 0.88 [@RJBS] perl-window = standard version = 2 github_issues = 1 Config-MVP-2.200013/lib/Config/000755 000765 000024 00000000000 14354101747 015672 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/lib/Config/MVP/000755 000765 000024 00000000000 14354101747 016334 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/lib/Config/MVP.pm000644 000765 000024 00000040577 14354101747 016707 0ustar00rjbsstaff000000 000000 package Config::MVP 2.200013; # ABSTRACT: multivalue-property package-oriented configuration use strict; use warnings; #pod =head1 SYNOPSIS #pod #pod If you want a useful synopsis, consider this code which actually comes from #pod L: #pod #pod my $assembler = Config::MVP::Assembler->new; #pod #pod # Maybe you want a starting section: #pod my $section = $assembler->section_class->new({ name => '_' }); #pod $assembler->sequence->add_section($section); #pod #pod # We'll add some values, which will go to the starting section: #pod $assembler->add_value(x => 10); #pod $assembler->add_value(y => 20); #pod #pod # Change to a new section... #pod $assembler->change_section($moniker); #pod #pod # ...and add values to that section. #pod $assembler->add_value(x => 100); #pod $assembler->add_value(y => 200); #pod #pod This doesn't make sense? Well, read on. #pod #pod (You can also read the L<2009 RJBS Advent Calendar #pod article|http://advent.rjbs.manxome.org/2009/2009-12-20.html> on Config::MVP!) #pod #pod =head1 DESCRIPTION #pod #pod MVP is a mechanism for loading configuration (or other information) for #pod libraries. It doesn't read a file or a database. It's a helper for things #pod that do. #pod #pod The idea is that you end up with a #pod L object, and that you can use #pod that object to fully configure your library or application. The sequence will #pod contain a bunch of L objects, each #pod of which is meant to provide configuration for a part of your program. Most of #pod these sections will be directly related to a Perl library that you'll use as a #pod plugin or helper. Each section will have a name, and every name in the #pod sequence will be unique. #pod #pod This is a pretty abstract set of behaviors, so we'll provide some more concrete #pod examples that should help explain how things work. #pod #pod =head1 EXAMPLE #pod #pod Imagine that we've got a program called DeliveryBoy that accepts mail and does #pod stuff with it. The "stuff" is entirely up to the user's configuration. He can #pod set up plugins that will be used on the message. He writes a config file that's #pod read by L, which is a thin #pod wrapper around Config::MVP used to load MVP-style config from F files. #pod #pod Here's the user's configuration: #pod #pod [Whitelist] #pod require_pgp = 1 #pod #pod file = whitelist-family #pod file = whitelist-friends #pod file = whitelist-work #pod #pod [SpamFilter] #pod filterset = standard #pod max_score = 5 #pod action = bounce #pod #pod [SpamFilter / SpamFilter_2] #pod filterset = aggressive #pod max_score = 5 #pod action = tag #pod #pod [VerifyPGP] #pod #pod [Deliver] #pod dest = Maildir #pod #pod The user will end up with a sequence with five sections, which we can represent #pod something like this: #pod #pod { name => 'Whitelist', #pod package => 'DeliveryBoy::Plugin::Whitelist', #pod payload => { #pod require_pgp => 1, #pod files => [ qw(whitelist-family whitelist-friends whitelist-work) ] #pod }, #pod }, #pod { name => 'SpamFilter', #pod package => 'DeliveryBoy::Plugin::SpamFilter', #pod payload => { #pod filterset => 'standard', #pod max_score => 5, #pod action => 'bounce', #pod } #pod }, #pod { name => 'SpamFilter_2', #pod package => 'DeliveryBoy::Plugin::SpamFilter', #pod payload => { #pod filterset => 'aggressive', #pod max_score => 5, #pod action => 'tag', #pod }, #pod }, #pod { name => 'VerifyPGP', #pod package => 'DeliveryBoy::Plugin::VerifyPGP', #pod payload => { }, #pod }, #pod { name => 'Deliver', #pod package => 'DeliveryBoy::Plugin::Deliver', #pod payload => { dest => 'Maildir' }, #pod }, #pod #pod The INI reader uses L to build #pod up configuration section by section as it goes, so that's how we'll talk about #pod what's going on. #pod #pod Every section of the config file was converted into a section in the MVP #pod sequence. Each section has a unique name, which defaults to the name of the #pod INI section. Each section is also associated with a package, which was #pod expanded from the INI section name. The way that names are expanded can be #pod customized by subclassing the assembler. #pod #pod Every section also has a payload -- a hashref of settings. Note that every #pod entry in every payload is a simple scalar except for one. The C entry #pod for the Whitelist section is an arrayref. Also, note that while it appears as #pod C in the final output, it was given as C in the input. #pod #pod Config::MVP provides a mechanism by which packages can define aliases for #pod configuration names and an indication of what names correspond to "multi-value #pod parameters." (That's part of the meaning of the name "MVP.") When the MVP #pod assembler is told to start a section for C it expands the section #pod name, loads the package, and inspects it for aliases and multivalue parameters. #pod Then if multiple entries for a non-multivalue parameter are given, an exception #pod can be raised. Multivalue parameters are always pushed onto arrayrefs and #pod non-multivalue parameters are left as found. #pod #pod =head2 ...so what now? #pod #pod So, once our DeliveryBoy program has loaded its configuration, it needs to #pod initialize its plugins. It can do something like the following: #pod #pod my $sequence = $deliveryboy->load_config; #pod #pod for my $section ($sequence->sections) { #pod my $plugin = $section->package->new( $section->payload ); #pod $deliveryboy->add_plugin( $section->name, $plugin ); #pod } #pod #pod That's it! In fact, allowing this very, very block of code to load #pod configuration and initialize plugins is the goal of Config::MVP. #pod #pod The one thing not depicted is the notion of a "root section" that you might #pod expect to see in an INI file. This can be easily handled by starting your #pod assembler off with a pre-built section where root settings will end up. For #pod more information on this, look at the docs for the specific components. #pod #pod =head1 WHAT NEXT? #pod #pod =head2 Making Packages work with MVP #pod #pod Any package can be used as part of an MVP section. Packages can provide some #pod methods to help MVP work with them. It isn't a problem if they are not defined #pod #pod =head3 mvp_aliases #pod #pod This method should return a hashref of name remappings. For example, if it #pod returned this hashref: #pod #pod { #pod file => 'files', #pod path => 'files', #pod } #pod #pod Then attempting to set either the "file" or "path" setting for the section #pod would actually set the "files" setting. #pod #pod =head3 mvp_multivalue_args #pod #pod This method should return a list of setting names that may have multiple values #pod and that will always be stored in an arrayref. #pod #pod =head2 The Assembler #pod #pod L is a state machine that makes #pod it easy to build up your MVP-style configuration by firing off a series of #pod events: new section, new setting, etc. You might want to subclass it to change #pod the class of sequence or section that's used or to change how section names are #pod expanded into packages. #pod #pod =head2 Sequences and Sections #pod #pod L and #pod L are the two most important classes #pod in MVP. They represent the overall configuration and each section of the #pod configuration, respectively. They're both fairly simple classes, and you #pod probably won't need to subclass them, but it's easy. #pod #pod =head2 Examples in the World #pod #pod For examples of Config::MVP in use, you can look at L #pod or L. #pod #pod =cut 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP - multivalue-property package-oriented configuration =head1 VERSION version 2.200013 =head1 SYNOPSIS If you want a useful synopsis, consider this code which actually comes from L: my $assembler = Config::MVP::Assembler->new; # Maybe you want a starting section: my $section = $assembler->section_class->new({ name => '_' }); $assembler->sequence->add_section($section); # We'll add some values, which will go to the starting section: $assembler->add_value(x => 10); $assembler->add_value(y => 20); # Change to a new section... $assembler->change_section($moniker); # ...and add values to that section. $assembler->add_value(x => 100); $assembler->add_value(y => 200); This doesn't make sense? Well, read on. (You can also read the L<2009 RJBS Advent Calendar article|http://advent.rjbs.manxome.org/2009/2009-12-20.html> on Config::MVP!) =head1 DESCRIPTION MVP is a mechanism for loading configuration (or other information) for libraries. It doesn't read a file or a database. It's a helper for things that do. The idea is that you end up with a L object, and that you can use that object to fully configure your library or application. The sequence will contain a bunch of L objects, each of which is meant to provide configuration for a part of your program. Most of these sections will be directly related to a Perl library that you'll use as a plugin or helper. Each section will have a name, and every name in the sequence will be unique. This is a pretty abstract set of behaviors, so we'll provide some more concrete examples that should help explain how things work. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 EXAMPLE Imagine that we've got a program called DeliveryBoy that accepts mail and does stuff with it. The "stuff" is entirely up to the user's configuration. He can set up plugins that will be used on the message. He writes a config file that's read by L, which is a thin wrapper around Config::MVP used to load MVP-style config from F files. Here's the user's configuration: [Whitelist] require_pgp = 1 file = whitelist-family file = whitelist-friends file = whitelist-work [SpamFilter] filterset = standard max_score = 5 action = bounce [SpamFilter / SpamFilter_2] filterset = aggressive max_score = 5 action = tag [VerifyPGP] [Deliver] dest = Maildir The user will end up with a sequence with five sections, which we can represent something like this: { name => 'Whitelist', package => 'DeliveryBoy::Plugin::Whitelist', payload => { require_pgp => 1, files => [ qw(whitelist-family whitelist-friends whitelist-work) ] }, }, { name => 'SpamFilter', package => 'DeliveryBoy::Plugin::SpamFilter', payload => { filterset => 'standard', max_score => 5, action => 'bounce', } }, { name => 'SpamFilter_2', package => 'DeliveryBoy::Plugin::SpamFilter', payload => { filterset => 'aggressive', max_score => 5, action => 'tag', }, }, { name => 'VerifyPGP', package => 'DeliveryBoy::Plugin::VerifyPGP', payload => { }, }, { name => 'Deliver', package => 'DeliveryBoy::Plugin::Deliver', payload => { dest => 'Maildir' }, }, The INI reader uses L to build up configuration section by section as it goes, so that's how we'll talk about what's going on. Every section of the config file was converted into a section in the MVP sequence. Each section has a unique name, which defaults to the name of the INI section. Each section is also associated with a package, which was expanded from the INI section name. The way that names are expanded can be customized by subclassing the assembler. Every section also has a payload -- a hashref of settings. Note that every entry in every payload is a simple scalar except for one. The C entry for the Whitelist section is an arrayref. Also, note that while it appears as C in the final output, it was given as C in the input. Config::MVP provides a mechanism by which packages can define aliases for configuration names and an indication of what names correspond to "multi-value parameters." (That's part of the meaning of the name "MVP.") When the MVP assembler is told to start a section for C it expands the section name, loads the package, and inspects it for aliases and multivalue parameters. Then if multiple entries for a non-multivalue parameter are given, an exception can be raised. Multivalue parameters are always pushed onto arrayrefs and non-multivalue parameters are left as found. =head2 ...so what now? So, once our DeliveryBoy program has loaded its configuration, it needs to initialize its plugins. It can do something like the following: my $sequence = $deliveryboy->load_config; for my $section ($sequence->sections) { my $plugin = $section->package->new( $section->payload ); $deliveryboy->add_plugin( $section->name, $plugin ); } That's it! In fact, allowing this very, very block of code to load configuration and initialize plugins is the goal of Config::MVP. The one thing not depicted is the notion of a "root section" that you might expect to see in an INI file. This can be easily handled by starting your assembler off with a pre-built section where root settings will end up. For more information on this, look at the docs for the specific components. =head1 WHAT NEXT? =head2 Making Packages work with MVP Any package can be used as part of an MVP section. Packages can provide some methods to help MVP work with them. It isn't a problem if they are not defined =head3 mvp_aliases This method should return a hashref of name remappings. For example, if it returned this hashref: { file => 'files', path => 'files', } Then attempting to set either the "file" or "path" setting for the section would actually set the "files" setting. =head3 mvp_multivalue_args This method should return a list of setting names that may have multiple values and that will always be stored in an arrayref. =head2 The Assembler L is a state machine that makes it easy to build up your MVP-style configuration by firing off a series of events: new section, new setting, etc. You might want to subclass it to change the class of sequence or section that's used or to change how section names are expanded into packages. =head2 Sequences and Sections L and L are the two most important classes in MVP. They represent the overall configuration and each section of the configuration, respectively. They're both fairly simple classes, and you probably won't need to subclass them, but it's easy. =head2 Examples in the World For examples of Config::MVP in use, you can look at L or L. =head1 AUTHOR Ricardo Signes =head1 CONTRIBUTORS =for stopwords Alexandr Ciornii George Hartzell Karen Etheridge Kent Fredric Philippe Bruhat (BooK) Ricardo Signes Sven Kirmess =over 4 =item * Alexandr Ciornii =item * George Hartzell =item * Karen Etheridge =item * Kent Fredric =item * Philippe Bruhat (BooK) =item * Ricardo Signes =item * Sven Kirmess =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader/000755 000765 000024 00000000000 14354101747 017536 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/lib/Config/MVP/Assembler/000755 000765 000024 00000000000 14354101747 020251 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/lib/Config/MVP/Error.pm000644 000765 000024 00000003064 14354101747 017766 0ustar00rjbsstaff000000 000000 package Config::MVP::Error 2.200013; # ABSTRACT: common exceptions class use Moose; has message => ( is => 'ro', isa => 'Str', required => 1, lazy => 1, default => sub { $_->ident }, ); sub as_string { my ($self) = @_; join qq{\n}, $self->message, "\n", $self->stack_trace; } use overload (q{""} => 'as_string'); with( 'Throwable', 'Role::Identifiable::HasIdent', 'Role::HasMessage', 'StackTrace::Auto', 'MooseX::OneArgNew' => { type => 'Str', init_arg => 'ident', }, ); no Moose; __PACKAGE__->meta->make_immutable(inline_constructor => 0); 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Error - common exceptions class =head1 VERSION version 2.200013 =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Sequence.pm000644 000765 000024 00000014771 14354101747 020454 0ustar00rjbsstaff000000 000000 package Config::MVP::Sequence 2.200013; # ABSTRACT: an ordered set of named configuration sections use Moose 0.91; #pod =head1 DESCRIPTION #pod #pod A Config::MVP::Sequence is an ordered set of configuration sections, each of #pod which has a name unique within the sequence. #pod #pod For the most part, you can just consult L to understand what this #pod class is and how it's used. #pod #pod =cut use Tie::IxHash; use Config::MVP::Error; use Config::MVP::Section; use Moose::Util::TypeConstraints (); # This is a private attribute and should not be documented for futzing-with, # most likely. -- rjbs, 2009-08-09 has sections => ( isa => 'HashRef[Config::MVP::Section]', reader => '_sections', init_arg => undef, default => sub { tie my %section, 'Tie::IxHash'; return \%section; }, ); has assembler => ( is => 'ro', isa => Moose::Util::TypeConstraints::class_type('Config::MVP::Assembler'), weak_ref => 1, predicate => '_assembler_has_been_set', reader => '_assembler', writer => '__set_assembler', ); sub _set_assembler { my ($self, $assembler) = @_; Config::MVP::Error->throw("can't alter Config::MVP::Sequence's assembler") if $self->assembler; $self->__set_assembler($assembler); } sub assembler { my ($self) = @_; return undef unless $self->_assembler_has_been_set; my $assembler = $self->_assembler; unless (defined $assembler) { Config::MVP::Error->throw("can't access sequences's destroyed assembler") } return $assembler; } #pod =attr is_finalized #pod #pod This attribute is true if the sequence has been marked finalized, which will #pod prevent any changes (via methods like C or C). It #pod can be set with the C method. #pod #pod =cut has is_finalized => ( is => 'ro', isa => 'Bool', traits => [ 'Bool' ], init_arg => undef, default => 0, handles => { finalize => 'set' }, ); #pod =method add_section #pod #pod $sequence->add_section($section); #pod #pod This method adds the given section to the end of the sequence. If the sequence #pod already contains a section with the same name as the new section, an exception #pod will be raised. #pod #pod =cut sub add_section { my ($self, $section) = @_; Config::MVP::Error->throw("can't add sections to finalized sequence") if $self->is_finalized; my $name = $section->name; confess "already have a section named $name" if $self->_sections->{ $name }; $section->_set_sequence($self); if (my @names = $self->section_names) { my $last_section = $self->section_named( $names[-1] ); $last_section->finalize unless $last_section->is_finalized; } $self->_sections->{ $name } = $section; } #pod =method delete_section #pod #pod my $deleted_section = $sequence->delete_section( $name ); #pod #pod This method removes a section from the sequence and returns the removed #pod section. If no section existed, the method returns false. #pod #pod =cut sub delete_section { my ($self, $name) = @_; Config::MVP::Error->throw("can't delete sections from finalized sequence") if $self->is_finalized; my $sections = $self->_sections; return unless exists $sections->{ $name }; $sections->{ $name }->_clear_sequence; return delete $sections->{ $name }; } #pod =method section_named #pod #pod my $section = $sequence->section_named( $name ); #pod #pod This method returns the section with the given name, if one exists in the #pod sequence. If no such section exists, the method returns false. #pod #pod =cut sub section_named { my ($self, $name) = @_; my $sections = $self->_sections; return unless exists $sections->{ $name }; return $sections->{ $name }; } #pod =method section_names #pod #pod my @names = $sequence->section_names; #pod #pod This method returns a list of the names of the sections, in order. #pod #pod =cut sub section_names { my ($self) = @_; return keys %{ $self->_sections }; } #pod =method sections #pod #pod my @sections = $sequence->sections; #pod #pod This method returns the section objects, in order. #pod #pod =cut sub sections { my ($self) = @_; return values %{ $self->_sections }; } no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Sequence - an ordered set of named configuration sections =head1 VERSION version 2.200013 =head1 DESCRIPTION A Config::MVP::Sequence is an ordered set of configuration sections, each of which has a name unique within the sequence. For the most part, you can just consult L to understand what this class is and how it's used. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 ATTRIBUTES =head2 is_finalized This attribute is true if the sequence has been marked finalized, which will prevent any changes (via methods like C or C). It can be set with the C method. =head1 METHODS =head2 add_section $sequence->add_section($section); This method adds the given section to the end of the sequence. If the sequence already contains a section with the same name as the new section, an exception will be raised. =head2 delete_section my $deleted_section = $sequence->delete_section( $name ); This method removes a section from the sequence and returns the removed section. If no section existed, the method returns false. =head2 section_named my $section = $sequence->section_named( $name ); This method returns the section with the given name, if one exists in the sequence. If no such section exists, the method returns false. =head2 section_names my @names = $sequence->section_names; This method returns a list of the names of the sections, in order. =head2 sections my @sections = $sequence->sections; This method returns the section objects, in order. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Assembler.pm000644 000765 000024 00000027501 14354101747 020614 0ustar00rjbsstaff000000 000000 package Config::MVP::Assembler 2.200013; # ABSTRACT: multivalue-property config-loading state machine use Moose; use Config::MVP::Error; use Config::MVP::Sequence; use Config::MVP::Section; #pod =head1 DESCRIPTION #pod #pod First, you should probably read the L. If you already know how it works, keep #pod going. #pod #pod Config::MVP::Assembler is a helper for constructing a Config::MVP::Sequence #pod object. It's a very simple state machine that lets you signal what kind of #pod events you've encountered while reading configuration. #pod #pod =head1 TYPICAL USE #pod #pod my $assembler = Config::MVP::Assembler->new; #pod #pod # Maybe you want a starting section: #pod my $starting_section = $assembler->section_class->new({ name => '_' }); #pod $assembler->sequence->add_section($section_starting); #pod #pod # We'll add some values, which will go to the starting section: #pod $assembler->add_value(x => 10); #pod $assembler->add_value(y => 20); #pod #pod # Change to a new section... #pod $assembler->change_section($moniker); #pod #pod # ...and add values to that section. #pod $assembler->add_value(x => 100); #pod $assembler->add_value(y => 200); #pod #pod The code above creates an assembler and populates it step by step. In the end, #pod to get values, you could do something like this: #pod #pod my @output; #pod #pod for my $section ($assembler->sequence->sections) { #pod push @output, [ $section->name, $section->package, $section->payload ]; #pod } #pod #pod When changing sections, the given section "moniker" is used for the new section #pod name. The result of passing that moniker to the assembler's #pod C> method is used as the section's package name. (By #pod default, this method does nothing.) The new section's C and #pod C are determined by calling the C and #pod C methods on the package. #pod #pod =attr sequence_class #pod #pod This attribute stores the name of the class to be used for the assembler's #pod sequence. It defaults to Config::MVP::Sequence. #pod #pod =cut has sequence_class => ( is => 'ro', isa => 'ClassName', lazy => 1, default => 'Config::MVP::Sequence', ); #pod =attr section_class #pod #pod This attribute stores the name of the class to be used for sections created by #pod the assembler. It defaults to Config::MVP::Section. #pod #pod =cut has section_class => ( is => 'ro', isa => 'ClassName', lazy => 1, default => 'Config::MVP::Section', ); #pod =attr sequence #pod #pod This is the sequence that the assembler is assembling. It defaults to a new #pod instance of the assembler's C. #pod #pod =cut has sequence => ( is => 'ro', isa => 'Config::MVP::Sequence', default => sub { $_[0]->sequence_class->new({ assembler => $_[0] }) }, init_arg => undef, handles => [ qw(is_finalized finalize) ], ); before finalize => sub { my ($self) = @_; $self->end_section if $self->current_section; }; #pod =method begin_section #pod #pod $assembler->begin_section($package_moniker, $name); #pod #pod $assembler->begin_section($package_moniker); #pod #pod $assembler->begin_section( \$package ); #pod #pod This method tells the assembler that it should begin work on a new section with #pod the given identifier. If it is already working on a section, an error will be #pod raised. See C> for a method to begin a new section, ending #pod the current one if needed. #pod #pod The package moniker is expanded by the C> method. The name, #pod if not given, defaults to the package moniker. These data are used to create a #pod new section and the section is added to the end of the sequence. If the #pod package argument is a reference, it is used as the literal value for the #pod package, and no expansion is performed. If it is a reference to undef, a #pod section with no package is created. #pod #pod =cut has _between_sections => ( is => 'rw', isa => 'Bool', default => 0, ); sub begin_section { my ($self, $package_moniker, $name) = @_; Config::MVP::Error->throw("can't begin a new section while a section is open") if $self->current_section; $name = $package_moniker unless defined $name and length $name; my $package = ref($package_moniker) ? $$package_moniker : $self->expand_package($package_moniker); my $section = $self->section_class->new({ name => $name, (defined $package ? (package => $package) : ()), }); $self->_between_sections(0); $self->sequence->add_section($section); } #pod =method end_section #pod #pod $assembler->end_section; #pod #pod This ends the current section. If there is no current section, an exception is #pod raised. #pod #pod =cut sub end_section { my ($self) = @_; Config::MVP::Error->throw("can't end a section when no section is active") unless $self->current_section; $self->current_section->finalize; $self->_between_sections(1); } #pod =method change_section #pod #pod $assembler->change_section($package_moniker, $name); #pod #pod $assembler->change_section($package_moniker); #pod #pod This method calls C, first calling C if needed. #pod #pod =cut sub change_section { my $self = shift; $self->end_section if $self->current_section; $self->begin_section(@_); } #pod =method add_value #pod #pod $assembler->add_value( $name => $value ); #pod #pod This method tells the assembler that it has encountered a named value and #pod should add it to the current section. If there is no current section, an #pod exception is raised. (If this is not the first time we've seen the name in the #pod section and it's not a multivalue property, the section class will raise an #pod exception on its own.) #pod #pod =cut sub add_value { my ($self, $name, $value) = @_; Config::MVP::Error->throw("can't set value when no section is active") unless my $section = $self->current_section; $section->add_value($name => $value); } #pod =method expand_package #pod #pod This method is passed a short identifier for a package and is expected to #pod return the full name of the module to load and package to interrogate. By #pod default it simply returns the name it was passed, meaning that package names #pod must be given whole to the C method. #pod #pod =cut sub expand_package { $_[1] } #pod =method current_section #pod #pod This returns the section object onto which the assembler is currently adding #pod values. If no section has yet been created, this method will return false. #pod #pod =cut sub current_section { my ($self) = @_; return if $self->_between_sections; my (@sections) = $self->sequence->sections; return $sections[ -1 ] if @sections; return; } no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Assembler - multivalue-property config-loading state machine =head1 VERSION version 2.200013 =head1 DESCRIPTION First, you should probably read the L. If you already know how it works, keep going. Config::MVP::Assembler is a helper for constructing a Config::MVP::Sequence object. It's a very simple state machine that lets you signal what kind of events you've encountered while reading configuration. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 ATTRIBUTES =head2 sequence_class This attribute stores the name of the class to be used for the assembler's sequence. It defaults to Config::MVP::Sequence. =head2 section_class This attribute stores the name of the class to be used for sections created by the assembler. It defaults to Config::MVP::Section. =head2 sequence This is the sequence that the assembler is assembling. It defaults to a new instance of the assembler's C. =head1 METHODS =head2 begin_section $assembler->begin_section($package_moniker, $name); $assembler->begin_section($package_moniker); $assembler->begin_section( \$package ); This method tells the assembler that it should begin work on a new section with the given identifier. If it is already working on a section, an error will be raised. See C> for a method to begin a new section, ending the current one if needed. The package moniker is expanded by the C> method. The name, if not given, defaults to the package moniker. These data are used to create a new section and the section is added to the end of the sequence. If the package argument is a reference, it is used as the literal value for the package, and no expansion is performed. If it is a reference to undef, a section with no package is created. =head2 end_section $assembler->end_section; This ends the current section. If there is no current section, an exception is raised. =head2 change_section $assembler->change_section($package_moniker, $name); $assembler->change_section($package_moniker); This method calls C, first calling C if needed. =head2 add_value $assembler->add_value( $name => $value ); This method tells the assembler that it has encountered a named value and should add it to the current section. If there is no current section, an exception is raised. (If this is not the first time we've seen the name in the section and it's not a multivalue property, the section class will raise an exception on its own.) =head2 expand_package This method is passed a short identifier for a package and is expected to return the full name of the module to load and package to interrogate. By default it simply returns the name it was passed, meaning that package names must be given whole to the C method. =head2 current_section This returns the section object onto which the assembler is currently adding values. If no section has yet been created, this method will return false. =head1 TYPICAL USE my $assembler = Config::MVP::Assembler->new; # Maybe you want a starting section: my $starting_section = $assembler->section_class->new({ name => '_' }); $assembler->sequence->add_section($section_starting); # We'll add some values, which will go to the starting section: $assembler->add_value(x => 10); $assembler->add_value(y => 20); # Change to a new section... $assembler->change_section($moniker); # ...and add values to that section. $assembler->add_value(x => 100); $assembler->add_value(y => 200); The code above creates an assembler and populates it step by step. In the end, to get values, you could do something like this: my @output; for my $section ($assembler->sequence->sections) { push @output, [ $section->name, $section->package, $section->payload ]; } When changing sections, the given section "moniker" is used for the new section name. The result of passing that moniker to the assembler's C> method is used as the section's package name. (By default, this method does nothing.) The new section's C and C are determined by calling the C and C methods on the package. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Section.pm000644 000765 000024 00000026160 14354101747 020303 0ustar00rjbsstaff000000 000000 package Config::MVP::Section 2.200013; # ABSTRACT: one section of an MVP configuration sequence use Moose 0.91; use Class::Load 0.17 (); use Config::MVP::Error; #pod =head1 DESCRIPTION #pod #pod For the most part, you can just consult L to understand what this #pod class is and how it's used. #pod #pod =attr name #pod #pod This is the section's name. It's a string, and it must be provided. #pod #pod =cut has name => ( is => 'ro', isa => 'Str', required => 1 ); #pod =attr package #pod #pod This is the (Perl) package with which the section is associated. It is #pod optional. When the section is instantiated, it will ensure that this package #pod is loaded. #pod #pod =cut has package => ( is => 'ro', isa => 'Str', # should be class-like string, but can't be ClassName required => 0, predicate => 'has_package', ); #pod =attr multivalue_args #pod #pod This attribute is an arrayref of value names that should be considered #pod multivalue properties in the section. When added to the section, they will #pod always be wrapped in an arrayref, and they may be added to the section more #pod than once. #pod #pod If this attribute is not given during construction, it will default to the #pod result of calling section's package's C method. If the #pod section has no associated package or if the package doesn't provide that #pod method, it default to an empty arrayref. #pod #pod =cut has multivalue_args => ( is => 'ro', isa => 'ArrayRef', lazy => 1, default => sub { my ($self) = @_; return [] unless $self->has_package and $self->package->can('mvp_multivalue_args'); return [ $self->package->mvp_multivalue_args ]; }, ); #pod =attr aliases #pod #pod This attribute is a hashref of name remappings. For example, if it contains #pod this hashref: #pod #pod { #pod file => 'files', #pod path => 'files', #pod } #pod #pod Then attempting to set either the "file" or "path" setting for the section #pod would actually set the "files" setting. #pod #pod If this attribute is not given during construction, it will default to the #pod result of calling section's package's C method. If the #pod section has no associated package or if the package doesn't provide that #pod method, it default to an empty hashref. #pod #pod =cut has aliases => ( is => 'ro', isa => 'HashRef', lazy => 1, default => sub { my ($self) = @_; return {} unless $self->has_package and $self->package->can('mvp_aliases'); return $self->package->mvp_aliases; }, ); #pod =attr payload #pod #pod This is the storage into which properties are set. It is a hashref of names #pod and values. You should probably not alter the contents of the payload, and #pod should read its contents only. #pod #pod =cut has payload => ( is => 'ro', isa => 'HashRef', init_arg => undef, default => sub { {} }, ); #pod =attr is_finalized #pod #pod This attribute is true if the section has been marked finalized, which will #pod prevent any new values from being added to it. It can be set with the #pod C method. #pod #pod =cut has is_finalized => ( is => 'ro', isa => 'Bool', traits => [ 'Bool' ], init_arg => undef, default => 0, handles => { finalize => 'set' }, ); before finalize => sub { my ($self) = @_; Config::MVP::Error->throw("can't finalize unsequenced Config::MVP::Section") unless $self->sequence; }; #pod =attr sequence #pod #pod This attributes points to the sequence into which the section has been #pod assembled. It may be unset if the section has been created but not yet placed #pod in a sequence. #pod #pod =cut has sequence => ( is => 'ro', isa => 'Config::MVP::Sequence', weak_ref => 1, predicate => '_sequence_has_been_set', reader => '_sequence', writer => '__set_sequence', clearer => '_clear_sequence', ); sub _set_sequence { my ($self, $seq) = @_; Config::MVP::Error->throw("Config::MVP::Section cannot be resequenced") if $self->sequence; $self->__set_sequence($seq); } sub sequence { my ($self) = @_; return undef unless $self->_sequence_has_been_set; my $seq = $self->_sequence; Config::MVP::Error->throw("can't access section's destroyed sequence") unless defined $seq; return $seq; } #pod =method add_value #pod #pod $section->add_value( $name => $value ); #pod #pod This method sets the value for the named property to the given value. If the #pod property is a multivalue property, the new value will be pushed onto the end of #pod an arrayref that will store all values for that property. #pod #pod Attempting to add a value for a non-multivalue property whose value was already #pod added will result in an exception. #pod #pod =cut sub add_value { my ($self, $name, $value) = @_; confess "can't add values to finalized section " . $self->name if $self->is_finalized; my $alias = $self->aliases->{ $name }; $name = $alias if defined $alias; my $mva = $self->multivalue_args; if (grep { $_ eq $name } @$mva) { my $array = $self->payload->{$name} ||= []; push @$array, $value; return; } if (exists $self->payload->{$name}) { Carp::croak "multiple values given for property $name in section " . $self->name; } $self->payload->{$name} = $value; } #pod =method load_package #pod #pod $section->load_package($package, $section_name); #pod #pod This method is used to ensure that the given C<$package> is loaded, and is #pod called whenever a section with a package is created. By default, it delegates #pod to L. If the package can't be found, it calls the #pod L method. Errors in compilation are not suppressed. #pod #pod =cut sub load_package { my ($self, $package, $section_name) = @_; Class::Load::load_optional_class($package) or $self->missing_package($package, $section_name); } #pod =method missing_package #pod #pod $section->missing_package($package, $section_name); #pod #pod This method is called when C encounters a package that is not #pod installed. By default, it throws an exception. #pod #pod =cut sub missing_package { my ($self, $package, $section_name) = @_ ; my $class = Moose::Meta::Class->create_anon_class( superclasses => [ 'Config::MVP::Error' ], cached => 1, attributes => [ Moose::Meta::Attribute->new(package => ( is => 'ro', required => 1, )), Moose::Meta::Attribute->new(section_name => ( is => 'ro', required => 1, )), ], ); $class->name->throw({ ident => 'package not installed', message => "$package (for section $section_name) does not appear to be installed", package => $package, section_name => $section_name, }); } sub _BUILD_package_settings { my ($self) = @_; return unless defined (my $pkg = $self->package); confess "illegal package name $pkg" unless Params::Util::_CLASS($pkg); $self->load_package($pkg, $self->name); # We call these accessors for lazy attrs to ensure they're initialized from # defaults if needed. Crash early! -- rjbs, 2009-08-09 $self->multivalue_args; $self->aliases; } sub BUILD { my ($self) = @_; $self->_BUILD_package_settings; } no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Section - one section of an MVP configuration sequence =head1 VERSION version 2.200013 =head1 DESCRIPTION For the most part, you can just consult L to understand what this class is and how it's used. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 ATTRIBUTES =head2 name This is the section's name. It's a string, and it must be provided. =head2 package This is the (Perl) package with which the section is associated. It is optional. When the section is instantiated, it will ensure that this package is loaded. =head2 multivalue_args This attribute is an arrayref of value names that should be considered multivalue properties in the section. When added to the section, they will always be wrapped in an arrayref, and they may be added to the section more than once. If this attribute is not given during construction, it will default to the result of calling section's package's C method. If the section has no associated package or if the package doesn't provide that method, it default to an empty arrayref. =head2 aliases This attribute is a hashref of name remappings. For example, if it contains this hashref: { file => 'files', path => 'files', } Then attempting to set either the "file" or "path" setting for the section would actually set the "files" setting. If this attribute is not given during construction, it will default to the result of calling section's package's C method. If the section has no associated package or if the package doesn't provide that method, it default to an empty hashref. =head2 payload This is the storage into which properties are set. It is a hashref of names and values. You should probably not alter the contents of the payload, and should read its contents only. =head2 is_finalized This attribute is true if the section has been marked finalized, which will prevent any new values from being added to it. It can be set with the C method. =head2 sequence This attributes points to the sequence into which the section has been assembled. It may be unset if the section has been created but not yet placed in a sequence. =head1 METHODS =head2 add_value $section->add_value( $name => $value ); This method sets the value for the named property to the given value. If the property is a multivalue property, the new value will be pushed onto the end of an arrayref that will store all values for that property. Attempting to add a value for a non-multivalue property whose value was already added will result in an exception. =head2 load_package $section->load_package($package, $section_name); This method is used to ensure that the given C<$package> is loaded, and is called whenever a section with a package is created. By default, it delegates to L. If the package can't be found, it calls the L method. Errors in compilation are not suppressed. =head2 missing_package $section->missing_package($package, $section_name); This method is called when C encounters a package that is not installed. By default, it throws an exception. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader.pm000644 000765 000024 00000015205 14354101747 020077 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader 2.200013; # ABSTRACT: object to read config from storage into an assembler use Moose; use Config::MVP::Assembler; use Cwd (); #pod =head1 SYNOPSIS #pod #pod use Config::MVP::Reader::YAML; # this doesn't really exist #pod #pod my $reader = Config::MVP::Reader::YAML->new; #pod #pod my $sequence = $reader->read_config('/etc/foobar.yml'); #pod #pod =head1 DESCRIPTION #pod #pod A Config::MVP::Reader exists to read configuration data from storage (like a #pod file) and convert that data into instructions to a L, #pod which will in turn convert them into a L, the final #pod product. #pod #pod =attr add_cwd_to_lib #pod #pod If true (which it is by default) then the current working directly will be #pod locally added to C<@INC> during config loading. This helps deal with changes #pod made in Perl v5.26.1. #pod #pod =cut has add_cwd_to_lib => ( is => 'ro', isa => 'Bool', default => 1, ); #pod =method read_config #pod #pod my $sequence = $reader->read_config($location, \%arg); #pod #pod This method is passed a location, which has no set meaning, but should be the #pod mechanism by which the Reader is told how to locate configuration. It might be #pod a file name, a hashref of parameters, a DBH, or anything else, depending on the #pod needs of the specific Reader subclass. #pod #pod It is also passed a hashref of arguments, of which there is only one valid #pod argument: #pod #pod assembler - the Assembler object into which to read the config #pod #pod If no assembler argument is passed, one will be constructed by calling the #pod Reader's C method. #pod #pod Subclasses should generally not override C, but should instead #pod implement a C method, described below. If a subclass #pod I override C it should take care to respect the #pod C attribute, above. #pod #pod =cut sub read_config { my ($self, $location, $arg) = @_; $arg ||= {}; $self = $self->new unless blessed $self; my $assembler = $arg->{assembler} || $self->build_assembler; { local @INC = @INC; if ($self->add_cwd_to_lib) { my $cwd = Cwd::getcwd(); push @INC, $cwd unless grep {; $_ eq $cwd } @INC; } $self->read_into_assembler($location, $assembler); } return $assembler->sequence; } #pod =method read_into_assembler #pod #pod This method should not be called directly. It is called by C with #pod the following parameters: #pod #pod my $sequence = $reader->read_into_assembler( $location, $assembler ); #pod #pod The method should read the configuration found at C<$location> and use it to #pod instruct the C<$assembler> (a L) what configuration to #pod perform. #pod #pod The default implementation of this method will throw an exception complaining #pod that it should have been implemented by a subclass. #pod #pod =cut sub read_into_assembler { confess 'required method read_into_assembler unimplemented' } #pod =method build_assembler #pod #pod If no Assembler is provided to C's C parameter, this #pod method will be called on the Reader to construct one. #pod #pod It must return a Config::MVP::Assembler object, and by default will return an #pod entirely generic one. #pod #pod =cut sub build_assembler { Config::MVP::Assembler->new; } no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Reader - object to read config from storage into an assembler =head1 VERSION version 2.200013 =head1 SYNOPSIS use Config::MVP::Reader::YAML; # this doesn't really exist my $reader = Config::MVP::Reader::YAML->new; my $sequence = $reader->read_config('/etc/foobar.yml'); =head1 DESCRIPTION A Config::MVP::Reader exists to read configuration data from storage (like a file) and convert that data into instructions to a L, which will in turn convert them into a L, the final product. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 ATTRIBUTES =head2 add_cwd_to_lib If true (which it is by default) then the current working directly will be locally added to C<@INC> during config loading. This helps deal with changes made in Perl v5.26.1. =head1 METHODS =head2 read_config my $sequence = $reader->read_config($location, \%arg); This method is passed a location, which has no set meaning, but should be the mechanism by which the Reader is told how to locate configuration. It might be a file name, a hashref of parameters, a DBH, or anything else, depending on the needs of the specific Reader subclass. It is also passed a hashref of arguments, of which there is only one valid argument: assembler - the Assembler object into which to read the config If no assembler argument is passed, one will be constructed by calling the Reader's C method. Subclasses should generally not override C, but should instead implement a C method, described below. If a subclass I override C it should take care to respect the C attribute, above. =head2 read_into_assembler This method should not be called directly. It is called by C with the following parameters: my $sequence = $reader->read_into_assembler( $location, $assembler ); The method should read the configuration found at C<$location> and use it to instruct the C<$assembler> (a L) what configuration to perform. The default implementation of this method will throw an exception complaining that it should have been implemented by a subclass. =head2 build_assembler If no Assembler is provided to C's C parameter, this method will be called on the Reader to construct one. It must return a Config::MVP::Assembler object, and by default will return an entirely generic one. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Assembler/WithBundles.pm000644 000765 000024 00000017226 14354101747 023047 0ustar00rjbsstaff000000 000000 package Config::MVP::Assembler::WithBundles 2.200013; # ABSTRACT: a role to make assemblers expand bundles use Moose::Role; use Params::Util qw(_HASHLIKE _ARRAYLIKE); use Class::Load 0.17 (); #pod =head1 DESCRIPTION #pod #pod Config::MVP::Assembler::WithBundles is a role to be composed into a #pod Config::MVP::Assembler subclass. It allows some sections of configuration to #pod be treated as bundles. When any section is ended, if that section represented #pod a bundle, its bundle contents will be unrolled and will replace it in the #pod sequence. #pod #pod A package is considered a bundle if C returns a #pod defined value (which is the name of a method that will be called on #pod that package to retrieve its bundle config). #pod #pod my $method = $assembler->package_bundle_method($package); #pod #pod The default implementation looks for a method called C, but #pod C can be replaced with one that returns the name of a #pod different bundle-identifying method-name. #pod #pod Bundles are expanded by a call to the assembler's #pod C method, like this: #pod #pod $assembler->replace_bundle_with_contents($section, $method); #pod #pod =head2 replace_bundle_with_contents #pod #pod The default C method deletes the section from the #pod sequence. It then gets a description of the new sections to introduce, like #pod this: #pod #pod my @new_config = $bundle_section->package->$method({ #pod name => $bundle_section->name, #pod package => $bundle_section->package, #pod payload => $bundle_section->payload, #pod }); #pod #pod (We pass a hashref rather than a section so that bundles can be expanded #pod synthetically without having to laboriously create a new Section.) #pod #pod The returned C<@new_config> is a list of arrayrefs, each of which has three #pod entries: #pod #pod [ $name, $package, $payload ] #pod #pod Each arrayref is converted into a section in the sequence. The C<$payload> #pod should be an arrayref of name/value pairs to be added to the created section. #pod #pod =cut sub package_bundle_method { my ($self, $pkg) = @_; return unless $pkg->can('mvp_bundle_config'); return 'mvp_bundle_config'; } after end_section => sub { my ($self) = @_; my $seq = $self->sequence; my ($last) = ($seq->sections)[-1]; return unless $last->package; return unless my $method = $self->package_bundle_method($last->package); $self->replace_bundle_with_contents($last, $method); }; sub replace_bundle_with_contents { my ($self, $bundle_sec, $method) = @_; my $seq = $self->sequence; $seq->delete_section($bundle_sec->name); $self->_add_bundle_contents($method, { name => $bundle_sec->name, package => $bundle_sec->package, payload => $bundle_sec->payload, }); }; sub load_package { my ($self, $package, $section_name) = @_; Class::Load::load_optional_class($package) or $self->missing_package($package, $section_name); } sub missing_package { my ($self, $package, $section_name) = @_ ; my $class = Moose::Meta::Class->create_anon_class( superclasses => [ 'Config::MVP::Error' ], cached => 1, attributes => [ Moose::Meta::Attribute->new(package => ( is => 'ro', required => 1, )), Moose::Meta::Attribute->new(section_name => ( is => 'ro', required => 1, )), ], ); $class->name->throw({ ident => 'package not installed', message => "$package (for section $section_name) does not appear to be installed", package => $package, section_name => $section_name, }); } sub _add_bundle_contents { my ($self, $method, $arg) = @_; my @bundle_config = $arg->{package}->$method($arg); PLUGIN: for my $plugin (@bundle_config) { my ($name, $package, $payload) = @$plugin; $self->load_package($package, $name); if (my $method = $self->package_bundle_method( $package )) { $self->_add_bundle_contents($method, { name => $name, package => $package, payload => $payload, }); } else { my $section = $self->section_class->new({ name => $name, package => $package, }); if (_HASHLIKE($payload)) { # XXX: Clearly this is a hack. -- rjbs, 2009-08-24 for my $name (keys %$payload) { my @v = ref $payload->{$name} eq ref [] ? @{$payload->{$name}} : $payload->{$name}; Carp::confess("got impossible zero-value <$name> key") unless @v; $section->add_value($name => $_) for @v; } } elsif (_ARRAYLIKE($payload)) { for (my $i = 0; $i < @$payload; $i += 2) { $section->add_value(@$payload[ $i, $i + 1 ]); } } else { Carp::confess("don't know how to interpret section payload $payload"); } $self->sequence->add_section($section); $section->finalize; } } } no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Assembler::WithBundles - a role to make assemblers expand bundles =head1 VERSION version 2.200013 =head1 DESCRIPTION Config::MVP::Assembler::WithBundles is a role to be composed into a Config::MVP::Assembler subclass. It allows some sections of configuration to be treated as bundles. When any section is ended, if that section represented a bundle, its bundle contents will be unrolled and will replace it in the sequence. A package is considered a bundle if C returns a defined value (which is the name of a method that will be called on that package to retrieve its bundle config). my $method = $assembler->package_bundle_method($package); The default implementation looks for a method called C, but C can be replaced with one that returns the name of a different bundle-identifying method-name. Bundles are expanded by a call to the assembler's C method, like this: $assembler->replace_bundle_with_contents($section, $method); =head2 replace_bundle_with_contents The default C method deletes the section from the sequence. It then gets a description of the new sections to introduce, like this: my @new_config = $bundle_section->package->$method({ name => $bundle_section->name, package => $bundle_section->package, payload => $bundle_section->payload, }); (We pass a hashref rather than a section so that bundles can be expanded synthetically without having to laboriously create a new Section.) The returned C<@new_config> is a list of arrayrefs, each of which has three entries: [ $name, $package, $payload ] Each arrayref is converted into a section in the sequence. The C<$payload> should be an arrayref of name/value pairs to be added to the created section. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader/Finder.pm000644 000765 000024 00000012534 14354101747 021310 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader::Finder 2.200013; # ABSTRACT: a reader that finds an appropriate file use Moose; extends 'Config::MVP::Reader'; #pod =head1 DESCRIPTION #pod #pod The Finder reader multiplexes many other readers that implement the #pod L role. It uses L to search #pod for modules, limits them to objects implementing the Findable role, and then #pod selects the those which report that they are able to read a configuration file #pod found in the config root directory. If exactly one findable configuration #pod reader finds a file, it is used to read the file and the configuration sequence #pod is returned. Otherwise, an exception is raised. #pod #pod Config::MVP::Reader::Finder's C method will decline a new #pod assembler, so if none was passed to C, the Findable reader to #pod which reading is delegated will be responsible for building the assembler, #pod unless a Finder subclass overrides C to set a default across #pod all possible delegates. #pod #pod =cut use Config::MVP::Error; use Module::Pluggable::Object; use Try::Tiny; #pod =method default_search_path #pod #pod This is the default search path used to find configuration readers. This #pod method should return a list, and by default returns: #pod #pod qw( Config::MVP::Reader ) #pod #pod =cut sub default_search_path { return qw(Config::MVP::Reader) } our @DONT_FIND; has _module_pluggable_object => ( is => 'ro', init_arg => undef, default => sub { my ($self) = @_; Module::Pluggable::Object->new( search_path => [ $self->default_search_path ], inner => 0, require => 1, # This facility here entirely for testing. -- rjbs, 2014-07-02 except => \@DONT_FIND, ); }, ); sub _which_reader { my ($self, $location) = @_; my @options; for my $pkg ($self->_module_pluggable_object->plugins) { next unless $pkg->isa('Moose::Object'); next unless $pkg->does('Config::MVP::Reader::Findable'); my $location = $pkg->refined_location($location); next unless defined $location; push @options, [ $pkg, $location ]; } Config::MVP::Error->throw("no viable configuration could be found") unless @options; # XXX: Improve this error message -- rjbs, 2010-05-24 Config::MVP::Error->throw("multiple possible config plugins found") if @options > 1; return { 'package' => $options[0][0], 'location' => $options[0][1], }; } has if_none => ( is => 'ro', isa => 'Maybe[Str|CodeRef]', ); sub read_config { my ($self, $location, $arg) = @_; $self = $self->new unless blessed($self); $arg ||= {}; local $arg->{assembler} = $arg->{assembler} || $self->build_assembler; my $which; my $instead; try { $which = $self->_which_reader($location); } catch { die $_ unless $_ =~ /^no viable configuration/; die $_ unless defined (my $handler = $self->if_none); $instead = $self->$handler($location, $arg); }; return $instead unless $which; my $reader = $which->{package}->new({ add_cwd_to_lib => $self->add_cwd_to_lib, }); return $reader->read_config( $which->{location}, $arg ); } sub build_assembler { } sub read_into_assembler { confess "This method should never be called or reachable"; } no Moose; __PACKAGE__->meta->make_immutable; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Reader::Finder - a reader that finds an appropriate file =head1 VERSION version 2.200013 =head1 DESCRIPTION The Finder reader multiplexes many other readers that implement the L role. It uses L to search for modules, limits them to objects implementing the Findable role, and then selects the those which report that they are able to read a configuration file found in the config root directory. If exactly one findable configuration reader finds a file, it is used to read the file and the configuration sequence is returned. Otherwise, an exception is raised. Config::MVP::Reader::Finder's C method will decline a new assembler, so if none was passed to C, the Findable reader to which reading is delegated will be responsible for building the assembler, unless a Finder subclass overrides C to set a default across all possible delegates. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 =head2 default_search_path This is the default search path used to find configuration readers. This method should return a list, and by default returns: qw( Config::MVP::Reader ) =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader/Findable.pm000644 000765 000024 00000004601 14354101747 021601 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader::Findable 2.200013; # ABSTRACT: a config class that Config::MVP::Reader::Finder can find use Moose::Role; #pod =head1 DESCRIPTION #pod #pod Config::MVP::Reader::Findable is a role meant to be composed alongside #pod Config::MVP::Reader. #pod #pod =method refined_location #pod #pod This method is used to decide whether a Findable reader can read a specific #pod thing under the C<$location> argument passed to C. The location #pod could be a directory or base file name or dbh or almost anything else. This #pod method will return false if it can't find anything to read. If it can find #pod something to read, it will return a new (or unchanged) value for C<$location> #pod to be used in reading the config. #pod #pod =cut requires 'refined_location'; no Moose::Role; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Reader::Findable - a config class that Config::MVP::Reader::Finder can find =head1 VERSION version 2.200013 =head1 DESCRIPTION Config::MVP::Reader::Findable is a role meant to be composed alongside Config::MVP::Reader. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 =head2 refined_location This method is used to decide whether a Findable reader can read a specific thing under the C<$location> argument passed to C. The location could be a directory or base file name or dbh or almost anything else. This method will return false if it can't find anything to read. If it can find something to read, it will return a new (or unchanged) value for C<$location> to be used in reading the config. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader/Hash.pm000644 000765 000024 00000005527 14354101747 020770 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader::Hash 2.200013; # ABSTRACT: a reader that tries to cope with a plain old hashref use Moose; extends 'Config::MVP::Reader'; #pod =head1 SYNOPSIS #pod #pod my $sequence = Config::MVP::Reader::Hash->new->read_config( \%config ); #pod #pod =head1 DESCRIPTION #pod #pod In some ways, this is the L of last resort. Given a #pod hashref, it attempts to interpret it as a Config::MVP::Sequence. Because #pod hashes are generally unordered, order can't be relied upon unless the hash tied #pod to have order (presumably with L). The hash keys are assumed to #pod be section names and will be used as the section package moniker unless a #pod L<__package> entry is found. #pod #pod =cut sub read_into_assembler { my ($self, $location, $assembler) = @_; confess "no hash given to $self" unless my $hash = $location; for my $name (keys %$hash) { my $payload = { %{ $hash->{ $name } } }; my $package = delete($payload->{__package}) || $name; $assembler->begin_section($package, $name); for my $key (%$payload) { my $val = $payload->{ $key }; my @values = ref $val ? @$val : $val; $assembler->add_value($key => $_) for @values; } $assembler->end_section; } return $assembler->sequence; } no Moose; __PACKAGE__->meta->make_immutable; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Reader::Hash - a reader that tries to cope with a plain old hashref =head1 VERSION version 2.200013 =head1 SYNOPSIS my $sequence = Config::MVP::Reader::Hash->new->read_config( \%config ); =head1 DESCRIPTION In some ways, this is the L of last resort. Given a hashref, it attempts to interpret it as a Config::MVP::Sequence. Because hashes are generally unordered, order can't be relied upon unless the hash tied to have order (presumably with L). The hash keys are assumed to be section names and will be used as the section package moniker unless a L<__package> entry is found. =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/lib/Config/MVP/Reader/Findable/000755 000765 000024 00000000000 14354101747 021242 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/lib/Config/MVP/Reader/Findable/ByExtension.pm000644 000765 000024 00000006061 14354101747 024052 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader::Findable::ByExtension 2.200013; # ABSTRACT: a Findable Reader that looks for files by extension use Moose::Role; with qw(Config::MVP::Reader::Findable); use File::Spec; #pod =method default_extension #pod #pod This method, B, returns #pod the default extension used by files in the format this reader can read. #pod #pod When the Finder tries to find configuration, it have a directory root and a #pod basename. Each (Findable) reader that it tries in turn will look for a file #pod F in the root directory. If exactly one file is found, #pod that file is read. #pod #pod =cut requires 'default_extension'; #pod =method refined_location #pod #pod This role provides a default implementation of the #pod L|Config::MVP::Reader::Findable/refined_location> method #pod required by Config::MVP::Reader. It will return a filename based on the #pod original location, if a file exists matching that location plus the reader's #pod C. #pod #pod =cut sub refined_location { my ($self, $location) = @_; my $candidate_name = "$location." . $self->default_extension; return unless -r $candidate_name and -f _; return $candidate_name; } no Moose::Role; 1; __END__ =pod =encoding UTF-8 =head1 NAME Config::MVP::Reader::Findable::ByExtension - a Findable Reader that looks for files by extension =head1 VERSION version 2.200013 =head1 PERL VERSION This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.) 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 =head2 default_extension This method, B, returns the default extension used by files in the format this reader can read. When the Finder tries to find configuration, it have a directory root and a basename. Each (Findable) reader that it tries in turn will look for a file F in the root directory. If exactly one file is found, that file is read. =head2 refined_location This role provides a default implementation of the L|Config::MVP::Reader::Findable/refined_location> method required by Config::MVP::Reader. It will return a filename based on the original location, if a file exists matching that location plus the reader's C. =head1 AUTHOR Ricardo Signes =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2022 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-MVP-2.200013/xt/author/000755 000765 000024 00000000000 14354101747 015654 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/xt/release/000755 000765 000024 00000000000 14354101747 015772 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/xt/release/changes_has_content.t000644 000765 000024 00000002104 14354101747 022151 0ustar00rjbsstaff000000 000000 use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '2.200013'; 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-MVP-2.200013/xt/author/pod-syntax.t000644 000765 000024 00000000252 14354101747 020146 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-MVP-2.200013/t/reader.t000644 000765 000024 00000002630 14354101747 015612 0ustar00rjbsstaff000000 000000 use strict; use warnings; { no warnings 'once'; @Config::MVP::Reader::Finder::DONT_FIND = qw( Config::MVP::Reader::INI ); } use Test::More; use lib 't/lib'; { package CMRFBA; use Moose; extends 'Config::MVP::Assembler'; with 'Config::MVP::Assembler::WithBundles'; } { package CMRFB; use Moose; extends 'Config::MVP::Reader::Finder'; sub build_assembler { CMRFBA->new; } } my $config = CMRFB->read_config('t/eg/config'); my @sections = $config->sections; is(@sections, 7, "there are seven sections"); my ($bar, $baz, $b_1, $b_2, $b_b, $b_3, $quux) = @sections; is($bar->name, 'Foo::Bar', '1st is Foo::Bar (name)'); is($bar->package, 'Foo::Bar', '1st is Foo::Bar (pkg)'); is($baz->name, 'bz', '2nd is bz (name)'); is($baz->package, 'Foo::Baz', '2nd is Foo::Baz (pkg)'); is($b_1->name, 'boondle_1', '2nd is boondle_1 (name)'); is($b_1->package, 'Foo::Boo1', '2nd is Foo::Boo1 (pkg)'); is($b_2->name, 'boondle_2', '2nd is boondle_2 (name)'); is($b_2->package, 'Foo::Boo2', '2nd is Foo::Boo2 (pkg)'); is($b_b->name, 'boondle_B', '3nd is boondle_B (name)'); is($b_b->package, 'Foo::Bar', '3nd is Foo::Bar (pkg)'); is($b_3->name, 'boondle_3', '4th is boondle_3 (name)'); is($b_3->package, 'Foo::Boo2', '4th is Foo::Boo2 (pkg)'); is($quux->name, 'Foo::Quux', '5th is Foo::Quux (name)'); is($quux->package, 'Foo::Quux', '5th is Foo::Quux (pkg)'); done_testing; Config-MVP-2.200013/t/basic.t000644 000765 000024 00000003142 14354101747 015430 0ustar00rjbsstaff000000 000000 #!perl use strict; use warnings; use lib 't/lib'; use Test::More; use Test::Fatal; require_ok( 'Config::MVP::Assembler' ); my $assembler = Config::MVP::Assembler->new; my $section = Config::MVP::Section->new({ name => '_', }); $assembler->sequence->add_section($section); $assembler->add_value(foo => 10); $assembler->add_value(bar => 11); $assembler->change_section('Foo::Bar'); $assembler->add_value(x => 10); $assembler->add_value(y => 20); $assembler->add_value(y => 30); $assembler->add_value(z => -123); $assembler->change_section('Foo::Bar', 'baz'); $assembler->add_value(x => 1); $assembler->finalize; my @sections = $assembler->sequence->sections; is(@sections, 3, "there are three sections"); is($sections[0]->name, '_'); is($sections[1]->name, 'Foo::Bar'); is($sections[2]->name, 'baz'); is($sections[0]->package, undef); is($sections[1]->package, 'Foo::Bar'); is($sections[2]->package, 'Foo::Bar'); is_deeply($sections[0]->payload, { bar => 11, foo => 10 }); is_deeply($sections[1]->payload, { x => 10, y => [ 20, 30 ], z => -123 }); is_deeply($sections[2]->payload, { x => 1 }); { my $assembler = Config::MVP::Assembler->new; my $err = exception { $assembler->change_section('Foo::CompileError'); }; like($err, qr/"\$x"/, "strict failures are propagated"); } { my $assembler = Config::MVP::Assembler->new; my $err = exception { $assembler->change_section('Foo::Missing'); }; is( $err->ident, 'package not installed', "we get a well-identifier 'not installed' exception", ); is( $err->package, 'Foo::Missing', 'and we stored the package', ); } done_testing; Config-MVP-2.200013/t/final-hooks.t000644 000765 000024 00000002353 14354101747 016564 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Test::More; use lib 't/lib'; { package FAsm; use Moose; extends 'Config::MVP::Assembler'; has notes => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has '+section_class' => (default => 'FAsm::Sec'); } { package FAsm::Sec; use Moose; extends 'Config::MVP::Section'; my $i = 0; after finalize => sub { my ($self) = @_; push @{ $self->sequence->assembler->notes }, [ $self->name, $i++ ]; }; } my $asm = FAsm->new; # I wish I had an existing simple way to say "just a name, no package" here. # -- rjbs, 2010-05-11 $asm->begin_section(strict => 'S1'); $asm->add_value(foo => 10); is_deeply($asm->notes, [], "no notes to start with"); $asm->change_section(strict => 'S2'); is_deeply($asm->notes, [ [ S1 => 0 ] ], "finalize one section, get notes!"); $asm->end_section; $asm->change_section(strict => 'S3'); is_deeply( $asm->notes, [ [ S1 => 0 ], [ S2 => 1 ], ], "ending section is as good as changing", ); $asm->change_section(strict => 'S4'); $asm->finalize; is_deeply( $asm->notes, [ [ S1 => 0 ], [ S2 => 1 ], [ S3 => 2 ], [ S4 => 3 ], ], "finalize the assembler after more sections, more notes!" ); done_testing; Config-MVP-2.200013/t/00-report-prereqs.t000644 000765 000024 00000013452 14354101747 017563 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-MVP-2.200013/t/lib/000755 000765 000024 00000000000 14354101747 014730 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/00-report-prereqs.dd000644 000765 000024 00000004563 14354101747 017712 0ustar00rjbsstaff000000 000000 do { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '6.78' } }, 'develop' => { 'requires' => { 'Encode' => '0', 'Test::More' => '0', 'Test::Pod' => '1.41' } }, 'runtime' => { 'requires' => { 'Class::Load' => '0.17', 'Cwd' => '0', 'File::Spec' => '0', 'Module::Pluggable::Object' => '0', 'Moose' => '0.91', 'Moose::Role' => '0', 'Moose::Util::TypeConstraints' => '0', 'MooseX::OneArgNew' => '0', 'Params::Util' => '0', 'Role::HasMessage' => '0', 'Role::Identifiable::HasIdent' => '0', 'StackTrace::Auto' => '0', 'Test::More' => '0.96', 'Throwable' => '0', 'Tie::IxHash' => '0', 'Try::Tiny' => '0', 'overload' => '0', 'perl' => '5.012', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::Fatal' => '0', 'Test::More' => '0.96', 'lib' => '0' } } }; $x; }Config-MVP-2.200013/t/eg/000755 000765 000024 00000000000 14354101747 014555 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/hash.t000644 000765 000024 00000004303 14354101747 015272 0ustar00rjbsstaff000000 000000 use strict; use warnings; use Test::More; use lib 't/lib'; { package CMRFBA; use Moose; extends 'Config::MVP::Assembler'; with 'Config::MVP::Assembler::WithBundles'; } { package CMRFB; use Moose; extends 'Config::MVP::Reader::Hash'; sub build_assembler { CMRFBA->new; } } { my $config = CMRFB->new->read_config({ 'Foo::Bar' => { x => 1, y => [ 2, 4 ], z => 3, }, 'bz' => { __package => 'Foo::Baz', single => 1, multi => [ 2, 3 ], }, 'Foo::Metaboondle' => { }, 'Foo::Quux' => { a => 1, b => 2, c => 3, } }); my @sections = $config->sections; is(@sections, 7, "there are seven sections"); @sections = sort { lc $a->name cmp lc $b->name } @sections; my ($b_1, $b_2, $b_3, $b_b, $baz, $bar, $quux) = @sections; is($bar->name, 'Foo::Bar', '1st is Foo::Bar (name)'); is($bar->package, 'Foo::Bar', '1st is Foo::Bar (pkg)'); is($baz->name, 'bz', '2nd is bz (name)'); is($baz->package, 'Foo::Baz', '2nd is Foo::Baz (pkg)'); is($b_1->name, 'boondle_1', '2nd is boondle_1 (name)'); is($b_1->package, 'Foo::Boo1', '2nd is Foo::Boo1 (pkg)'); is($b_2->name, 'boondle_2', '2nd is boondle_2 (name)'); is($b_2->package, 'Foo::Boo2', '2nd is Foo::Boo2 (pkg)'); is($b_b->name, 'boondle_B', '3rd is boondle_B (name)'); is($b_b->package, 'Foo::Bar', '3rd is Foo::Bar (pkg)'); is($b_3->name, 'boondle_3', '4th is boondle_3 (name)'); is($b_3->package, 'Foo::Boo2', '4th is Foo::Boo2 (pkg)'); is($quux->name, 'Foo::Quux', '5th is Foo::Quux (name)'); is($quux->package, 'Foo::Quux', '5th is Foo::Quux (pkg)'); } { my $config = CMRFB->new->read_config({ 'Foo::BoondleHref' => { }, }); my @sections = $config->sections; is(@sections, 3, "we get 2 sections"); is_deeply( $sections[2]->payload, { y => [ 1, 2, 3 ] }, "boondle_B has expected contents", ); } { my $config = CMRFB->new->read_config({ 'Foo::BoondleHref' => { }, }); my @sections = $config->sections; is(@sections, 3, "we get 2 sections"); is_deeply( $sections[2]->payload, { y => [ 1, 2, 3 ] }, "boondle_B has expected contents", ); } done_testing; Config-MVP-2.200013/t/eg/config.mvp-test000644 000765 000024 00000000207 14354101747 017522 0ustar00rjbsstaff000000 000000 [Foo::Bar] x = 1 y = 2 z = 3 y = 4 [Foo::Baz bz] single = 1 multi = 2 multi = 3 [Foo::Metaboondle] [Foo::Quux] a = 1 b = 2 c = 3 Config-MVP-2.200013/t/lib/Config/000755 000765 000024 00000000000 14354101747 016135 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/lib/Foo/000755 000765 000024 00000000000 14354101747 015453 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/lib/Foo/Quux.pm000644 000765 000024 00000000026 14354101747 016751 0ustar00rjbsstaff000000 000000 package Foo::Quux; 1; Config-MVP-2.200013/t/lib/Foo/Boo1.pm000644 000765 000024 00000000026 14354101747 016607 0ustar00rjbsstaff000000 000000 package Foo::Boo1; 1; Config-MVP-2.200013/t/lib/Foo/Baz.pm000644 000765 000024 00000000074 14354101747 016526 0ustar00rjbsstaff000000 000000 package Foo::Baz; sub mvp_multivalue_args { qw(multi) } 1; Config-MVP-2.200013/t/lib/Foo/BoondleHref.pm000644 000765 000024 00000000335 14354101747 020201 0ustar00rjbsstaff000000 000000 package Foo::BoondleHref; sub mvp_bundle_config { return ( [ 'boondle_1', 'Foo::Boo1', { x => 1 } ], [ 'boondle_2', 'Foo::Boo2', { a => 0 } ], [ 'boondle_B', 'Foo::Bar', { y => [ 1, 2, 3 ] } ], ); } 1; Config-MVP-2.200013/t/lib/Foo/CompileError.pm000644 000765 000024 00000000063 14354101747 020412 0ustar00rjbsstaff000000 000000 use strict; package Foo::CompileError; $x = 10; 1; Config-MVP-2.200013/t/lib/Foo/Bar.pm000644 000765 000024 00000000067 14354101747 016520 0ustar00rjbsstaff000000 000000 package Foo::Bar; sub mvp_multivalue_args { qw(y) } 1; Config-MVP-2.200013/t/lib/Foo/Boondle.pm000644 000765 000024 00000000337 14354101747 017376 0ustar00rjbsstaff000000 000000 package Foo::Boondle; sub mvp_bundle_config { return ( [ 'boondle_1', 'Foo::Boo1', [ x => 1 ] ], [ 'boondle_2', 'Foo::Boo2', [ a => 0 ] ], [ 'boondle_B', 'Foo::Bar', [ y => 1, y => 2, y => 3 ] ], ); } 1; Config-MVP-2.200013/t/lib/Foo/Boo2.pm000644 000765 000024 00000000026 14354101747 016610 0ustar00rjbsstaff000000 000000 package Foo::Boo2; 1; Config-MVP-2.200013/t/lib/Foo/Metaboondle.pm000644 000765 000024 00000000256 14354101747 020245 0ustar00rjbsstaff000000 000000 package Foo::Metaboondle; sub mvp_bundle_config { return ( [ 'boondle_X', 'Foo::Boondle', { } ], [ 'boondle_3', 'Foo::Boo2', { xyzzy => 'plugh' } ], ); } 1; Config-MVP-2.200013/t/lib/Config/MVP/000755 000765 000024 00000000000 14354101747 016577 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/lib/Config/MVP/Reader/000755 000765 000024 00000000000 14354101747 020001 5ustar00rjbsstaff000000 000000 Config-MVP-2.200013/t/lib/Config/MVP/Reader/Test.pm000644 000765 000024 00000001401 14354101747 021252 0ustar00rjbsstaff000000 000000 package Config::MVP::Reader::Test; use Moose; extends 'Config::MVP::Reader'; with qw(Config::MVP::Reader::Findable::ByExtension); sub default_extension { 'mvp-test' } sub read_into_assembler { my ($self, $location, $assembler) = @_; my $filename = $location; open my $fh, '<', $filename or die "can't read $filename: $!"; LINE: while (my $line = <$fh>) { chomp $line; next if $line =~ m{\A\s*(;.+)?\z}; # skip blanks, comments if ($line =~ m{\A(\S+)\s*=\s*(\S+)\z}) { $assembler->add_value($1, $2); next LINE; } if ($line =~ m{\A\[(\S+)(?:\s+(\S+?))?\]\z}) { $assembler->change_section($1, $2); next LINE; } die "don't know how to handle this line: $line\n"; } return $assembler->sequence; } 1;