diff -Nru libconfig-inifiles-perl-2.94/Build.PL libconfig-inifiles-perl-3.000001/Build.PL --- libconfig-inifiles-perl-2.94/Build.PL 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/Build.PL 2019-01-16 09:53:16.000000000 +0000 @@ -1,5 +1,5 @@ -# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.047. +# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v6.012. use strict; use warnings; @@ -19,7 +19,7 @@ "Shlomi Fish " ], "dist_name" => "Config-IniFiles", - "dist_version" => "2.94", + "dist_version" => "3.000001", "license" => "perl", "module_name" => "Config::IniFiles", "recursive_test_files" => 1, @@ -45,10 +45,10 @@ "IO::Handle" => 0, "IPC::Open3" => 0, "Scalar::Util" => 0, - "Test::More" => 0, + "Test::More" => "0.88", "base" => 0, - "blib" => "1.01", - "lib" => 0 + "lib" => 0, + "parent" => 0 } ); @@ -63,10 +63,10 @@ "IPC::Open3" => 0, "Module::Build" => "0.28", "Scalar::Util" => 0, - "Test::More" => 0, + "Test::More" => "0.88", "base" => 0, - "blib" => "1.01", - "lib" => 0 + "lib" => 0, + "parent" => 0 ); diff -Nru libconfig-inifiles-perl-2.94/Changes libconfig-inifiles-perl-3.000001/Changes --- libconfig-inifiles-perl-2.94/Changes 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/Changes 2019-01-16 09:53:16.000000000 +0000 @@ -1,3 +1,42 @@ +3.000001 2019-01-16 + * Fix typos + - https://rt.cpan.org/Public/Bug/Display.html?id=128267 + - Thanks to ROAM . + +3.000000 2018-09-13 + * Fix typos + - https://github.com/shlomif/perl-Config-IniFiles/pull/5 + - Thanks to @ppentchev + * Resubmit with new version to please CPAN/metacpan/etc. + +2.99  2018-07-12 + * Fix the link to the repository + - https://github.com/shlomif/perl-Config-IniFiles/issues/4 + - Thanks to @bessarabov for the report. + +2.98  2018-04-21 + * Remove old author-only test scripts. + - https://rt.cpan.org/Ticket/Display.html?id=125161 + - Thanks to SREZIC for the report. + +2.97  2018-04-21 + * Apply pull-request to implement -php_compat + - https://github.com/shlomif/perl-Config-IniFiles/pull/3 + - https://rt.cpan.org/Ticket/Display.html?id=102339 + - Thanks to @Sadrak ! + +2.96 2018-04-07 + * Fix https://rt.cpan.org/Ticket/Display.html?id=125025 . + - Apply patch from Debian. + - Cache section hashes in the tie interface (which one should avoid + using.) + +2.95 2018-03-16 + * Make use of perltidy and test for it. + * Remove firstload / reload logic + - https://rt.cpan.org/Ticket/Display.html?id=104763 + - thanks to José Joaquín Atria + 2.94 2016-11-29 * Move to GitHub. - for better visibility, collaboration, and CI options. diff -Nru libconfig-inifiles-perl-2.94/debian/changelog libconfig-inifiles-perl-3.000001/debian/changelog --- libconfig-inifiles-perl-2.94/debian/changelog 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/changelog 2019-02-12 14:43:15.000000000 +0000 @@ -1,529 +1,5 @@ -libconfig-inifiles-perl (2.94-1) unstable; urgency=medium - - * New upstream release: - - drop the typos patch, integrated upstream - - update the upstream repository location in the metadata file - - moved to GitHub - * Add myself to the list of uploaders. - * Add a License line to the copyright file's header, too. - - -- Peter Pentchev Wed, 30 Nov 2016 11:04:04 +0200 - -libconfig-inifiles-perl (2.93-1) unstable; urgency=medium - - * Team upload. - - [ gregor herrmann ] - * Remove Jonathan Yu from Uploaders. Thanks for your work! - - [ Peter Pentchev ] - * Catch up with the renamed Lintian override for the debhelper version. - * Switch various upstream and Debian URLs to the HTTPS scheme. - * Use MetaCPAN as the upstream homepage, remove the references to - SourceForge. - * Add the typos patch to correct some errors. - * New upstream release: - - update the upstream copyright information - - -- Peter Pentchev Sun, 27 Nov 2016 19:39:43 +0200 - -libconfig-inifiles-perl (2.89-1) unstable; urgency=medium - - * Team upload - - * Add debian/upstream/metadata - * Import upstream version 2.89 (Closes: #787079) - * Declare compliance with Debian Policy 3.9.8 - * Mark package autopkgtest-able - - -- Florian Schlichting Tue, 03 May 2016 21:30:07 +0200 - -libconfig-inifiles-perl (2.88-1) unstable; urgency=medium - - [ upstream ] - * New release. - + Add a LICENSE file and section. - + Minimum version is now perl-5.8.0. - + Fix to properly update while using _write_config_with_a_made_fh. - + Convert "Changes" to CPAN::Changes. - + Add OLD-Changes.txt for the old changes' log. - * Hopefully fix tests in perls less than 5.14. - * Replace List::MoreUtils with List::Util-1.33-or-above. - * Fix handle trailing comments which contain their delimiters twice. - * Speedup. - - [ Salvatore Bonaccorso ] - * Update Vcs-Browser URL to use cgit web frontend. - - [ Jonas Smedegaard ] - * Bump debhelper compatibility level to 9. - * Update copyright info: - + Use License-Grant and License-Reference fields. - Thanks to Ben Finney. - + Extend coverage of packaging to include current year. - * Declare compliance with Debian Policy 3.9.6. - * Override lintian regarding license in License-Reference field. - See bug#786450. - * Override lintian regarding build-depending unversioned on debhelper. - * Update package relations: - + (Build-)depend on (recent perl or) recent - libscalar-list-utils-perl (not recent liblist-moreutils-perl). - - -- Jonas Smedegaard Tue, 04 Aug 2015 14:24:30 +0200 - -libconfig-inifiles-perl (2.83-3) unstable; urgency=medium - - * Update copyright info: - + Fix cover convenience code copy of Test::Run. - * Fix build-depend explicitly on libmodule-build-perl. - - -- Jonas Smedegaard Wed, 02 Jul 2014 17:48:04 +0200 - -libconfig-inifiles-perl (2.83-1) unstable; urgency=medium - - [ upstream ] - * New release. - + Add a LICENSE file and section. - + Minimum version is now perl-5.8.0. - - [ Jonas Smedegaard ] - * Bump to standards-version 3.9.5. - * Fix use canonical Vcs-Git URL. - * Update copyright info: - + Add coverage year for main upstream authors, and update verbatim - statement. - + Extend coverage of packaging. - * Update watch file to also use metacpan.org URL. - - -- Jonas Smedegaard Tue, 20 May 2014 15:27:52 +0200 - -libconfig-inifiles-perl (2.82-1) unstable; urgency=low - - [ upstream ] - * New release. - + Add the RenameSection method to rename a section. - + Add the CopySection method to copy a section. - + Add t/style-trailing-space.t. - + Remove trailing space. - - [ Jonas Smedegaard ] - * Switch to cpan.org/authors URL for watch file and get-orig-source - target, and simplify watch file. - * Rewrap long description at 72 chars, and strip trailing whitespace. - - -- Jonas Smedegaard Fri, 19 Jul 2013 13:34:28 +0200 - -libconfig-inifiles-perl (2.79-1) unstable; urgency=low - - [ upstream ] - * New release. - + Fix test failures with Pod-Simple-3.28. - - [ Salvatore Bonaccorso ] - * Use canonical hostname (anonscm.debian.org) in Vcs-Git URL. - - [ Jonas Smedegaard ] - * Update README.source to emphasize control.in file as *not* a - show-stopper for contributions. - * Bump policy compliance to standards-version 3.9.4. - * Do copyright-check by default: Backports-friendly nowadays. - Build-depend on devscripts. - * Bump packaging license to GPL-3+, and extend coverage to include - current year. - * Bump dephelper compatibility level to 8. - - -- Jonas Smedegaard Thu, 09 May 2013 16:38:47 +0200 - -libconfig-inifiles-perl (2.78-1) unstable; urgency=low - - * New upstream release. - - [ Jonas Smedegaard ] - * Update package relations: - * Tighten (build-)dependency on liblist-moreutils-perl: Needed since - 0.77. - + Relax to build-depend unversioned on cdbs, and stop build- - depending on (perl-modules with fallback on) libmodule-build-perl: - Needed versions satisfied in stable, and oldstable no longer - supported. - * Update copyright file: - + Fix use comment and license pseudo-sections to obey silly - restrictions of copyright format 1.0. - - -- Jonas Smedegaard Fri, 02 Nov 2012 16:31:37 +0100 - -libconfig-inifiles-perl (2.75-1) unstable; urgency=low - - * New upstream release. - + Add utf8 encoding hint to POD file. - - * Extend/adjust copyright of Debian packaging. - - -- Jonas Smedegaard Tue, 05 Jun 2012 23:12:26 +0200 - -libconfig-inifiles-perl (2.73-1) unstable; urgency=low - - * New upstream release: - - fixes a regression in the error handling on tempfile creation, as noted - by Adam D. Barrat in #671255 (RT#77039). - - -- gregor herrmann Mon, 14 May 2012 16:46:14 +0200 - -libconfig-inifiles-perl (2.72-1) unstable; urgency=low - - * Team upload. - * New upstream release: - SECURITY BUG FIX: Config::IniFiles used to write to a temporary filename - with a predictable name ("${filename}-new") which opens the door for - potential exploits. -- CVE-2012-2451, CWE-377 - Closes: #671255 - * (Build-)depend on liblist-moreutils-perl. - - -- gregor herrmann Sun, 06 May 2012 14:42:08 +0200 - -libconfig-inifiles-perl (2.70-1) unstable; urgency=low - - * New upstream release. - - [ gregor herrmann ] - * Remove debian/source/local-options; abort-on-upstream-changes and - unapply-patches are default in dpkg-source since 1.16.1. - - [ Jonas Smedegaard ] - * Bump standards-version to 3.9.3. - * Use anonscm.debian.org for Vcs-Browser field. - * Bump debhelper compat level to 7. - * Update copyright file: - + Fix double-indent in Copyright fields as per Policy §5.6.13. - + Bump format to 1.0. - * Update package relations: - + Relax build-depend unversioned on debhelper: Needed version - satisfied even in oldstable. - - -- Jonas Smedegaard Tue, 24 Apr 2012 13:37:12 -0400 - -libconfig-inifiles-perl (2.68-1) unstable; urgency=low - - * New upstream release. - * Update copyright file: - + Add test, Expat licensed. - + Update author: Shlomi Fish. - + Quote licenses in License comments. - - -- Jonas Smedegaard Sat, 25 Jun 2011 19:01:41 +0200 - -libconfig-inifiles-perl (2.66-2) unstable; urgency=low - - [ Salvatore Bonaccorso ] - * Remove Salvatore Bonaccorso from Uploaders. - - -- Jonas Smedegaard Sun, 08 May 2011 03:34:30 +0200 - -libconfig-inifiles-perl (2.66-1) unstable; urgency=low - - * New upstream release. - * Improve package relations: - + Stop declaring packages part of core Perl even in oldstable: - - libtest-simple-perl - * Include CDBS class perl-build.mk (not deprecated perlmodule.mk. - Tighten build-dependency on cdbs. - * Build-depend on libio-stringy-perl, enabling more regression tests. - * Update copyright file: - + Rewrite using draft 174 of DEP-5 format. - + Fix use initial wildcard Files section. - + Rewrap license fields at 72 chars, and shorten comments. - * Bump policy compliance to standards-version 3.9.2. - - -- Jonas Smedegaard Sun, 08 May 2011 03:29:25 +0200 - -libconfig-inifiles-perl (2.58-1) unstable; urgency=low - - * New upstream release. - * Stop using svn-upgrade in watch file. - * Use source format 3.0 (quilt), and ease building with - git-buildpackage: Git-ignore quilt .pc dir, and add source - local-options. - * Drop locally included CDBS snippets, and local implementation of - DEB_MAINTAINER_MODE, all included in main cdbs now. - * Ease backporting to Debian stable: Relax inclusion of CDBS snippets - required only in DEB_MAINTAINER_MODE, and suppress related build- - dependencies. - * Extend copyright years in rules file, and refer to FSF website (not - postal address). - * Rewrite copyright file using draft rev135 of DEP5 format. - * Bump Policy compliance to standards-version 3.9.1. - * Shorten Vcs-* stanzas. - * Update DEB_UPSTREAM_URL, to fix get-orig-source rule. - * Build-depend on libtest-simple-perl. - - -- Jonas Smedegaard Sat, 16 Oct 2010 17:21:21 +0200 - -libconfig-inifiles-perl (2.52-1) unstable; urgency=low - - [ Jonathan Yu ] - * New upstream release - + $config->exists() now pays attention to -nocase => 1. (RT#46721) - * Added myself to Uploaders - * Standards-Version 3.8.3 (no changes) - - [ Salvatore Bonaccorso ] - * New upstream release - - [ Nathan Handler ] - * debian/watch: Update to ignore development releases. - - [ Salvatore Bonaccorso ] - * debian/control: Changed: Replace versioned (build-)dependency on - perl (>= 5.6.0-{12,16}) with an unversioned dependency on perl (as - permitted by Debian Policy 3.8.3). - - [ Jonas Smedegaard ] - * Update CDBS snippets: - + package-relations.mk: Cleanup unversioned+versioned dependency - mix. Improve whitespace cleanup. Rewrite and silence applying - dependencies. - + Update URL to draft DEP5 format in copyright-check.mk output. - * Drop no longer needed build-dependencies on quilt and patchutils, - and make perl build-dependency unversioned (as per Debian Policy - 3.8.3). Both these changes thanks to cdbs automatic build-dependency - resolving (DEB_MAINTAINER_MODE=1 fakeroot debian/rules clean). - * Packaging moved to Git: - + Update Vcs stanzas. - + Add note on Git, git-buildpackage and pristine-tar to - README.source, and drop not on Subversion. - + Add git-buildpackage configfile, enabling signed tags and use of - pristine-tar. - * Update md5sum of new upstream release 2.52. - - -- Jonas Smedegaard Thu, 27 Aug 2009 15:30:34 +0200 - -libconfig-inifiles-perl (2.49-1) unstable; urgency=low - - [ Jonas Smedegaard ] - * Update copyright info: - + Rewrite to use DEP5 r48 proposed machine-readable format - + Add proper licensing header to rules file - + Bump copyright years for debian/rules - * Update CDBS snippets: - + Extend package-relation.mk to handle debhelper 6 and 7.0.1, and to - support non-build dependencies - * Auto-update debian/control to tighten debhelper dependency, thanks - to lintian. - * Add README.source. Drop custom CDBS hints. - * Build-depend on quilt and recent patchutils. - - [ Salvatore Bonaccorso ] - * New upstream release. - * Add Salvatore Bonaccorso to Uploaders. - * New upstream version (Changes in upstream version 2.48) fixes - change in tie interfaces (Closes: #529616). - * Bump Standards-Version to 3.8.1 - * Add 1001-fix-POD-Config-IniFiles.patch to fix erroneous created - manpage. - - -- Jonas Smedegaard Sun, 31 May 2009 14:54:35 +0200 - -libconfig-inifiles-perl (2.47-1) unstable; urgency=low - - [ Jonas Smedegaard ] - * New upstream release. Closes: bug#430426, #380280. - * Depend on ${misc:Depends}. - * Fix Vcs-* fields to point to refer to correct package. - * Update CDBS snippets: - + Update copyright-check output to more closely match proposed new - copyright file format - + Simplify internal variables - + Ignore no files by default in copyright-check.mk - + Correct and update copyright hints of the snippets themselves - + Move dependency cleanup to new local snippet package-relations.mk. - * Update debian/copyright and copyright hints: - + Rewrite debian/copyright using new file format, version 428 - + Add info on CDBS snippets (new owners, no new licenses) - * Add DEB_MAINTAINER_MODE in debian/rules (thanks to Romain Beauxis). - - [ gregor herrmann ] - * debian/watch: use dist-based URL. - * debian/control: Changed: Switched Vcs-Browser field to ViewSVN - (source stanza). - - -- Jonas Smedegaard Sat, 24 Jan 2009 22:25:26 +0100 - -libconfig-inifiles-perl (2.39-5) unstable; urgency=medium - - * Set urgency=medium as 2.39-5 included a FTBFS bugfix (similar to - bug#487066). - - -- Jonas Smedegaard Sat, 28 Jun 2008 20:26:58 +0200 - -libconfig-inifiles-perl (2.39-4) unstable; urgency=low - - * Instruct dh_perl to only depend on perl-base, instead of avoiding - its dependency-resolving altogether. - * Update local cdbs tweaks: - + Fix buildinfo.mk invoking dh-buildinfo only once. - + Update copyright-check.mk to parse licensecheck output using perl: - + No longer randomly drops newlines - + More compact hint file (and ordered more like wiki-proposed new - copyright syntax). - + No longer ignore files without copyright. - + Drop wget options broken with recent versions of wget in - update-tarball.mk. - + Relax copyright-check to only warn by default. - + Cosmetic updates to README.cdbs-tweaks. - * Update debian/copyright-hints. - * Bump debhelper compatibility level to 6. - * Semi-auto-update debian/control to update build-dependencies: - DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean - - -- Jonas Smedegaard Thu, 26 Jun 2008 01:34:16 +0200 - -libconfig-inifiles-perl (2.39-3) unstable; urgency=low - - * Pass over maintenance of the package to the Perl group: Change Maintainer, - and add myself to Uploaders. - * Change debian/watch to use svn-upgrade (not uupdate). - * Move Homepage to own field (from pseudo-field in long description). - * Add Vcs-* fields. - * Bump up standards-version to 3.7.3 (no changes needed). - * Bump dephelper compatibility level to 5. - * Fix build-depends-indep -> build-depends. - * Update local cdbs tweaks: - + Add new snippet update-tarball, implementing get-orig-source and more. - + Major improvements to copyright-check, including new versioned - build-dependency on devscripts. Update debian/copyright_hints. - + Drop auto-update.mk. Set DEB_AUTO_UPDATE_DEBIAN_CONTROL directly - instead when needed. - + Add debian/README.cdbs-tweaks documenting local tweaks. - * Fix double cdbs build-dependencies in debian/rules. - * Semi-auto-update debian/control to apply changes contained in the above: - DEB_AUTO_UPDATE_DEBIAN_CONTROL=yes fakeroot debian/rules clean - - -- Jonas Smedegaard Thu, 21 Feb 2008 00:57:26 +0100 - -libconfig-inifiles-perl (2.39-2) unstable; urgency=low - - * Strip bogus part of 2.39-1 changelog entry (due to cut'n'paste). - - -- Jonas Smedegaard Sun, 16 Jul 2006 22:08:43 +0200 - -libconfig-inifiles-perl (2.39-1) unstable; urgency=low - - * New upstream release. - * Bump standards-version to 3.7.2 (no changes needed). - * Advertise search.cpan.org as Homepage in long description. - * Bump watch file version and use uversionmangle to chop 3-digit minor - version into manageable pieces (not yet needed for this package, but - popular with Perl packages). - * Add local cdbs snippet copyright-check.mk. - * Enable cdbs auto-update feature using local snippet auto-update.mk. - * Move buildinfo to local cdbs snippet buildinfo.mk. - * Drop superfluous dependency on perl-base. Closes: bug#316415 (thanks - to Dan Jacobson ). - - -- Jonas Smedegaard Sun, 16 Jul 2006 21:43:58 +0200 - -libconfig-inifiles-perl (2.38-3) unstable; urgency=high - - * Change unnecessary auto-generated dependency on perl to perl-base. - Requested by Konstantinos Margaritis to minimize - dependencies for localization-config (and thus debian-installer - netinst image). - * Standards-Version: 3.6.1 (no changes needed). - * Add usage note to watch file. - * Mention "Debian GNU systems" in intro line if debian/copyright. - * Correct location of Artistic license (to please lintian). - * Shorten short description (all lib*-perl packages are modules...). - * Use (and build-depend on) dh-buildinfo. - * Set urgency=high as none of the above changes should cause any risk, - and dropping perl dependency is important for debian-installer. - - -- Jonas Smedegaard Sat, 25 Sep 2004 21:38:04 +0200 - -libconfig-inifiles-perl (2.38-2) unstable; urgency=low - - * Rebuild using newer cdbs (Closes: Bug#203617 - no need to tighten - build-dependencies, as cdbs has not yet been included in any - official release of Debian). - * Standards-version 3.6.0. - * Fix watch file to not include other related modules. - * Change to section perl. - * Remove info in debian/copyright included in debian/changelog. - - -- Jonas Smedegaard Thu, 31 Jul 2003 14:30:49 +0200 - -libconfig-inifiles-perl (2.38-1) unstable; urgency=low - - * New upstream release - * Switch from cbs to cdbs. - * Standards-Version 3.5.10 (no changes needed). - * Build-depend on cdbs, tighten build-dependency on debhelper, and use - debian/compat = 4. - * Drop build-depending on links (upstream README is no longer html). - - -- Jonas Smedegaard Fri, 30 May 2003 13:16:39 +0200 - -libconfig-inifiles-perl (2.36-1) unstable; urgency=low - - * New upstream release. - * Remove full stop from synopsis to please lintian. - - -- Jonas Smedegaard Tue, 28 Jan 2003 05:52:42 +0100 - -libconfig-inifiles-perl (2.30-1) unstable; urgency=low - - * New upstream release. - * Add watch file. - - -- Jonas Smedegaard Tue, 12 Nov 2002 04:09:22 +0100 - -libconfig-inifiles-perl (2.29-2) unstable; urgency=low - - * Build the package using binary-indep build-target. - - -- Jonas Smedegaard Thu, 29 Aug 2002 08:51:40 +0200 - -libconfig-inifiles-perl (2.29-1) unstable; urgency=low - - * New upstream release. - * Change source URL to use cpan.org. - - -- Jonas Smedegaard Mon, 19 Aug 2002 21:07:33 +0200 - -libconfig-inifiles-perl (2.27-1) unstable; urgency=low - - * New upstream release. - * Friendly takeover (Thanks, Piotr!): Change Maintainer field. - * Repackaged using dh-make-perl. - * Upstream readme is html now (strange!). Convert using links. - * Rewrite copyright. - * Run tests as part of the compile. - * Remove execute rights to the perl module (shouldn't dh_fixperms take - care of that?). - - -- Jonas Smedegaard Mon, 25 Mar 2002 19:33:34 +0100 - -libconfig-inifiles-perl (2.21-1) unstable; urgency=low - - * New upstream release - - -- Piotr Roszatycki Wed, 17 Oct 2001 14:32:46 +0200 - -libconfig-inifiles-perl (2.19-2) unstable; urgency=low - - * Build-Depends-Indep in debian/control - - -- Piotr Roszatycki Wed, 17 Oct 2001 14:30:14 +0200 - -libconfig-inifiles-perl (2.19-1) unstable; urgency=low - - * New upstream release - * woody release - - -- Piotr Roszatycki Mon, 30 Jul 2001 13:26:36 +0200 - -libconfig-inifiles-perl (2.14-1) unstable; urgency=low +libconfig-inifiles-perl (3.000001-bionic1) bionic; urgency=low * Initial release. - -- Piotr Roszatycki Wed, 31 Jan 2001 10:18:12 +0100 - + -- Isaac Connor Tue, 12 Feb 2019 09:43:15 -0500 diff -Nru libconfig-inifiles-perl-2.94/debian/compat libconfig-inifiles-perl-3.000001/debian/compat --- libconfig-inifiles-perl-2.94/debian/compat 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/compat 2019-02-12 14:43:15.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru libconfig-inifiles-perl-2.94/debian/control libconfig-inifiles-perl-3.000001/debian/control --- libconfig-inifiles-perl-2.94/debian/control 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/control 2019-02-12 14:43:15.000000000 +0000 @@ -1,30 +1,20 @@ Source: libconfig-inifiles-perl -Maintainer: Debian Perl Group -Uploaders: Jonas Smedegaard , Peter Pentchev Section: perl -Testsuite: autopkgtest-pkg-perl -Priority: extra -Build-Depends: cdbs, - devscripts, - perl, - libmodule-build-perl, - debhelper, - dh-buildinfo, - perl (>= 5.19.5) | libscalar-list-utils-perl (>= 1:1.33), - libio-stringy-perl -Standards-Version: 3.9.8 -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libconfig-inifiles-perl.git -Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libconfig-inifiles-perl.git -Homepage: https://metacpan.org/release/Config-IniFiles/ +Priority: optional +Maintainer: Isaac Connor +Build-Depends: debhelper (>= 10) +Build-Depends-Indep: libio-stringy-perl, + libmodule-build-perl (>= 0.28), + perl (>= 5.19.5) +Standards-Version: 4.1.3 +Homepage: https://metacpan.org/release/Config-IniFiles Package: libconfig-inifiles-perl Architecture: all -Depends: ${cdbs:Depends}, - ${misc:Depends}, - ${perl:Depends}, - perl (>= 5.19.5) | libscalar-list-utils-perl (>= 1:1.33) -Description: Read .ini-style configuration files - Config::IniFiles provides a way to have readable configuration files - outside your Perl script. Configurations can be imported (inherited, - stacked,...), sections can be grouped, and settings can be accessed - from a tied hash. +Depends: ${misc:Depends}, ${perl:Depends}, + libio-stringy-perl, + perl (>= 5.19.5) +Description: module for reading .ini-style configuration files. + (no description was found) + . + This description was automagically extracted from the module by dh-make-perl. diff -Nru libconfig-inifiles-perl-2.94/debian/control.in libconfig-inifiles-perl-3.000001/debian/control.in --- libconfig-inifiles-perl-2.94/debian/control.in 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/control.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -Source: libconfig-inifiles-perl -Section: perl -Priority: extra -Build-Depends: @cdbs@ -Maintainer: Debian Perl Group -Uploaders: Jonas Smedegaard , Peter Pentchev -Standards-Version: 3.9.8 -Vcs-Git: https://anonscm.debian.org/git/pkg-perl/packages/libconfig-inifiles-perl.git -Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libconfig-inifiles-perl.git -Homepage: https://metacpan.org/release/Config-IniFiles/ -Testsuite: autopkgtest-pkg-perl - -Package: libconfig-inifiles-perl -Architecture: all -Depends: ${cdbs:Depends}, - ${misc:Depends}, - ${perl:Depends} -Description: Read .ini-style configuration files - Config::IniFiles provides a way to have readable configuration files - outside your Perl script. Configurations can be imported (inherited, - stacked,...), sections can be grouped, and settings can be accessed - from a tied hash. diff -Nru libconfig-inifiles-perl-2.94/debian/copyright libconfig-inifiles-perl-3.000001/debian/copyright --- libconfig-inifiles-perl-2.94/debian/copyright 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/copyright 2019-02-12 14:43:15.000000000 +0000 @@ -1,74 +1,36 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Config::IniFiles -Upstream-Contact: Shlomi Fish -Source: https://metacpan.org/release/Config-IniFiles/ -License: Artistic or GPL-1+ +Source: https://metacpan.org/release/Config-IniFiles +Upstream-Contact: Shlomi Fish +Upstream-Name: Config-IniFiles +DISCLAIMER: This copyright info was automatically extracted + from the perl module. It may not be accurate, so you better + check the module sources in order to ensure the module for its + inclusion in Debian or for general legal information. Please, + if licensing information is incorrectly generated, file a bug + on dh-make-perl. + NOTE: Don't forget to remove this disclaimer once you are happy + with this file. Files: * -Copyright: - © 2000, Scott Hutton - © 2000, Rich Bowen - © 2000, Jeremy Wadsack -License-Grant: - This is free software; you can redistribute it and/or modify it under - the same terms as the Perl 5 programming language system itself. -License: Artistic or GPL-1+ -Comment: - Perl 5 is licensed under either the 'Artistic license' or the 'GNU - General Public License' version 1 or later. - -Files: inc/Test/Run/Builder.pm -Copyright: - © 2006 Shlomi Fish +Copyright: 2000, Shlomi Fish License: Artistic or GPL-1+ -Comment: - Mangled convenience copy of Test::Run. - -Files: t/30parameters-with-empty-values.t -Copyright: - © 2011, Shlomi Fish -License: Expat - -Files: t/34trailing-comments-double-delimeter.t -Copyright: - © 2015, Shlomi Fish -License: Expat Files: debian/* -Copyright: - © 2002-2004,2006,2008-2015, Jonas Smedegaard -License-Grant: - 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 3, or (at your option) any - later version. -License: GPL-3+ +Copyright: 2019, Isaac Connor +License: Artistic or GPL-1+ License: Artistic -License-Reference: /usr/share/common-licenses/Artistic + This program is free software; you can redistribute it and/or modify + it under the terms of the Artistic License, which comes with Perl. + . + On Debian systems, the complete text of the Artistic License can be + found in `/usr/share/common-licenses/Artistic'. License: GPL-1+ -License-Reference: /usr/share/common-licenses/GPL-1 - -License: GPL-3+ -License-Reference: /usr/share/common-licenses/GPL-3' - -License: Expat - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - . - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. + 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. . - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + On Debian systems, the complete text of version 1 of the GNU General + Public License can be found in `/usr/share/common-licenses/GPL-1'. diff -Nru libconfig-inifiles-perl-2.94/debian/copyright_hints libconfig-inifiles-perl-3.000001/debian/copyright_hints --- libconfig-inifiles-perl-2.94/debian/copyright_hints 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/copyright_hints 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: FIXME -Upstream-Contact: FIXME -Source: FIXME -Disclaimer: Autogenerated by CDBS - -Files: Build.PL - Changes - MANIFEST - META.json - META.yml - Makefile.PL - OLD-Changes.txt - debian/README.source - debian/compat - debian/control - debian/control.in - debian/gbp.conf - debian/source/format - debian/source/lintian-overrides - debian/watch - inc/Test/Run/Builder.pm - scripts/tag-release.pl - t/00load.t - t/01basic.t - t/02weird.t - t/03comments.t - t/04import.t - t/05hash.t - t/06oo.t - t/07misc.t - t/08group.t - t/09case.t - t/10delta.t - t/11copy-ties-with-array-vals.t - t/12open-empty-file.t - t/13val-in-list-context.t - t/14brackets-within-values.t - t/15store-and-retrieve-here-doc-terminator.t - t/16case-sensitive-default.t - t/17untainted-multiline-values.t - t/18non-contiguous-groups.t - t/19param-found-outside-section.t - t/20allowedcommentchars.t - t/22trailing-comment-lines.t - t/23scalar-ref.t - t/24case-sensitive-exists.t - t/25line-endings.t - t/26scalar-filehandle.t - t/27empty-ini.t - t/28nomultiline.t - t/29end-of-line-comment.t - t/31comments_with_spaces.t - t/32mswin-outputs-contain-crs.t - t/33update-using-tied-fh-w-shorter-names.t - t/allowed-comment-chars.ini - t/array.ini - t/bad.ini - t/brackets-in-values.ini - t/ca.ini - t/case-sensitive-default.ini - t/case-sensitive.ini - t/cmt.ini - t/cpan-changes.t - t/en.ini - t/end-of-line-comment.ini - t/es.ini - t/lib/Config/IniFiles/Debug.pm - t/lib/Config/IniFiles/Slurp.pm - t/lib/Config/IniFiles/TestPaths.pm - t/non-contiguous-groups.ini - t/pod-coverage.t - t/pod.t - t/style-trailing-space.t - t/test.ini - t/trailing-comments.ini -Copyright: *No copyright* -License: UNKNOWN - FIXME - -Files: t/30parameters-with-empty-values.t -Copyright: & LICENSE - 2011, Shlomi Fish -License: Expat - FIXME - -Files: debian/rules -Copyright: 2002-2004, 2006, 2008-2015, Jonas Smedegaard -License: GPL-3+ - FIXME - -Files: README -Copyright: *No copyright* -License: Perl - FIXME - -Files: LICENSE -Copyright: 1989, 1991 Free Software Foundation, Inc. - law: - of this - the software, and -License: UNKNOWN - FIXME - -Files: lib/Config/IniFiles.pm -Copyright: 2000, Scott Hutton and the rest of the -License: UNKNOWN - FIXME - diff -Nru libconfig-inifiles-perl-2.94/debian/gbp.conf libconfig-inifiles-perl-3.000001/debian/gbp.conf --- libconfig-inifiles-perl-2.94/debian/gbp.conf 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -# Configuration file for git-buildpackage and friends - -[DEFAULT] -pristine-tar = True -sign-tags = True diff -Nru libconfig-inifiles-perl-2.94/debian/README.source libconfig-inifiles-perl-3.000001/debian/README.source --- libconfig-inifiles-perl-2.94/debian/README.source 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/README.source 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -CDBS+git-buildpackage ---------------------- - -This source package uses CDBS and git-buildpackage. NMUs need not (but -are encouraged to) make special use of these tools. In particular, the -debian/control.in file can be completely ignored. - -More info here: https://wiki.debian.org/CDBS+git-buildpackage - - - -- Jonas Smedegaard Mon, 18 Feb 2013 12:55:37 +0100 diff -Nru libconfig-inifiles-perl-2.94/debian/rules libconfig-inifiles-perl-3.000001/debian/rules --- libconfig-inifiles-perl-2.94/debian/rules 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/rules 2019-02-12 14:43:15.000000000 +0000 @@ -1,45 +1,4 @@ #!/usr/bin/make -f -# -*- mode: makefile; coding: utf-8 -*- -# Copyright © 2002-2004, 2006, 2008-2015 Jonas Smedegaard -# Description: Main Debian packaging script for Config::IniFiles -# -# 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 3, 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, see . -include /usr/share/cdbs/1/rules/upstream-tarball.mk -include /usr/share/cdbs/1/rules/utils.mk -include /usr/share/cdbs/1/class/perl-build.mk -include /usr/share/cdbs/1/rules/debhelper.mk - -pkg = $(DEB_SOURCE_PACKAGE) - -DEB_UPSTREAM_PACKAGE = Config-IniFiles -DEB_UPSTREAM_URL = http://www.cpan.org/authors/id/S/SH/SHLOMIF -DEB_UPSTREAM_TARBALL_MD5 = c322dde13d7d48b1f9d0f30f661002cf - -# Build-depend unversioned on debhelper -# TODO: Drop when adopted in cdbs -CDBS_BUILD_DEPENDS_rules_debhelper_v9 = debhelper - -# Needed by upstream build process and (always) at runtime -deps = perl (>= 5.19.5) | libscalar-list-utils-perl (>= 1:1.33) - -# Needed by upstream testsuite -deps-test = libio-stringy-perl - -CDBS_BUILD_DEPENDS +=, $(deps), $(deps-test) -CDBS_DEPENDS_$(pkg) = $(deps) - -# Perl-base is sufficient, and was once wanted by localization-config for use -# in debian-installer. -DEB_DH_PERL_ARGS = -d +%: + dh $@ diff -Nru libconfig-inifiles-perl-2.94/debian/source/lintian-overrides libconfig-inifiles-perl-3.000001/debian/source/lintian-overrides --- libconfig-inifiles-perl-2.94/debian/source/lintian-overrides 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -# License is in License-Reference field (see bug#786450) -missing-license-text-in-dep5-copyright - -# License is in License-Reference field (see bug#786450) -missing-license-paragraph-in-dep5-copyright - -# Debhelper 9 is satisfied even in oldstable -package-lacks-versioned-build-depends-on-debhelper 9 diff -Nru libconfig-inifiles-perl-2.94/debian/upstream/metadata libconfig-inifiles-perl-3.000001/debian/upstream/metadata --- libconfig-inifiles-perl-2.94/debian/upstream/metadata 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/upstream/metadata 2019-02-12 14:43:15.000000000 +0000 @@ -1,6 +1,7 @@ --- Archive: CPAN +Bug-Database: https://github.com/shlomif/perl-Config-IniFiles/issues Contact: Shlomi Fish Name: Config-IniFiles -Repository: https://github.com/shlomif/perl-Config-IniFiles.git +Repository: git://github.com/shlomif/perl-Config-IniFiles.git Repository-Browse: https://github.com/shlomif/perl-Config-IniFiles diff -Nru libconfig-inifiles-perl-2.94/debian/watch libconfig-inifiles-perl-3.000001/debian/watch --- libconfig-inifiles-perl-2.94/debian/watch 2016-11-30 09:04:04.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/debian/watch 2019-02-12 14:43:15.000000000 +0000 @@ -1,4 +1,2 @@ -# Run the "uscan" command to check for upstream updates and more. version=3 -https://metacpan.org/release/Config-IniFiles .*/Config-IniFiles-([\d.]+)\.tar\.gz -http://www.cpan.org/authors/id/S/SH/SHLOMIF/Config-IniFiles-([\d.]+)\.tar\.gz +https://metacpan.org/release/Config-IniFiles .*/Config-IniFiles-v?(\d[\d.-]*)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$ diff -Nru libconfig-inifiles-perl-2.94/dist.ini libconfig-inifiles-perl-3.000001/dist.ini --- libconfig-inifiles-perl-2.94/dist.ini 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/dist.ini 2019-01-16 09:53:16.000000000 +0000 @@ -5,10 +5,13 @@ copyright_year = 2000 [@Filter] --bundle = @Basic +-bundle = @SHLOMIF -remove = License -remove = Readme -[AutoPrereqs] +-remove = Test::Compile +-remove = Test::EOL +dist = Config-IniFiles +github_name = perl-Config-IniFiles [Keywords] keyword = config keyword = configuration @@ -19,23 +22,8 @@ keyword = tested keyword = tie keyword = windows -[MetaProvides::Package] -[MetaResources] -bugtracker.web = http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-IniFiles -bugtracker.mailto = bug-config-inifiles@rt.cpan.org -repository.url = ssh://git@github.com:shlomif/perl-Config-IniFiles.git -repository.web = https://github.com/shlomif/perl-Config-IniFiles -repository.type = git -[ModuleBuild] -[MetaJSON] -[PodSyntaxTests] -[PodCoverageTests] -[PodWeaver] -[PruneFiles] -match = ^rejects/ [RewriteVersion] [Test::Compile] fake_home = 1 skip = bump-ver|tag-release|run_agg_tests -[Test::CPAN::Changes] -[Test::Kwalitee::Extra] +[Test::TidyAll] diff -Nru libconfig-inifiles-perl-2.94/lib/Config/IniFiles.pm libconfig-inifiles-perl-3.000001/lib/Config/IniFiles.pm --- libconfig-inifiles-perl-2.94/lib/Config/IniFiles.pm 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/lib/Config/IniFiles.pm 2019-01-16 09:53:16.000000000 +0000 @@ -4,9 +4,9 @@ use strict; use warnings; -our $VERSION = '2.94'; +our $VERSION = '3.000001'; use Carp; -use Symbol 'gensym','qualify_to_ref'; # For the 'any data type' hack +use Symbol 'gensym', 'qualify_to_ref'; # For the 'any data type' hack use Fcntl qw( SEEK_SET SEEK_CUR ); use List::Util 1.33 qw(any none); @@ -14,7 +14,7 @@ use File::Basename qw( dirname ); use File::Temp qw/ tempfile /; -@Config::IniFiles::errors = ( ); +@Config::IniFiles::errors = (); # $Header: /home/shlomi/progs/perl/cpan/Config/IniFiles/config-inifiles-cvsbackup/config-inifiles/IniFiles.pm,v 2.41 2003-12-08 10:50:56 domq Exp $ @@ -25,7 +25,7 @@ if (@_) { - $self->{nocase} = (shift(@_) ? 1 : 0); + $self->{nocase} = ( shift(@_) ? 1 : 0 ); } return $self->{nocase}; @@ -33,141 +33,191 @@ sub _is_parm_in_sect { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - return any { $_ eq $parm } @{$self->{myparms}{$sect}}; + return any { $_ eq $parm } @{ $self->{myparms}{$sect} }; } -sub new { - my $class = shift; - my %parms = @_; - - my $errs = 0; - my @groups = ( ); - - my $self = bless { - default => '', - fallback =>undef, - fallback_used => 0, - imported =>undef, - v =>{}, - cf => undef, - firstload => 1, - nomultiline => 0, - handle_trailing_comment => 0, - }, $class; - - if( ref($parms{-import}) && ($parms{-import}->isa('Config::IniFiles')) ) { - $self->{imported}=$parms{-import}; # ReadConfig will load the data - $self->{negativedeltas}=1; - } elsif( defined $parms{-import} ) { - carp "Invalid -import value \"$parms{-import}\" was ignored."; - } # end if - delete $parms{-import}; - - # Copy the original parameters so we - # can use them when we build new sections - %{$self->{startup_settings}} = %parms; - - # Parse options - my($k, $v); - local $_; - $self->_nocase(0); - - # Handle known parameters first in this order, - # because each() could return parameters in any order - if (defined ($v = delete $parms{'-file'})) { - # Should we be pedantic and check that the file exists? - # .. no, because now it could be a handle, IO:: object or something else - $self->{cf} = $v; - } - if (defined ($v = delete $parms{'-nocase'})) { - $self->_nocase($v); - } - if (defined ($v = delete $parms{'-default'})) { - $self->{default} = $self->_nocase ? lc($v) : $v; - } - if (defined ($v = delete $parms{'-fallback'})) { - $self->{fallback} = $self->_nocase ? lc($v) : $v; - } - if (defined ($v = delete $parms{'-reloadwarn'})) { - $self->{reloadwarn} = $v ? 1 : 0; - } - if (defined ($v = delete $parms{'-nomultiline'})) { - $self->{nomultiline} = $v ? 1 : 0; - } - if (defined ($v = delete $parms{'-allowcontinue'})) { - $self->{allowcontinue} = $v ? 1 : 0; - } - if (defined ($v = delete $parms{'-allowempty'})) { - $self->{allowempty} = $v ? 1 : 0; - } - if (defined ($v = delete $parms{'-negativedeltas'})) { - $self->{negativedeltas} = $v ? 1 : 0; - } - if (defined ($v = delete $parms{'-commentchar'})) { - if(!defined $v || length($v) != 1) { - carp "Comment character must be unique."; - $errs++; - } - elsif($v =~ /[\[\]=\w]/) { - # must not be square bracket, equal sign or alphanumeric - carp "Illegal comment character."; - $errs++; - } - else { - $self->{comment_char} = $v; - } - } - if (defined ($v = delete $parms{'-allowedcommentchars'})) { - # must not be square bracket, equal sign or alphanumeric - if(!defined $v || $v =~ /[\[\]=\w]/) { - carp "Illegal value for -allowedcommentchars."; - $errs++; - } - else { - $self->{allowed_comment_char} = $v; - } - } - - if (defined ($v = delete $parms{'-handle_trailing_comment'})) { - $self->{handle_trailing_comment} = $v ? 1 : 0; - } - - $self->{comment_char} = '#' unless exists $self->{comment_char}; - $self->{allowed_comment_char} = ';' unless exists $self->{allowed_comment_char}; - # make sure that comment character is always allowed - $self->{allowed_comment_char} .= $self->{comment_char}; - - $self->{_comments_at_end_of_file} = []; - - # Any other parameters are unknown - while (($k, $v) = each %parms) { - carp "Unknown named parameter $k=>$v"; - $errs++; - } +sub new +{ + my $class = shift; + my %parms = @_; - return undef if $errs; + my $errs = 0; + my @groups = (); - if ($self->ReadConfig) { - return $self; - } else { - return undef; - } -} + my $self = bless { + default => '', + fallback => undef, + fallback_used => 0, + imported => undef, + v => {}, + cf => undef, + nomultiline => 0, + handle_trailing_comment => 0, + }, $class; + if ( ref( $parms{-import} ) + && ( $parms{-import}->isa('Config::IniFiles') ) ) + { + $self->{imported} = $parms{-import}; # ReadConfig will load the data + $self->{negativedeltas} = 1; + } + elsif ( defined $parms{-import} ) + { + carp "Invalid -import value \"$parms{-import}\" was ignored."; + } # end if + delete $parms{-import}; + # Copy the original parameters so we + # can use them when we build new sections + %{ $self->{startup_settings} } = %parms; -sub _caseify { - my ($self, @refs) = @_; + # Parse options + my ( $k, $v ); + $self->_nocase(0); - if (not $self->_nocase) + # Handle known parameters first in this order, + # because each() could return parameters in any order + if ( defined( $v = delete $parms{'-file'} ) ) { - return; + # Should we be pedantic and check that the file exists? + # .. no, because now it could be a handle, IO:: object or something else + $self->{cf} = $v; + } + if ( defined( $v = delete $parms{'-nocase'} ) ) + { + $self->_nocase($v); + } + if ( defined( $v = delete $parms{'-default'} ) ) + { + $self->{default} = $self->_nocase ? lc($v) : $v; + } + if ( defined( $v = delete $parms{'-fallback'} ) ) + { + $self->{fallback} = $self->_nocase ? lc($v) : $v; + } + if ( defined( $v = delete $parms{'-reloadwarn'} ) ) + { + $self->{reloadwarn} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-nomultiline'} ) ) + { + $self->{nomultiline} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-allowcontinue'} ) ) + { + $self->{allowcontinue} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-allowempty'} ) ) + { + $self->{allowempty} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-negativedeltas'} ) ) + { + $self->{negativedeltas} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-commentchar'} ) ) + { + if ( !defined $v || length($v) != 1 ) + { + carp "Comment character must be unique."; + $errs++; + } + elsif ( $v =~ /[\[\]=\w]/ ) + { + # must not be square bracket, equal sign or alphanumeric + carp "Illegal comment character."; + $errs++; + } + else + { + $self->{comment_char} = $v; + } + } + if ( defined( $v = delete $parms{'-allowedcommentchars'} ) ) + { + # must not be square bracket, equal sign or alphanumeric + if ( !defined $v || $v =~ /[\[\]=\w]/ ) + { + carp "Illegal value for -allowedcommentchars."; + $errs++; + } + else + { + $self->{allowed_comment_char} = $v; + } + } + + if ( defined( $v = delete $parms{'-handle_trailing_comment'} ) ) + { + $self->{handle_trailing_comment} = $v ? 1 : 0; + } + if ( defined( $v = delete $parms{'-php_compat'} ) ) + { + $self->{php_compat} = $v ? 1 : 0; + } + + $self->{comment_char} = '#' unless exists $self->{comment_char}; + $self->{allowed_comment_char} = ';' + unless exists $self->{allowed_comment_char}; + + # make sure that comment character is always allowed + $self->{allowed_comment_char} .= $self->{comment_char}; + + $self->{_comments_at_end_of_file} = []; + + # Any other parameters are unknown + while ( ( $k, $v ) = each %parms ) + { + carp "Unknown named parameter $k=>$v"; + $errs++; + } + + return undef if $errs; + + if ( $self->ReadConfig ) + { + return $self; + } + else + { + return undef; } +} + + +sub _caseify +{ + my ( $self, @refs ) = @_; - foreach my $ref (@refs) { - ${$ref} = lc(${$ref}) + if ( $self->_nocase ) + { + foreach my $ref (grep { defined } @refs[0..1]) + { + ${$ref} = lc( ${$ref} ); + } + } + + if ( $self->{php_compat} ) + { + foreach my $ref (grep { defined } @refs[1..1]) + { + ${$ref} =~ s{\[\]$}{}; + } + foreach my $ref (grep { defined } @refs[2..$#refs]) + { + if (length(${$ref}) >= 2) + { + my $quote = substr(${$ref}, 0, 1); + if (($quote eq q{"} or $quote eq q{'}) and substr(${$ref}, -1, 1) eq $quote) + { + ${$ref} = substr(${$ref}, 1, -1); + ${$ref} =~ s{$quote$quote}{}g; + ${$ref} =~ s{\\$quote}{$quote}g if $quote eq q{"}; + } + } + } } return; @@ -175,26 +225,25 @@ sub val { - my ($self, $sect, $parm, $def) = @_; + my ( $self, $sect, $parm, $def ) = @_; # Always return undef on bad parameters - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); my $val_sect = - defined($self->{v}{$sect}{$parm}) - ? $sect - : $self->{default} - ; + defined( $self->{v}{$sect}{$parm} ) + ? $sect + : $self->{default}; my $val = $self->{v}{$val_sect}{$parm}; # If the value is undef, make it $def instead (which could just be undef) - if (!defined ($val)) + if ( !defined($val) ) { $val = $def; } @@ -202,11 +251,11 @@ # Return the value in the desired context if (wantarray) { - if (ref($val) eq "ARRAY") + if ( ref($val) eq "ARRAY" ) { return @$val; } - elsif (defined($val)) + elsif ( defined($val) ) { return $val; } @@ -215,9 +264,9 @@ return; } } - elsif (ref($val) eq "ARRAY") + elsif ( ref($val) eq "ARRAY" ) { - return join( (defined($/) ? $/ : "\n"), @$val); + return join( ( defined($/) ? $/ : "\n" ), @$val ); } else { @@ -226,69 +275,77 @@ } -sub exists { - my ($self, $sect, $parm) = @_; +sub exists +{ + my ( $self, $sect, $parm ) = @_; - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - return (exists $self->{v}{$sect}{$parm}); + return ( exists $self->{v}{$sect}{$parm} ); } +sub push +{ + my ( $self, $sect, $parm, @vals ) = @_; + return undef if not defined $sect; + return undef if not defined $parm; -sub push { - my ($self, $sect, $parm, @vals) = @_; - - return undef if not defined $sect; - return undef if not defined $parm; - - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - return undef if (! defined($self->{v}{$sect}{$parm})); + return undef if ( !defined( $self->{v}{$sect}{$parm} ) ); - return 1 if (! @vals); + return 1 if ( !@vals ); - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); - $self->{EOT}{$sect}{$parm} = 'EOT' if - (!defined $self->{EOT}{$sect}{$parm}); + $self->{EOT}{$sect}{$parm} = 'EOT' + if ( !defined $self->{EOT}{$sect}{$parm} ); - $self->{v}{$sect}{$parm} = [$self->{v}{$sect}{$parm}] unless - (ref($self->{v}{$sect}{$parm}) eq "ARRAY"); + $self->{v}{$sect}{$parm} = [ $self->{v}{$sect}{$parm} ] + unless ( ref( $self->{v}{$sect}{$parm} ) eq "ARRAY" ); - CORE::push @{$self->{v}{$sect}{$parm}}, @vals; - return 1; + CORE::push @{ $self->{v}{$sect}{$parm} }, @vals; + return 1; } -sub setval { - my $self = shift; - my $sect = shift; - my $parm = shift; - my @val = @_; +sub setval +{ + my $self = shift; + my $sect = shift; + my $parm = shift; + my @val = @_; - return undef if not defined $sect; - return undef if not defined $parm; + return undef if not defined $sect; + return undef if not defined $parm; - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - if (defined($self->{v}{$sect}{$parm})) { - $self->_touch_parameter($sect, $parm); - if (@val > 1) { - $self->{v}{$sect}{$parm} = \@val; - $self->{EOT}{$sect}{$parm} = 'EOT'; - } else { - $self->{v}{$sect}{$parm} = shift @val; + if ( defined( $self->{v}{$sect}{$parm} ) ) + { + $self->_touch_parameter( $sect, $parm ); + if ( @val > 1 ) + { + $self->{v}{$sect}{$parm} = \@val; + $self->{EOT}{$sect}{$parm} = 'EOT'; + } + else + { + $self->{v}{$sect}{$parm} = shift @val; + } + return 1; + } + else + { + return undef; } - return 1; - } else { - return undef; - } } -sub newval { +sub newval +{ my $self = shift; my $sect = shift; my $parm = shift; @@ -297,30 +354,34 @@ return undef if not defined $sect; return undef if not defined $parm; - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); $self->AddSection($sect); - if (none { $_ eq $parm } @{$self->{parms}{$sect}}) + if ( none { $_ eq $parm } @{ $self->{parms}{$sect} } ) { - CORE::push(@{$self->{parms}{$sect}}, $parm) + CORE::push( @{ $self->{parms}{$sect} }, $parm ); } - $self->_touch_parameter($sect, $parm); - if (@val > 1) { + $self->_touch_parameter( $sect, $parm ); + if ( @val > 1 ) + { $self->{v}{$sect}{$parm} = \@val; - if (!defined $self->{EOT}{$sect}{$parm}) + if ( !defined $self->{EOT}{$sect}{$parm} ) { $self->{EOT}{$sect}{$parm} = 'EOT'; } - } else { + } + else + { $self->{v}{$sect}{$parm} = shift @val; } - return 1 + return 1; } -sub delval { +sub delval +{ my $self = shift; my $sect = shift; my $parm = shift; @@ -328,10 +389,10 @@ return undef if not defined $sect; return undef if not defined $parm; - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - $self->{parms}{$sect} = [grep {$_ ne $parm} @{$self->{parms}{$sect}}]; - $self->_touch_parameter($sect, $parm); + $self->{parms}{$sect} = [ grep { $_ ne $parm } @{ $self->{parms}{$sect} } ]; + $self->_touch_parameter( $sect, $parm ); delete $self->{v}{$sect}{$parm}; return 1; @@ -341,21 +402,26 @@ # Auxiliary function to make deep (aliasing-free) copies of data # structures. Ignores blessed objects in tree (could be taught not # to, if needed) -sub _deepcopy { +sub _deepcopy +{ my $ref = shift; - if (! ref($ref)) { + if ( !ref($ref) ) + { return $ref; } - if (UNIVERSAL::isa($ref, "ARRAY")) { - return [map {_deepcopy($_)} @$ref]; + if ( UNIVERSAL::isa( $ref, "ARRAY" ) ) + { + return [ map { _deepcopy($_) } @$ref ]; } - if (UNIVERSAL::isa($ref, "HASH")) { + if ( UNIVERSAL::isa( $ref, "HASH" ) ) + { my $return = {}; - foreach my $k (keys %$ref) { - $return->{$k} = _deepcopy($ref->{$k}); + foreach my $k ( keys %$ref ) + { + $return->{$k} = _deepcopy( $ref->{$k} ); } return $return; } @@ -364,27 +430,34 @@ } # Internal method, gets the next line, taking proper care of line endings. -sub _nextline { - my ($self, $fh) = @_; - local $_; - if (!exists $self->{line_ends}) { +sub _nextline +{ + my ( $self, $fh ) = @_; + my $s = ''; + if ( !exists $self->{line_ends} ) + { # no $self->{line_ends} is a hint set by caller that we are at # the first line (kludge kludge). { - local $/=\1; + local $/ = \1; my $nextchar; - do { - $nextchar=<$fh>; - return undef if (!defined $nextchar); - $_ .= $nextchar; - } until (m/((\015|\012|\025|\n)$)/s); - $self->{line_ends}=$1; - if ($nextchar eq "\x0d") { + do + { + $nextchar = <$fh>; + return undef if ( !defined $nextchar ); + $s .= $nextchar; + } until ($s =~ m/((\015|\012|\025|\n)$)/s); + $self->{line_ends} = $1; + if ( $nextchar eq "\x0d" ) + { # peek at the next char $nextchar = <$fh>; - if ($nextchar eq "\x0a") { + if ( $nextchar eq "\x0a" ) + { $self->{line_ends} .= "\x0a"; - } else { + } + else + { seek $fh, -1, SEEK_CUR(); } } @@ -393,27 +466,34 @@ # If there's a UTF BOM (Byte-Order-Mark) in the first # character of the first line then remove it before processing # ( http://www.unicode.org/unicode/faq/utf_bom.html#22 ) - s/^//; + $s =~ s/\A//; - return $_; - } else { - local $/=$self->{line_ends}; + return $s; + } + else + { + local $/ = $self->{line_ends}; return scalar <$fh>; } } # Internal method, closes or resets the file handle. To be called # whenever ReadConfig() returns. -sub _rollback { - my ($self, $fh) = @_; - # Only close if this is a filename, if it's - # an open handle, then just roll back to the start - if( !ref($self->{cf}) ) { - close($fh); - } else { - # Attempt to rollback to beginning, no problem if this fails (e.g. STDIN) - seek( $fh, 0, SEEK_SET() ); - } # end if +sub _rollback +{ + my ( $self, $fh ) = @_; + + # Only close if this is a filename, if it's + # an open handle, then just roll back to the start + if ( !ref( $self->{cf} ) ) + { + close($fh); + } + else + { + # Attempt to rollback to beginning, no problem if this fails (e.g. STDIN) + seek( $fh, 0, SEEK_SET() ); + } # end if } sub _no_filename @@ -422,7 +502,7 @@ my $fn = $self->{cf}; - return (not (defined($fn) && length($fn))); + return ( not( defined($fn) && length($fn) ) ); } sub _read_line_num @@ -440,16 +520,16 @@ # Reads the next line and removes the end of line from it. sub _read_next_line { - my ($self, $fh) = @_; + my ( $self, $fh ) = @_; my $line = $self->_nextline($fh); - if (! defined($line)) + if ( !defined($line) ) { return undef; } - $self->_read_line_num( $self->_read_line_num() + 1); + $self->_read_line_num( $self->_read_line_num() + 1 ); # Remove line ending char(s) $line =~ s/(\015\012?|\012|\025|\n)\z//; @@ -459,9 +539,9 @@ sub _add_error { - my ($self, $msg) = @_; + my ( $self, $msg ) = @_; - CORE::push(@Config::IniFiles::errors, $msg); + CORE::push( @Config::IniFiles::errors, $msg ); return; } @@ -497,7 +577,7 @@ { my $self = shift; - return ($self->_curr_sect, $self->_curr_parm); + return ( $self->_curr_sect, $self->_curr_parm ); } # The current value - used in parsing. @@ -542,24 +622,24 @@ sub _ReadConfig_handle_comment { - my ($self, $line) = @_; + my ( $self, $line ) = @_; - if ($self->{negativedeltas} and - my ($to_delete) = $line =~ m/\A$self->{comment_char} (.*) is deleted\z/ - ) + if ( $self->{negativedeltas} + and my ($to_delete) = + $line =~ m/\A$self->{comment_char} (.*) is deleted\z/ ) { - if (my ($sect) = $to_delete =~ m/\A\[(.*)\]\z/) + if ( my ($sect) = $to_delete =~ m/\A\[(.*)\]\z/ ) { $self->DeleteSection($sect); } else { - $self->delval($self->_curr_sect, $to_delete); + $self->delval( $self->_curr_sect, $to_delete ); } } else { - CORE::push(@{$self->_curr_cmts}, $line); + CORE::push( @{ $self->_curr_cmts }, $line ); } return $RET_CONTINUE; @@ -567,14 +647,14 @@ sub _ReadConfig_new_section { - my ($self, $sect) = @_; + my ( $self, $sect ) = @_; - $self->_caseify(\$sect); + $self->_caseify( undef, \$sect ); $self->_curr_sect($sect); - $self->AddSection($self->_curr_sect); - $self->SetSectionComment($self->_curr_sect, @{$self->_curr_cmts}); - $self->_curr_cmts([]); + $self->AddSection( $self->_curr_sect ); + $self->SetSectionComment( $self->_curr_sect, @{ $self->_curr_cmts } ); + $self->_curr_cmts( [] ); return $RET_CONTINUE; } @@ -583,9 +663,9 @@ { my ($self) = @_; - if ((!defined($self->_curr_sect)) and defined($self->{fallback})) + if ( ( !defined( $self->_curr_sect ) ) and defined( $self->{fallback} ) ) { - $self->_curr_sect($self->{fallback}); + $self->_curr_sect( $self->{fallback} ); $self->{fallback_used}++; } @@ -594,20 +674,20 @@ sub _ReadConfig_load_value { - my ($self, $val_aref) = @_; + my ( $self, $val_aref ) = @_; # Now load value - if (exists $self->{v}{$self->_curr_sect}{$self->_curr_parm} && - exists $self->{myparms}{$self->_curr_sect} && - $self->_is_parm_in_sect($self->_curr_loc)) + if ( exists $self->{v}{ $self->_curr_sect }{ $self->_curr_parm } + && exists $self->{myparms}{ $self->_curr_sect } + && $self->_is_parm_in_sect( $self->_curr_loc ) ) { - $self->push($self->_curr_loc, @$val_aref); + $self->push( $self->_curr_loc, @$val_aref ); } else { # Loaded parameters shadow imported ones, instead of appending # to them - $self->newval($self->_curr_loc, @$val_aref); + $self->newval( $self->_curr_loc, @$val_aref ); } return; @@ -615,15 +695,16 @@ sub _test_for_fallback_or_no_sect { - my ($self, $fh) = @_; + my ( $self, $fh ) = @_; $self->_handle_fallback_sect; - if (!defined $self->_curr_sect) { + if ( !defined $self->_curr_sect ) + { $self->_add_error( - sprintf('%d: %s', $self->_read_line_num(), - qq#parameter found outside a section# - ) + sprintf( '%d: %s', + $self->_read_line_num(), + qq#parameter found outside a section# ) ); $self->_rollback($fh); return $RET_BREAK; @@ -634,15 +715,15 @@ sub _ReadConfig_handle_here_doc_param { - my ($self, $fh, $eotmark, $val_aref) = @_; + my ( $self, $fh, $eotmark, $val_aref ) = @_; - my $foundeot = 0; + my $foundeot = 0; my $startline = $self->_read_line_num(); - HERE_DOC_LOOP: - while (defined( my $line = $self->_read_next_line($fh) )) +HERE_DOC_LOOP: + while ( defined( my $line = $self->_read_next_line($fh) ) ) { - if ($line eq $eotmark) + if ( $line eq $eotmark ) { $foundeot = 1; last HERE_DOC_LOOP; @@ -651,14 +732,16 @@ { # Untaint my ($contents) = $line =~ /(.*)/ms; - CORE::push(@$val_aref, $contents); + CORE::push( @$val_aref, $contents ); } } - if (! $foundeot) + if ( !$foundeot ) { - $self->_add_error(sprintf('%d: %s', $startline, - qq#no end marker ("$eotmark") found#)); + $self->_add_error( + sprintf( '%d: %s', + $startline, qq#no end marker ("$eotmark") found# ) + ); $self->_rollback(); return $RET_BREAK; } @@ -668,17 +751,18 @@ sub _ReadConfig_handle_non_here_doc_param { - my ($self, $fh, $val_aref) = @_; + my ( $self, $fh, $val_aref ) = @_; - my $allCmt = $self->{allowed_comment_char}; + my $allCmt = $self->{allowed_comment_char}; my $end_commenthandle = $self->{handle_trailing_comment}; # process continuation lines, if any $self->_process_continue_val($fh); # we should split value and comments if there is any comment - if ($end_commenthandle and - my ($value_to_assign, $end_comment_to_assign) = $self->_curr_val =~ /(.*?)\s*[$allCmt]\s*(.*)$/) + if ( $end_commenthandle + and my ( $value_to_assign, $end_comment_to_assign ) = + $self->_curr_val =~ /(.*?)\s*[$allCmt]\s*(.*)$/ ) { $self->_curr_val($value_to_assign); $self->_curr_end_comment($end_comment_to_assign); @@ -688,54 +772,60 @@ $self->_curr_end_comment(q{}); } - @{$val_aref} = ($self->_curr_val); + @{$val_aref} = ( $self->_curr_val ); return; } - sub _ReadConfig_populate_values { - my ($self, $val_aref, $eotmark) = @_; + my ( $self, $val_aref, $eotmark ) = @_; $self->_ReadConfig_load_value($val_aref); - $self->SetParameterComment($self->_curr_loc, @{ $self->_curr_cmts }); - $self->_curr_cmts([]); - if (defined $eotmark) + $self->SetParameterComment( $self->_curr_loc, @{ $self->_curr_cmts } ); + $self->_curr_cmts( [] ); + if ( defined $eotmark ) { - $self->SetParameterEOT($self->_curr_loc, $eotmark); + $self->SetParameterEOT( $self->_curr_loc, $eotmark ); } - # if handle_trailing_comment is off, this line makes no sense, since all $end_comment="" - $self->SetParameterTrailingComment($self->_curr_loc, $self->_curr_end_comment); + +# if handle_trailing_comment is off, this line makes no sense, since all $end_comment="" + $self->SetParameterTrailingComment( $self->_curr_loc, + $self->_curr_end_comment ); return; } sub _ReadConfig_param_assignment { - my ($self, $fh, $line, $parm, $value_to_assign) = @_; + my ( $self, $fh, $line, $parm, $value_to_assign ) = @_; + + $self->_caseify( undef, \$parm, \$value_to_assign ); $self->_curr_val($value_to_assign); - $self->_curr_end_comment(undef()); + $self->_curr_end_comment( undef() ); - if (!defined( $self->_test_for_fallback_or_no_sect($fh) )) + if ( !defined( $self->_test_for_fallback_or_no_sect($fh) ) ) { + return $RET_BREAK; } - $self->_caseify(\$parm); $self->_curr_parm($parm); - my @val = ( ); + my @val = (); my $eotmark; - if (($eotmark) = $self->_curr_val =~ /\A<<(.*)$/) + if ( ($eotmark) = $self->_curr_val =~ /\A<<(.*)$/ ) { - if (! defined($self->_ReadConfig_handle_here_doc_param( + if ( + !defined( + $self->_ReadConfig_handle_here_doc_param( $fh, $eotmark, \@val - )) - ) + ) + ) + ) { return $RET_BREAK; } @@ -745,7 +835,7 @@ $self->_ReadConfig_handle_non_here_doc_param( $fh, \@val ); } - $self->_ReadConfig_populate_values(\@val, $eotmark); + $self->_ReadConfig_populate_values( \@val, $eotmark ); return $RET_CONTINUE; } @@ -753,37 +843,41 @@ # Return 1 to continue - undef to terminate the loop. sub _ReadConfig_handle_line { - my ($self, $fh, $line) = @_; + my ( $self, $fh, $line ) = @_; my $allCmt = $self->{allowed_comment_char}; # ignore blank lines - if ($line =~ /\A\s*\z/) + if ( $line =~ /\A\s*\z/ ) { return $RET_CONTINUE; } # collect comments - if ($line =~/\A\s*[$allCmt]/) + if ( $line =~ /\A\s*[$allCmt]/ ) { return $self->_ReadConfig_handle_comment($line); } # New Section - if (my ($sect) = $line =~ /\A\s*\[\s*(\S|\S.*\S)\s*\]\s*\z/) + if ( my ($sect) = $line =~ /\A\s*\[\s*(\S|\S.*\S)\s*\]\s*\z/ ) { return $self->_ReadConfig_new_section($sect); } # New parameter - if (my ($parm, $value_to_assign) = $line =~ /^\s*([^=]*?[^=\s])\s*=\s*(.*)$/) + if ( my ( $parm, $value_to_assign ) = + $line =~ /^\s*([^=]*?[^=\s])\s*=\s*(.*)$/ ) { - return $self->_ReadConfig_param_assignment($fh, $line, $parm, $value_to_assign); + return $self->_ReadConfig_param_assignment( $fh, $line, $parm, + $value_to_assign ); } $self->_add_error( - sprintf("Line %d in file %s is malformed:\n\t\%s", - $self->_read_line_num(), $self->GetFileName(), $line + sprintf( + "Line %d in file %s is malformed:\n\t\%s", + $self->_read_line_num(), + $self->GetFileName(), $line ) ); @@ -792,19 +886,17 @@ sub _ReadConfig_lines_loop { - my ($self, $fh) = @_; + my ( $self, $fh ) = @_; - $self->_curr_sect(undef()); - $self->_curr_parm(undef()); - $self->_curr_val(undef()); - $self->_curr_cmts([]); + $self->_curr_sect( undef() ); + $self->_curr_parm( undef() ); + $self->_curr_val( undef() ); + $self->_curr_cmts( [] ); - while ( defined(my $line = $self->_read_next_line($fh)) ) + while ( defined( my $line = $self->_read_next_line($fh) ) ) { - if (!defined( - scalar( $self->_ReadConfig_handle_line($fh, $line) ) - ) - ) + if ( + !defined( scalar( $self->_ReadConfig_handle_line( $fh, $line ) ) ) ) { return undef; } @@ -817,124 +909,122 @@ { my $self = shift; - @Config::IniFiles::errors = ( ); + @Config::IniFiles::errors = (); # Initialize (and clear out) storage hashes - $self->{sects} = []; - $self->{parms} = {}; - $self->{group} = {}; - $self->{v} = {}; - $self->{sCMT} = {}; - $self->{pCMT} = {}; - $self->{EOT} = {}; - $self->{mysects} = []; # A pair of hashes to remember which params are loaded - $self->{myparms} = {}; # or set using the API vs. imported - useful for - $self->{peCMT} = {}; # this will store trailing comments at the end of single-line params - $self->{e} = {}; # If a section already exists - $self->{mye} = {}; # If a section already exists - # import shadowing, see below, and WriteConfig($fn, -delta=>1) - - if( defined $self->{imported} ) { - # Run up the import tree to the top, then reload coming - # back down, maintaining the imported file names and our - # file name. - # This is only needed on a reload though - $self->{imported}->ReadConfig() unless ($self->{firstload}); + $self->{sects} = []; + $self->{parms} = {}; + $self->{group} = {}; + $self->{v} = {}; + $self->{sCMT} = {}; + $self->{pCMT} = {}; + $self->{EOT} = {}; + $self->{mysects} = + []; # A pair of hashes to remember which params are loaded + $self->{myparms} = {}; # or set using the API vs. imported - useful for + $self->{peCMT} = + {}; # this will store trailing comments at the end of single-line params + $self->{e} = {}; # If a section already exists + $self->{mye} = {}; # If a section already exists + # import shadowing, see below, and WriteConfig($fn, -delta=>1) - foreach my $field (qw(sects parms group v sCMT pCMT EOT e)) { - $self->{$field} = _deepcopy($self->{imported}->{$field}); + if ( defined $self->{imported} ) + { + foreach my $field (qw(sects parms group v sCMT pCMT EOT e)) + { + $self->{$field} = _deepcopy( $self->{imported}->{$field} ); } - } # end if + } - if ($self->_no_filename) + if ( $self->_no_filename ) { return 1; } - # If this is a reload and we want warnings then send one to the STDERR log - unless( $self->{firstload} || !$self->{reloadwarn} ) { - my ($ss, $mm, $hh, $DD, $MM, $YY) = (localtime(time))[0..5]; + # If we want warnings, then send one to the STDERR log + if ( $self->{reloadwarn} ) + { + my ( $ss, $mm, $hh, $DD, $MM, $YY ) = ( localtime(time) )[ 0 .. 5 ]; printf STDERR - "PID %d reloading config file %s at %d.%02d.%02d %02d:%02d:%02d\n", - $$, $self->{cf}, $YY+1900, $MM+1, $DD, $hh, $mm, $ss; + "PID %d reloading config file %s at %d.%02d.%02d %02d:%02d:%02d\n", + $$, $self->{cf}, $YY + 1900, $MM + 1, $DD, $hh, $mm, $ss; } - # Turn off. Future loads are reloads - $self->{firstload} = 0; - # Get a filehandle, allowing almost any type of 'file' parameter my $fh = $self->_make_filehandle( $self->{cf} ); - if (!$fh) { + if ( !$fh ) + { carp "Failed to open $self->{cf}: $!"; return undef; } - # Get mod time of file so we can retain it (if not from STDIN) - # also check if it's a real file (could have been a filehandle made from a scalar). - if (ref($fh) ne "IO::Scalar" && -e $fh) +# Get mod time of file so we can retain it (if not from STDIN) +# also check if it's a real file (could have been a filehandle made from a scalar). + if ( ref($fh) ne "IO::Scalar" && -e $fh ) { my @stats = stat $fh; - $self->{file_mode} = sprintf("%04o", $stats[2]) if defined $stats[2]; + $self->{file_mode} = sprintf( "%04o", $stats[2] ) if defined $stats[2]; } - # The first lines of the file must be blank, comments or start with [ my $first = ''; - delete $self->{line_ends}; # Marks start of parsing for _nextline() + delete $self->{line_ends}; # Marks start of parsing for _nextline() $self->_read_line_num(0); - if (!defined($self->_ReadConfig_lines_loop($fh))) + if ( !defined( $self->_ReadConfig_lines_loop($fh) ) ) { return undef; } # Special case: return undef if file is empty. (suppress this line to # restore the more intuitive behaviour of accepting empty files) - if (! keys %{$self->{v}} && ! $self->{allowempty}) { + if ( !keys %{ $self->{v} } && !$self->{allowempty} ) + { $self->_add_error("Empty file treated as error"); $self->_rollback($fh); return undef; } - if ( defined (my $defaultsect=$self->{startup_settings}->{-default}) ) + if ( defined( my $defaultsect = $self->{startup_settings}->{-default} ) ) { $self->AddSection($defaultsect); } - $self->_SetEndComments(@{ $self->_curr_cmts }); + $self->_SetEndComments( @{ $self->_curr_cmts } ); $self->_rollback($fh); - return (@Config::IniFiles::errors ? undef : 1); + return ( @Config::IniFiles::errors ? undef : 1 ); } - -sub Sections { +sub Sections +{ my $self = shift; - return @{_aref_or_empty($self->{sects})}; + return @{ _aref_or_empty( $self->{sects} ) }; } -sub SectionExists { +sub SectionExists +{ my $self = shift; my $sect = shift; return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); - return ((exists $self->{e}{$sect}) ? 1 : 0); + return ( ( exists $self->{e}{$sect} ) ? 1 : 0 ); } sub _AddSection_Helper { - my ($self, $sect) = @_; + my ( $self, $sect ) = @_; $self->{e}{$sect} = 1; - CORE::push @{$self->{sects}}, $sect; + CORE::push @{ $self->{sects} }, $sect; $self->_touch_section($sect); $self->SetGroupMember($sect); @@ -942,24 +1032,26 @@ # Set up the parameter names and values lists $self->{parms}{$sect} ||= []; - if (!defined($self->{v}{$sect})) { - $self->{sCMT}{$sect} = []; - $self->{pCMT}{$sect} = {}; # Comments above parameters + if ( !defined( $self->{v}{$sect} ) ) + { + $self->{sCMT}{$sect} = []; + $self->{pCMT}{$sect} = {}; # Comments above parameters $self->{parms}{$sect} = []; - $self->{v}{$sect} = {}; + $self->{v}{$sect} = {}; } return; } -sub AddSection { - my ($self, $sect) = @_; +sub AddSection +{ + my ( $self, $sect ) = @_; return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); - if ( $self->SectionExists($sect)) + if ( $self->SectionExists($sect) ) { return; } @@ -968,14 +1060,15 @@ } # Marks a section as modified by us (this includes deleted by us). -sub _touch_section { - my ($self, $sect) = @_; +sub _touch_section +{ + my ( $self, $sect ) = @_; $self->{mysects} ||= []; - unless (exists $self->{mye}{$sect}) + unless ( exists $self->{mye}{$sect} ) { - CORE::push @{$self->{mysects}}, $sect; + CORE::push @{ $self->{mysects} }, $sect; $self->{mye}{$sect} = 1; } @@ -983,30 +1076,31 @@ } # Marks a parameter as modified by us (this includes deleted by us). -sub _touch_parameter { - my ($self, $sect, $parm) = @_; +sub _touch_parameter +{ + my ( $self, $sect, $parm ) = @_; $self->_touch_section($sect); - return if (!exists $self->{v}{$sect}); + return if ( !exists $self->{v}{$sect} ); $self->{myparms}{$sect} ||= []; - if (! $self->_is_parm_in_sect($sect, $parm)) + if ( !$self->_is_parm_in_sect( $sect, $parm ) ) { - CORE::push @{$self->{myparms}{$sect}}, $parm; + CORE::push @{ $self->{myparms}{$sect} }, $parm; } return; } - -sub DeleteSection { +sub DeleteSection +{ my $self = shift; my $sect = shift; return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); # This is done the fast way, change if data structure changes!! delete $self->{v}{$sect}; @@ -1017,76 +1111,86 @@ delete $self->{myparms}{$sect}; delete $self->{e}{$sect}; - $self->{sects} = [grep {$_ ne $sect} @{$self->{sects}}]; + $self->{sects} = [ grep { $_ ne $sect } @{ $self->{sects} } ]; $self->_touch_section($sect); $self->RemoveGroupMember($sect); return 1; -} # end DeleteSection +} # end DeleteSection -sub RenameSection { - my $self = shift; - my $old_sect = shift; - my $new_sect = shift; +sub RenameSection +{ + my $self = shift; + my $old_sect = shift; + my $new_sect = shift; my $include_groupmembers = shift; - return undef unless $self->CopySection($old_sect,$new_sect,$include_groupmembers); + return undef + unless $self->CopySection( $old_sect, $new_sect, + $include_groupmembers ); return $self->DeleteSection($old_sect); -} # end RenameSection +} # end RenameSection -sub CopySection { - my $self = shift; - my $old_sect = shift; - my $new_sect = shift; +sub CopySection +{ + my $self = shift; + my $old_sect = shift; + my $new_sect = shift; my $include_groupmembers = shift; - if (not defined $old_sect or - not defined $new_sect or - !$self->SectionExists($old_sect) or - $self->SectionExists($new_sect)) { + if ( not defined $old_sect + or not defined $new_sect + or !$self->SectionExists($old_sect) + or $self->SectionExists($new_sect) ) + { return undef; } - $self->_caseify(\$new_sect); + $self->_caseify( \$new_sect ); $self->_AddSection_Helper($new_sect); # This is done the fast way, change if data structure changes!! - foreach my $key (qw(v sCMT pCMT EOT parms myparms e)) { + foreach my $key (qw(v sCMT pCMT EOT parms myparms e)) + { next unless exists $self->{$key}{$old_sect}; - $self->{$key}{$new_sect} = Config::IniFiles::_deepcopy($self->{$key}{$old_sect}); + $self->{$key}{$new_sect} = + Config::IniFiles::_deepcopy( $self->{$key}{$old_sect} ); } - if($include_groupmembers) { - foreach my $old_groupmember ($self->GroupMembers($old_sect)) { + if ($include_groupmembers) + { + foreach my $old_groupmember ( $self->GroupMembers($old_sect) ) + { my $new_groupmember = $old_groupmember; $new_groupmember =~ s/\A\Q$old_sect\E/$new_sect/; - $self->CopySection($old_groupmember,$new_groupmember); + $self->CopySection( $old_groupmember, $new_groupmember ); } } return 1; -} # end CopySection +} # end CopySection sub _aref_or_empty { my ($aref) = @_; - return ((defined($aref) and ref($aref) eq 'ARRAY') ? $aref : []); + return ( ( defined($aref) and ref($aref) eq 'ARRAY' ) ? $aref : [] ); } -sub Parameters { +sub Parameters +{ my $self = shift; my $sect = shift; return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); - return @{_aref_or_empty($self->{parms}{$sect})}; + return @{ _aref_or_empty( $self->{parms}{$sect} ) }; } @@ -1094,9 +1198,9 @@ { my $self = shift; - if (ref($self->{group}) eq 'HASH') + if ( ref( $self->{group} ) eq 'HASH' ) { - return keys %{$self->{group}}; + return keys %{ $self->{group} }; } else { @@ -1107,86 +1211,92 @@ sub _group_member_handling_skeleton { - my ($self, $sect, $method) = @_; + my ( $self, $sect, $method ) = @_; return undef if not defined $sect; - if (! (my ($group) = ($sect =~ /\A(\S+)\s+\S/))) + if ( !( my ($group) = ( $sect =~ /\A(\S+)\s+\S/ ) ) ) { return 1; } else { - return $self->$method($sect, $group); + return $self->$method( $sect, $group ); } } sub _SetGroupMember_helper { - my ($self, $sect, $group) = @_; + my ( $self, $sect, $group ) = @_; - if (not exists($self->{group}{$group})) { + if ( not exists( $self->{group}{$group} ) ) + { $self->{group}{$group} = []; } - if (none {$_ eq $sect} @{$self->{group}{$group}}) { - CORE::push @{$self->{group}{$group}}, $sect; + if ( none { $_ eq $sect } @{ $self->{group}{$group} } ) + { + CORE::push @{ $self->{group}{$group} }, $sect; } return; } -sub SetGroupMember { - my ($self, $sect) = @_; +sub SetGroupMember +{ + my ( $self, $sect ) = @_; - return $self->_group_member_handling_skeleton($sect, '_SetGroupMember_helper'); + return $self->_group_member_handling_skeleton( $sect, + '_SetGroupMember_helper' ); } sub _RemoveGroupMember_helper { - my ($self, $sect, $group) = @_; + my ( $self, $sect, $group ) = @_; - if (!exists $self->{group}{$group}) + if ( !exists $self->{group}{$group} ) { return; } $self->{group}{$group} = - [grep { $_ ne $sect } @{$self->{group}{$group}}]; + [ grep { $_ ne $sect } @{ $self->{group}{$group} } ]; return; } sub RemoveGroupMember { - my ($self, $sect) = @_; + my ( $self, $sect ) = @_; - return $self->_group_member_handling_skeleton($sect, '_RemoveGroupMember_helper'); + return $self->_group_member_handling_skeleton( $sect, + '_RemoveGroupMember_helper' ); } -sub GroupMembers { - my ($self, $group) = @_; +sub GroupMembers +{ + my ( $self, $group ) = @_; return undef if not defined $group; - $self->_caseify(\$group); + $self->_caseify( \$group ); - return @{_aref_or_empty($self->{group}{$group})}; + return @{ _aref_or_empty( $self->{group}{$group} ) }; } sub SetWriteMode { - my ($self, $mode) = @_; + my ( $self, $mode ) = @_; - if (not (defined($mode) && ($mode =~ m/[0-7]{3}/))) + if ( not( defined($mode) && ( $mode =~ m/[0-7]{3}/ ) ) ) { return undef; } - return ($self->{file_mode} = $mode); + return ( $self->{file_mode} = $mode ); } @@ -1200,37 +1310,37 @@ sub _write_config_to_filename { - my ($self, $filename, %parms) = @_; + my ( $self, $filename, %parms ) = @_; - if (-e $filename) { - if (not (-w $filename)) + if ( -e $filename ) + { + if ( not( -w $filename ) ) { #carp "File $filename is not writable. Refusing to write config"; return undef; } - my $mode = (stat $filename)[2]; - $self->{file_mode} = sprintf "%04o", ($mode & 0777); + my $mode = ( stat $filename )[2]; + $self->{file_mode} = sprintf "%04o", ( $mode & 0777 ); + #carp "Using mode $self->{file_mode} for file $file"; } - my ($fh, $new_file); + my ( $fh, $new_file ); # We need to trap the exception that tempfile() may throw and instead # carp() and return undef() because that was the previous behaviour: # # See RT #77039 ( https://rt.cpan.org/Ticket/Display.html?id=77039 ) eval { - ($fh, $new_file) = tempfile( - "temp.ini-XXXXXXXXXX", - DIR => dirname($filename) - ); + ( $fh, $new_file ) = + tempfile( "temp.ini-XXXXXXXXXX", DIR => dirname($filename) ); # Convert the filehandle to a "text" filehandle suitable for use # on Windows (and other platforms). # # This may break compatibility for ultra-old perls (ones before 5.6.0) # so I say - Good Riddance! - if ($^O =~ m/\AMSWin/) + if ( $^O =~ m/\AMSWin/ ) { binmode $fh, ':crlf'; } @@ -1238,18 +1348,20 @@ if ($@) { - carp( "Unable to write temp config file: $!" ); + carp("Unable to write temp config file: $!"); return undef; } - $self->OutputConfigToFileHandle($fh, $parms{-delta}); + $self->OutputConfigToFileHandle( $fh, $parms{-delta} ); close($fh); - if (!rename( $new_file, $filename )) { + if ( !rename( $new_file, $filename ) ) + { carp "Unable to rename temp config file ($new_file) to ${filename}: $!"; return undef; } - if (exists $self->{file_mode}) { - chmod oct($self->{file_mode}), $filename; + if ( exists $self->{file_mode} ) + { + chmod oct( $self->{file_mode} ), $filename; } return 1; @@ -1257,74 +1369,79 @@ sub _write_config_with_a_made_fh { - my ($self, $fh, %parms) = @_; + my ( $self, $fh, %parms ) = @_; # Only roll back if it's not STDIN (if it is, Carp) - if( $fh == \*STDIN ) + if ( $fh == \*STDIN ) { carp "Cannot write configuration file to STDIN."; } else { seek( $fh, 0, SEEK_SET() ); + # Make sure to keep the previous junk out. # See: # https://rt.cpan.org/Public/Bug/Display.html?id=103496 truncate( $fh, 0 ); - $self->OutputConfigToFileHandle($fh, $parms{-delta}); + $self->OutputConfigToFileHandle( $fh, $parms{-delta} ); seek( $fh, 0, SEEK_SET() ); - } # end if + } # end if return 1; } sub _write_config_to_fh { - my ($self, $file, %parms) = @_; + my ( $self, $file, %parms ) = @_; # Get a filehandle, allowing almost any type of 'file' parameter ## NB: If this were a filename, this would fail because _make_file ## opens a read-only handle, but we have already checked that case ## so re-using the logic is ok [JW/WADG] - my $fh = $self->_make_filehandle( $file ); + my $fh = $self->_make_filehandle($file); - if (!$fh) { + if ( !$fh ) + { carp "Could not find a filehandle for the input stream ($file): $!"; return undef; } - return $self->_write_config_with_a_made_fh($fh, %parms); + return $self->_write_config_with_a_made_fh( $fh, %parms ); } -sub WriteConfig { - my ($self, $file, %parms) = @_; +sub WriteConfig +{ + my ( $self, $file, %parms ) = @_; return undef unless defined $file; # If we are using a filename, then do mode checks and write to a # temporary file to avoid a race condition - if( !ref($file) ) + if ( !ref($file) ) { - return $self->_write_config_to_filename($file, %parms); + return $self->_write_config_to_filename( $file, %parms ); } + # Otherwise, reset to the start of the file and write, unless we are using # STDIN else { - return $self->_write_config_to_fh($file, %parms); + return $self->_write_config_to_fh( $file, %parms ); } } -sub RewriteConfig { +sub RewriteConfig +{ my $self = shift; - if ($self->_no_filename) + if ( $self->_no_filename ) { return 1; } - return $self->WriteConfig($self->{cf}); + return $self->WriteConfig( $self->{cf} ); } @@ -1336,13 +1453,16 @@ } -sub SetFileName { - my ($self, $new_filename) = @_; +sub SetFileName +{ + my ( $self, $new_filename ) = @_; - if ( length($new_filename) > 0 ) { - return ($self->{cf} = $new_filename); + if ( length($new_filename) > 0 ) + { + return ( $self->{cf} = $new_filename ); } - else { + else + { return undef; } } @@ -1350,69 +1470,76 @@ sub _calc_eot_mark { - my ($self, $sect, $parm, $val) = @_; + my ( $self, $sect, $parm, $val ) = @_; my $eotmark = $self->{EOT}{$sect}{$parm} || 'EOT'; # Make sure the $eotmark does not occur inside the string. - my @letters = ('A' .. 'Z'); - my $joined_val = join(q{ }, @$val); - while (index($joined_val, $eotmark) >= 0) + my @letters = ( 'A' .. 'Z' ); + my $joined_val = join( q{ }, @$val ); + while ( index( $joined_val, $eotmark ) >= 0 ) { - $eotmark .= $letters[rand(@letters)]; + $eotmark .= $letters[ rand(@letters) ]; } return $eotmark; } -sub _OutputParam { - my ($self, $sect, $parm, $val, $end_comment, $output_cb) = @_; +sub _OutputParam +{ + my ( $self, $sect, $parm, $val, $end_comment, $output_cb ) = @_; my $line_loop = sub { my ($mapper) = @_; - foreach my $line (@{$val}[0 .. $#$val-1]) { - $output_cb->($mapper->($line)); + foreach my $line ( @{$val}[ 0 .. $#$val - 1 ] ) + { + $output_cb->( $mapper->($line) ); } $output_cb->( - $mapper->($val->[-1]), - ($end_comment ? (" $self->{comment_char} $end_comment") : ()), + $mapper->( $val->[-1] ), + ( $end_comment ? (" $self->{comment_char} $end_comment") : () ), ); return; }; - if (! @$val) { + if ( !@$val ) + { # An empty variable - see: # https://rt.cpan.org/Public/Bug/Display.html?id=68554 $output_cb->("$parm="); } - elsif ((@$val == 1) or $self->{nomultiline}) { - $line_loop->(sub { my ($line) = @_; return "$parm=$line"; }); + elsif ( ( @$val == 1 ) or $self->{nomultiline} ) + { + $line_loop->( sub { my ($line) = @_; return "$parm=$line"; } ); } else { - my $eotmark = $self->_calc_eot_mark($sect, $parm, $val); + my $eotmark = $self->_calc_eot_mark( $sect, $parm, $val ); $output_cb->("$parm= <<$eotmark"); - $line_loop->(sub { my ($line) = @_; return $line; }); + $line_loop->( sub { my ($line) = @_; return $line; } ); $output_cb->($eotmark); } return; } -sub OutputConfig { - my ($self, $delta) = @_; +sub OutputConfig +{ + my ( $self, $delta ) = @_; - return $self->OutputConfigToFileHandle(select(), $delta); + return $self->OutputConfigToFileHandle( select(), $delta ); } sub _output_comments { - my ($self, $print_line, $comments_aref) = @_; + my ( $self, $print_line, $comments_aref ) = @_; - if (ref($comments_aref) eq 'ARRAY') { - foreach my $comment (@$comments_aref) { + if ( ref($comments_aref) eq 'ARRAY' ) + { + foreach my $comment (@$comments_aref) + { $print_line->($comment); } } @@ -1422,16 +1549,17 @@ sub _process_continue_val { - my ($self, $fh) = @_; + my ( $self, $fh ) = @_; - if (not $self->{allowcontinue}) + if ( not $self->{allowcontinue} ) { return; } my $val = $self->_curr_val; - while($val =~ s/\\\z//) { + while ( $val =~ s/\\\z// ) + { $val .= $self->_read_next_line($fh); } @@ -1442,97 +1570,104 @@ sub _output_param_total { - my ($self, $sect, $parm, $print_line, $split_val, $delta) = @_; - if (!defined $self->{v}{$sect}{$parm}) { - if ($delta) { + my ( $self, $sect, $parm, $print_line, $split_val, $delta ) = @_; + if ( !defined $self->{v}{$sect}{$parm} ) + { + if ($delta) + { $print_line->("$self->{comment_char} $parm is deleted"); } - else { + else + { warn "Weird unknown parameter $parm" if $^W; } return; } - $self->_output_comments($print_line, $self->{pCMT}{$sect}{$parm}); + $self->_output_comments( $print_line, $self->{pCMT}{$sect}{$parm} ); - my $val = $self->{v}{$sect}{$parm}; + my $val = $self->{v}{$sect}{$parm}; my $end_comment = $self->{peCMT}{$sect}{$parm}; - return if ! defined ($val); # No parameter exists !! + return if !defined($val); # No parameter exists !! - $self->_OutputParam( - $sect, - $parm, - $split_val->($val), - (defined($end_comment) ? $end_comment : ""), - $print_line, - ); + $self->_OutputParam( $sect, $parm, $split_val->($val), + ( defined($end_comment) ? $end_comment : "" ), $print_line, ); return; } -sub _output_section { - my ($self, $sect, $print_line, $split_val, $delta, $position) = @_; +sub _output_section +{ + my ( $self, $sect, $print_line, $split_val, $delta, $position ) = @_; - if (!defined $self->{v}{$sect}) { - if ($delta) { + if ( !defined $self->{v}{$sect} ) + { + if ($delta) + { $print_line->("$self->{comment_char} [$sect] is deleted"); - } else { + } + else + { warn "Weird unknown section $sect" if $^W; } return; } return if not defined $self->{v}{$sect}; - $print_line->() if ($position > 0); - $self->_output_comments($print_line, $self->{sCMT}{$sect}); + $print_line->() if ( $position > 0 ); + $self->_output_comments( $print_line, $self->{sCMT}{$sect} ); - if (! - ($self->{fallback_used} and $sect eq $self->{fallback}) - ) + if ( !( $self->{fallback_used} and $sect eq $self->{fallback} ) ) { $print_line->("[$sect]"); } - return if ref($self->{v}{$sect}) ne 'HASH'; + return if ref( $self->{v}{$sect} ) ne 'HASH'; - foreach my $parm (@{$self->{$delta ? "myparms" : "parms"}{$sect}}) { - $self->_output_param_total( - $sect, $parm, $print_line, $split_val, $delta - ); + foreach my $parm ( @{ $self->{ $delta ? "myparms" : "parms" }{$sect} } ) + { + $self->_output_param_total( $sect, $parm, $print_line, $split_val, + $delta ); } return; } -sub OutputConfigToFileHandle { +sub OutputConfigToFileHandle +{ # We need no strict 'refs' to be able to print to $fh if it points # to a glob filehandle. no strict 'refs'; - my ($self, $fh, $delta) = @_; + my ( $self, $fh, $delta ) = @_; - my $ors = $self->{line_ends} || $\ || "\n"; # $\ is normally unset, but use input by default + my $ors = + $self->{line_ends} + || $\ + || "\n"; # $\ is normally unset, but use input by default my $print_line = sub { - print {$fh} (@_, $ors) - or die "Config-IniFiles cannot print to filehandle (out-of-space?). Aborting!"; + print {$fh} ( @_, $ors ) + or die +"Config-IniFiles cannot print to filehandle (out-of-space?). Aborting!"; return; }; my $split_val = sub { my ($val) = @_; - return ((ref($val) eq 'ARRAY') + return ( + ( ref($val) eq 'ARRAY' ) ? $val - : [split /[$ors]/, $val, -1] + : [ split /[$ors]/, $val, -1 ] ); }; my $position = 0; - foreach my $sect (@{$self->{$delta ? "mysects" : "sects"}}) { - $self->_output_section( - $sect, $print_line, $split_val, $delta, $position++ - ); + foreach my $sect ( @{ $self->{ $delta ? "mysects" : "sects" } } ) + { + $self->_output_section( $sect, $print_line, $split_val, $delta, + $position++ ); } - $self->_output_comments($print_line, [ $self->_GetEndComments() ] ); + $self->_output_comments( $print_line, [ $self->_GetEndComments() ] ); return 1; } @@ -1540,30 +1675,29 @@ sub SetSectionComment { - my ($self, $sect, @comment) = @_; + my ( $self, $sect, @comment ) = @_; - if (not (defined($sect) && @comment)) + if ( not( defined($sect) && @comment ) ) { return undef; } - $self->_caseify(\$sect); + $self->_caseify( \$sect ); $self->_touch_section($sect); + # At this point it's possible to have a comment for a section that # doesn't exist. This comment will not get written to the INI file. - $self->{sCMT}{$sect} = $self->_markup_comments(\@comment); + $self->{sCMT}{$sect} = $self->_markup_comments( \@comment ); return scalar @comment; } - - # this helper makes sure that each line is preceded with the correct comment # character sub _markup_comments { - my ($self, $comment_aref) = @_; + my ( $self, $comment_aref ) = @_; my $allCmt = $self->{allowed_comment_char}; my $cmtChr = $self->{comment_char}; @@ -1571,30 +1705,29 @@ my $is_comment = qr/\A\s*[$allCmt]/; # TODO : Maybe create a qr// out of it. - return [map { ($_ =~ $is_comment) ? $_ : "$cmtChr $_" } @$comment_aref]; + return [ map { ( $_ =~ $is_comment ) ? $_ : "$cmtChr $_" } @$comment_aref ]; } - - sub _return_comment { - my ($self, $comment_aref) = @_; + my ( $self, $comment_aref ) = @_; my $delim = defined($/) ? $/ : "\n"; - return wantarray() ? @$comment_aref : join($delim, @$comment_aref); + return wantarray() ? @$comment_aref : join( $delim, @$comment_aref ); } sub GetSectionComment { - my ($self, $sect) = @_; + my ( $self, $sect ) = @_; return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); - if (! exists $self->{sCMT}{$sect}) { + if ( !exists $self->{sCMT}{$sect} ) + { return undef; } @@ -1609,7 +1742,7 @@ return undef if not defined $sect; - $self->_caseify(\$sect); + $self->_caseify( \$sect ); $self->_touch_section($sect); delete $self->{sCMT}{$sect}; @@ -1620,27 +1753,27 @@ sub SetParameterComment { - my ($self, $sect, $parm, @comment) = @_; + my ( $self, $sect, $parm, @comment ) = @_; - if (not (defined($sect) && defined($parm) && @comment)) + if ( not( defined($sect) && defined($parm) && @comment ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); # Note that at this point, it's possible to have a comment for a parameter, # without that parameter actually existing in the INI file. - $self->{pCMT}{$sect}{$parm} = $self->_markup_comments(\@comment); + $self->{pCMT}{$sect}{$parm} = $self->_markup_comments( \@comment ); return scalar @comment; } sub _SetEndComments { - my $self = shift; + my $self = shift; my @comments = @_; $self->{_comments_at_end_of_file} = \@comments; @@ -1648,26 +1781,29 @@ return 1; } -sub _GetEndComments { +sub _GetEndComments +{ my $self = shift; - return @{$self->{_comments_at_end_of_file}}; + return @{ $self->{_comments_at_end_of_file} }; } sub GetParameterComment { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - if (not (exists( $self->{pCMT}{$sect} ) - && exists( $self->{pCMT}{$sect}{$parm} ))) + if ( + not( exists( $self->{pCMT}{$sect} ) + && exists( $self->{pCMT}{$sect}{$parm} ) ) + ) { return undef; } @@ -1678,20 +1814,20 @@ sub DeleteParameterComment { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); # If the parameter doesn't exist, our goal has already been achieved if ( exists( $self->{pCMT}{$sect} ) - && exists( $self->{pCMT}{$sect}{$parm} )) + && exists( $self->{pCMT}{$sect}{$parm} ) ) { - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); delete $self->{pCMT}{$sect}{$parm}; } @@ -1701,14 +1837,14 @@ sub GetParameterEOT { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); return $self->{EOT}{$sect}{$parm}; } @@ -1716,16 +1852,16 @@ sub SetParameterEOT { - my ($self, $sect, $parm, $EOT) = @_; + my ( $self, $sect, $parm, $EOT ) = @_; - if (not (defined($sect) && defined($parm) && defined($EOT))) + if ( not( defined($sect) && defined($parm) && defined($EOT) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); $self->{EOT}{$sect}{$parm} = $EOT; @@ -1735,16 +1871,16 @@ sub DeleteParameterEOT { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); delete $self->{EOT}{$sect}{$parm}; return; @@ -1753,19 +1889,19 @@ sub SetParameterTrailingComment { - my ($self, $sect, $parm, $cmt) = @_; + my ( $self, $sect, $parm, $cmt ) = @_; - if (not (defined($sect) && defined($parm) && defined($cmt))) + if ( not( defined($sect) && defined($parm) && defined($cmt) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); # confirm the parameter exist return undef if not exists $self->{v}{$sect}{$parm}; - $self->_touch_parameter($sect, $parm); + $self->_touch_parameter( $sect, $parm ); $self->{peCMT}{$sect}{$parm} = $cmt; return 1; @@ -1774,14 +1910,14 @@ sub GetParameterTrailingComment { - my ($self, $sect, $parm) = @_; + my ( $self, $sect, $parm ) = @_; - if (not (defined($sect) && defined($parm))) + if ( not( defined($sect) && defined($parm) ) ) { return undef; } - $self->_caseify(\$sect, \$parm); + $self->_caseify( \$sect, \$parm ); # confirm the parameter exist return undef if not exists $self->{v}{$sect}{$parm}; @@ -1789,17 +1925,17 @@ } -sub Delete { +sub Delete +{ my $self = shift; - foreach my $section ($self->Sections()) { + foreach my $section ( $self->Sections() ) + { $self->DeleteSection($section); } return 1; -} # end Delete - - +} # end Delete ############################################################ @@ -1821,34 +1957,39 @@ # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub TIEHASH { - my $class = shift; - my %parms = @_; - - # Get a new object - my $self = $class->new( %parms ); +sub TIEHASH +{ + my $class = shift; + my %parms = @_; - return $self; -} # end TIEHASH + # Get a new object + my $self = $class->new(%parms); + return $self; +} # end TIEHASH # ---------------------------------------------------------- # Date Modification Author # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub FETCH { - my $self = shift; - my( $key ) = @_; - - $self->_caseify(\$key); - return if (! $self->{v}{$key}); - - my %retval; - tie %retval, 'Config::IniFiles::_section', $self, $key; - return \%retval; +sub FETCH +{ + my $self = shift; + my ($key) = @_; + + $self->{_section_cache} ||= {}; + + $self->_caseify( \$key ); + return if ( !$self->{v}{$key} ); + + return $self->{_section_cache}->{$key} if exists $self->{_section_cache}->{$key}; -} # end FETCH + my %retval; + tie %retval, 'Config::IniFiles::_section', $self, $key; + return $self->{_section_cache}->{$key} = \%retval; + +} # end FETCH # ---------------------------------------------------------- # Date Modification Author @@ -1857,22 +1998,22 @@ # 2000Oct09 Fixed possible but in %parms with defaults JW # 2001Apr04 Fixed -nocase problem in storing JW # ---------------------------------------------------------- -sub STORE { - my $self = shift; - my( $key, $ref ) = @_; - - return undef unless ref($ref) eq 'HASH'; +sub STORE +{ + my $self = shift; + my ( $key, $ref ) = @_; - $self->_caseify(\$key); + return undef unless ref($ref) eq 'HASH'; - $self->AddSection($key); - $self->{v}{$key} = {%$ref}; - $self->{parms}{$key} = [keys %$ref]; - $self->{myparms}{$key} = [keys %$ref]; + $self->_caseify( \$key ); - return 1; -} # end STORE + $self->AddSection($key); + $self->{v}{$key} = {%$ref}; + $self->{parms}{$key} = [ keys %$ref ]; + $self->{myparms}{$key} = [ keys %$ref ]; + return 1; +} # end STORE # ---------------------------------------------------------- # Date Modification Author @@ -1881,55 +2022,56 @@ # 2000Dec17 Now removes comments, groups and EOTs too JW # 2001Arp04 Fixed -nocase problem JW # ---------------------------------------------------------- -sub DELETE { - my $self = shift; - my( $key ) = @_; - - my $retval=$self->FETCH($key); - $self->DeleteSection($key); - return $retval; -} # end DELETE +sub DELETE +{ + my $self = shift; + my ($key) = @_; + my $retval = $self->FETCH($key); + $self->DeleteSection($key); + return $retval; +} # end DELETE # ---------------------------------------------------------- # Date Modification Author # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub CLEAR { - my $self = shift; +sub CLEAR +{ + my $self = shift; - return $self->Delete(); -} # end CLEAR + return $self->Delete(); +} # end CLEAR # ---------------------------------------------------------- # Date Modification Author # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub FIRSTKEY { - my $self = shift; - - $self->{tied_enumerator}=0; - return $self->NEXTKEY(); -} # end FIRSTKEY +sub FIRSTKEY +{ + my $self = shift; + $self->{tied_enumerator} = 0; + return $self->NEXTKEY(); +} # end FIRSTKEY # ---------------------------------------------------------- # Date Modification Author # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub NEXTKEY { - my $self = shift; - my( $last ) = @_; - - my $i=$self->{tied_enumerator}++; - my $key=$self->{sects}[$i]; - return if (! defined $key); - return wantarray ? ($key, $self->FETCH($key)) : $key; -} # end NEXTKEY +sub NEXTKEY +{ + my $self = shift; + my ($last) = @_; + my $i = $self->{tied_enumerator}++; + my $key = $self->{sects}[$i]; + return if ( !defined $key ); + return wantarray ? ( $key, $self->FETCH($key) ) : $key; +} # end NEXTKEY # ---------------------------------------------------------- # Date Modification Author @@ -1937,12 +2079,12 @@ # 2000May09 Created method JW # 2001Apr04 Fixed -nocase bug and false true bug JW # ---------------------------------------------------------- -sub EXISTS { - my $self = shift; - my( $key ) = @_; - return $self->SectionExists($key); -} # end EXISTS - +sub EXISTS +{ + my $self = shift; + my ($key) = @_; + return $self->SectionExists($key); +} # end EXISTS # ---------------------------------------------------------- # DESTROY is used by TIEHASH and the Perl garbage collector, @@ -1951,10 +2093,10 @@ # ---------------------------------------------------------- # 2000May09 Created method JW # ---------------------------------------------------------- -sub DESTROY { - # my $self = shift; -} # end if - +sub DESTROY +{ + # my $self = shift; +} # end if # ---------------------------------------------------------- # Sub: _make_filehandle @@ -1971,39 +2113,45 @@ # ---------------------------------------------------------- # 06Dec2001 Added to support input from any source JW # ---------------------------------------------------------- -sub _make_filehandle { - my $self = shift; +sub _make_filehandle +{ + my $self = shift; - # - # This code is 'borrowed' from Lincoln D. Stein's GD.pm module - # with modification for this module. Thanks Lincoln! - # - - no strict 'refs'; - my $thing = shift; - - if (ref($thing) eq "SCALAR") { - if (eval { require IO::Scalar; $IO::Scalar::VERSION >= 2.109; }) { - return IO::Scalar->new($thing); - } else { - warn "SCALAR reference as file descriptor requires IO::stringy ". - "v2.109 or later" if ($^W); - return; - } - } - - return $thing if defined(fileno $thing); - - # otherwise try qualifying it into caller's package - my $fh = qualify_to_ref($thing,caller(1)); - return $fh if defined(fileno $fh); - - # otherwise treat it as a file to open - $fh = gensym; - open($fh,$thing) || return; + # + # This code is 'borrowed' from Lincoln D. Stein's GD.pm module + # with modification for this module. Thanks Lincoln! + # - return $fh; -} # end _make_filehandle + no strict 'refs'; + my $thing = shift; + + if ( ref($thing) eq "SCALAR" ) + { + if ( eval { require IO::Scalar; $IO::Scalar::VERSION >= 2.109; } ) + { + return IO::Scalar->new($thing); + } + else + { + warn "SCALAR reference as file descriptor requires IO::stringy " + . "v2.109 or later" + if ($^W); + return; + } + } + + return $thing if defined( fileno $thing ); + + # otherwise try qualifying it into caller's package + my $fh = qualify_to_ref( $thing, caller(1) ); + return $fh if defined( fileno $fh ); + + # otherwise treat it as a file to open + $fh = gensym; + open( $fh, $thing ) || return; + + return $fh; +} # end _make_filehandle ############################################################ # @@ -2050,15 +2198,15 @@ # Date Modification Author # ---------------------------------------------------------- # ---------------------------------------------------------- -sub TIEHASH { - my $proto = shift; - my $class = ref($proto) || $proto; - my ($config, $section) = @_; - - # Make a new object - return bless {config=>$config, section=>$section}, $class; -} # end TIEHASH - +sub TIEHASH +{ + my $proto = shift; + my $class = ref($proto) || $proto; + my ( $config, $section ) = @_; + + # Make a new object + return bless { config => $config, section => $section }, $class; +} # end TIEHASH # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::FETCH @@ -2075,12 +2223,12 @@ # 2000Dec07 Fixed another bug in -deault handler JW # 2002Jul04 Returning scalar values (Bug:447532) AS # ---------------------------------------------------------- -sub FETCH { - my ($self, $key) = @_; - my @retval=$self->{config}->val($self->{section}, $key); - return (@retval <= 1) ? $retval[0] : \@retval; -} # end FETCH - +sub FETCH +{ + my ( $self, $key ) = @_; + my @retval = $self->{config}->val( $self->{section}, $key ); + return ( @retval <= 1 ) ? $retval[0] : \@retval; +} # end FETCH # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::STORE @@ -2095,11 +2243,11 @@ # ---------------------------------------------------------- # 2001Apr04 Fixed -nocase bug JW # ---------------------------------------------------------- -sub STORE { - my ($self, $key, @val) = @_; - return $self->{config}->newval($self->{section}, $key, @val); -} # end STORE - +sub STORE +{ + my ( $self, $key, @val ) = @_; + return $self->{config}->newval( $self->{section}, $key, @val ); +} # end STORE # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::DELETE @@ -2114,12 +2262,13 @@ # ---------------------------------------------------------- # 2001Apr04 Fixed -nocase bug JW # ---------------------------------------------------------- -sub DELETE { - my ($self, $key) = @_; - my $retval=$self->{config}->val($self->{section}, $key); - $self->{config}->delval($self->{section}, $key); +sub DELETE +{ + my ( $self, $key ) = @_; + my $retval = $self->{config}->val( $self->{section}, $key ); + $self->{config}->delval( $self->{section}, $key ); return $retval; -} # end DELETE +} # end DELETE # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::CLEAR @@ -2131,10 +2280,11 @@ # Date Modification Author # ---------------------------------------------------------- # ---------------------------------------------------------- -sub CLEAR { - my ($self) = @_; - return $self->{config}->DeleteSection($self->{section}); -} # end CLEAR +sub CLEAR +{ + my ($self) = @_; + return $self->{config}->DeleteSection( $self->{section} ); +} # end CLEAR # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::EXISTS @@ -2148,10 +2298,11 @@ # ---------------------------------------------------------- # 2001Apr04 Fixed -nocase bug JW # ---------------------------------------------------------- -sub EXISTS { - my ($self, $key) = @_; - return $self->{config}->exists($self->{section},$key); -} # end EXISTS +sub EXISTS +{ + my ( $self, $key ) = @_; + return $self->{config}->exists( $self->{section}, $key ); +} # end EXISTS # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::FIRSTKEY @@ -2163,12 +2314,13 @@ # Date Modification Author # ---------------------------------------------------------- # ---------------------------------------------------------- -sub FIRSTKEY { - my $self = shift; +sub FIRSTKEY +{ + my $self = shift; - $self->{tied_enumerator}=0; - return $self->NEXTKEY(); -} # end FIRSTKEY + $self->{tied_enumerator} = 0; + return $self->NEXTKEY(); +} # end FIRSTKEY # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::NEXTKEY @@ -2181,17 +2333,17 @@ # Date Modification Author # ---------------------------------------------------------- # ---------------------------------------------------------- -sub NEXTKEY { - my $self = shift; - my( $last ) = @_; - - my $i=$self->{tied_enumerator}++; - my @keys = $self->{config}->Parameters($self->{section}); - my $key=$keys[$i]; - return if (! defined $key); - return wantarray ? ($key, $self->FETCH($key)) : $key; -} # end NEXTKEY +sub NEXTKEY +{ + my $self = shift; + my ($last) = @_; + my $i = $self->{tied_enumerator}++; + my @keys = $self->{config}->Parameters( $self->{section} ); + my $key = $keys[$i]; + return if ( !defined $key ); + return wantarray ? ( $key, $self->FETCH($key) ) : $key; +} # end NEXTKEY # ---------------------------------------------------------- # Sub: Config::IniFiles::_section::DESTROY @@ -2203,15 +2355,15 @@ # Date Modification Author # ---------------------------------------------------------- # ---------------------------------------------------------- -sub DESTROY { - # my $self = shift -} # end DESTROY +sub DESTROY +{ + # my $self = shift +} # end DESTROY 1; - 1; # Please keep the following within the last four lines of the file @@ -2229,7 +2381,7 @@ =head1 VERSION -version 2.94 +version 3.000001 =head1 SYNOPSIS @@ -2244,6 +2396,10 @@ your Perl script. Configurations can be imported (inherited, stacked,...), sections can be grouped, and settings can be accessed from a tied hash. +=head1 VERSION + +version 3.000001 + =head1 FILE FORMAT INI files consist of a number of sections, each preceded with the @@ -2544,6 +2700,34 @@ Set and get methods for trailing comments are provided as L and L. +=item I<-php_compat> 0|1 + +Set -php_compat => 1 to enable support for PHP like configfiles. + +The differences between parse_ini_file and Config::IniFiles are: + + # parse_ini_file + [group] + val1="value" + val2[]=1 + val2[]=2 + + vs + + # Config::IniFiles + [group] + val1=value + val2=1 + val2=2 + +This option only affect parsing, not writing new configfiles. + +Some features from parse_ini_file are not compatible: + + [group] + val1="val"'ue' + val1[key]=1 + =back =head2 val ($section, $parameter [, $default] ) @@ -2776,7 +2960,7 @@ Gets the comment attached to a parameter. In list context returns all comments - in scalar context returns them joined by newlines. -=head2 DeleteParameterComment ($section, $parmeter) +=head2 DeleteParameterComment ($section, $parameter) Deletes the comment attached to a parameter. @@ -2790,7 +2974,7 @@ To un-set the EOT text, use DeleteParameterEOT ($section, $parameter). -=head2 DeleteParameterEOT ($section, $parmeter) +=head2 DeleteParameterEOT ($section, $parameter) Removes the EOT marker for the given section and parameter. When writing a configuration file, if no EOT marker is defined @@ -2981,9 +3165,9 @@ ; overlay.ini [section1] - arg1=overriden + arg1=overridden -Then C<< $overlay->val("section1", "arg1") >> is "overriden", while +Then C<< $overlay->val("section1", "arg1") >> is "overridden", while C<< $overlay->val("section1", "arg0") >> is "unchanged from master.ini". @@ -3088,7 +3272,6 @@ $iniconf->{cf} = "config_file_name" ->{startup_settings} = \%orginal_object_parameters - ->{firstload} = 0 OR 1 ->{imported} = $object WHERE $object->isa("Config::IniFiles") ->{nocase} = 0 ->{reloadwarn} = 0 @@ -3159,8 +3342,7 @@ =head1 BUGS Please report any bugs or feature requests on the bugtracker website -http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-IniFiles or by email to -bug-config-inifiles@rt.cpan.org. +L When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired @@ -3189,7 +3371,7 @@ A modern, open-source CPAN search engine, useful to view POD in HTML format. -L +L =item * @@ -3225,14 +3407,6 @@ =item * -CPAN Forum - -The CPAN Forum is a web forum for discussing Perl modules. - -L - -=item * - CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. @@ -3243,7 +3417,7 @@ CPAN Testers -The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. +The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions. L @@ -3279,6 +3453,6 @@ L - git clone ssh://git@github.com:shlomif/perl-Config-IniFiles.git + git clone git://github.com/shlomif/perl-Config-IniFiles.git =cut diff -Nru libconfig-inifiles-perl-2.94/Makefile.PL libconfig-inifiles-perl-3.000001/Makefile.PL --- libconfig-inifiles-perl-2.94/Makefile.PL 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/Makefile.PL 2019-01-16 09:53:16.000000000 +0000 @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.047. +# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.012. use strict; use warnings; @@ -41,12 +41,12 @@ "IO::Handle" => 0, "IPC::Open3" => 0, "Scalar::Util" => 0, - "Test::More" => 0, + "Test::More" => "0.88", "base" => 0, - "blib" => "1.01", - "lib" => 0 + "lib" => 0, + "parent" => 0 }, - "VERSION" => "2.94", + "VERSION" => "3.000001", "test" => { "TESTS" => "t/*.t" } @@ -69,10 +69,10 @@ "Module::Build" => "0.28", "Scalar::Util" => 0, "Symbol" => 0, - "Test::More" => 0, + "Test::More" => "0.88", "base" => 0, - "blib" => "1.01", "lib" => 0, + "parent" => 0, "strict" => 0, "vars" => 0, "warnings" => 0 diff -Nru libconfig-inifiles-perl-2.94/MANIFEST libconfig-inifiles-perl-3.000001/MANIFEST --- libconfig-inifiles-perl-2.94/MANIFEST 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/MANIFEST 2019-01-16 09:53:16.000000000 +0000 @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.047. +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Build.PL Changes LICENSE @@ -48,10 +48,11 @@ t/32mswin-outputs-contain-crs.t t/33update-using-tied-fh-w-shorter-names.t t/34trailing-comments-double-delimeter.t +t/35reload-config-no-file.t +t/35section-iterators.t +t/36php-compat.t t/allowed-comment-chars.ini t/array.ini -t/author-pod-coverage.t -t/author-pod-syntax.t t/bad.ini t/blank.ini t/brackets-in-values.ini @@ -59,7 +60,6 @@ t/case-sensitive-default.ini t/case-sensitive.ini t/cmt.ini -t/cpan-changes.t t/en.ini t/end-of-line-comment.ini t/es.ini @@ -68,11 +68,14 @@ t/lib/Config/IniFiles/Slurp.pm t/lib/Config/IniFiles/TestPaths.pm t/non-contiguous-groups.ini -t/pod-coverage.t -t/pod.t -t/release-cpan-changes.t -t/release-kwalitee.t -t/style-trailing-space.t +t/php-compat.ini +t/php-compat.php t/test.ini t/trailing-comments.ini weaver.ini +xt/author/no-tabs.t +xt/author/pod-coverage.t +xt/author/pod-syntax.t +xt/author/tidyall.t +xt/release/cpan-changes.t +xt/release/trailing-space.t diff -Nru libconfig-inifiles-perl-2.94/MANIFEST.SKIP libconfig-inifiles-perl-3.000001/MANIFEST.SKIP --- libconfig-inifiles-perl-2.94/MANIFEST.SKIP 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/MANIFEST.SKIP 2019-01-16 09:53:16.000000000 +0000 @@ -1 +1,2 @@ ~$ +^\.tidyall\.d/ diff -Nru libconfig-inifiles-perl-2.94/META.json libconfig-inifiles-perl-3.000001/META.json --- libconfig-inifiles-perl-2.94/META.json 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/META.json 2019-01-16 09:53:16.000000000 +0000 @@ -4,7 +4,7 @@ "Shlomi Fish " ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 5.047, CPAN::Meta::Converter version 2.150005", + "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "keywords" : [ "config", "configuration", @@ -41,8 +41,12 @@ "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.19", + "Test::Code::TidyAll" : "0.50", + "Test::More" : "0.96", + "Test::NoTabs" : "0", "Test::Pod" : "1.41", - "Test::Pod::Coverage" : "1.08" + "Test::Pod::Coverage" : "1.08", + "Test::TrailingSpace" : "0.0203" } }, "runtime" : { @@ -70,31 +74,473 @@ "IO::Handle" : "0", "IPC::Open3" : "0", "Scalar::Util" : "0", - "Test::More" : "0", + "Test::More" : "0.88", "base" : "0", - "blib" : "1.01", - "lib" : "0" + "lib" : "0", + "parent" : "0" } } }, "provides" : { "Config::IniFiles" : { "file" : "lib/Config/IniFiles.pm", - "version" : "2.94" + "version" : "3.000001" } }, "release_status" : "stable", "resources" : { "bugtracker" : { - "mailto" : "bug-config-inifiles@rt.cpan.org", - "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-IniFiles" + "web" : "https://github.com/shlomif/perl-Config-IniFiles/issues" }, + "homepage" : "http://metacpan.org/release/Config-IniFiles", "repository" : { "type" : "git", - "url" : "ssh://git@github.com:shlomif/perl-Config-IniFiles.git", + "url" : "git://github.com/shlomif/perl-Config-IniFiles.git", "web" : "https://github.com/shlomif/perl-Config-IniFiles" } }, - "version" : "2.94" + "version" : "3.000001", + "x_Dist_Zilla" : { + "perl" : { + "version" : "5.028001" + }, + "plugins" : [ + { + "class" : "Dist::Zilla::Plugin::Prereqs", + "config" : { + "Dist::Zilla::Plugin::Prereqs" : { + "phase" : "test", + "type" : "requires" + } + }, + "name" : "@Filter/TestMoreDoneTesting", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::AutoPrereqs", + "name" : "@Filter/AutoPrereqs", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ExecDir", + "name" : "@Filter/ExecDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::GatherDir", + "config" : { + "Dist::Zilla::Plugin::GatherDir" : { + "exclude_filename" : [], + "exclude_match" : [], + "follow_symlinks" : 0, + "include_dotfiles" : 0, + "prefix" : "", + "prune_directory" : [], + "root" : "." + } + }, + "name" : "@Filter/GatherDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ManifestSkip", + "name" : "@Filter/ManifestSkip", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaYAML", + "name" : "@Filter/MetaYAML", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PruneCruft", + "name" : "@Filter/PruneCruft", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::RunExtraTests", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/RunExtraTests", + "version" : "0.029" + }, + { + "class" : "Dist::Zilla::Plugin::ShareDir", + "name" : "@Filter/ShareDir", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MakeMaker", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/MakeMaker", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", + "name" : "@Filter/CheckChangesHasContent", + "version" : "0.011" + }, + { + "class" : "Dist::Zilla::Plugin::ConfirmRelease", + "name" : "@Filter/ConfirmRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Manifest", + "name" : "@Filter/Manifest", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaConfig", + "name" : "@Filter/MetaConfig", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaJSON", + "name" : "@Filter/MetaJSON", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::MetaProvides::Package", + "config" : { + "Dist::Zilla::Plugin::MetaProvides::Package" : { + "finder_objects" : [ + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "include_underscores" : 0 + }, + "Dist::Zilla::Role::MetaProvider::Provider" : { + "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", + "inherit_missing" : 1, + "inherit_version" : 1, + "meta_noindex" : 1 + }, + "Dist::Zilla::Role::ModuleMetadata" : { + "Module::Metadata" : "1.000033", + "version" : "0.006" + } + }, + "name" : "@Filter/MetaProvides::Package", + "version" : "2.004003" + }, + { + "class" : "Dist::Zilla::Plugin::MetaResources", + "name" : "@Filter/MetaResources", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::ModuleBuild", + "config" : { + "Dist::Zilla::Role::TestRunner" : { + "default_jobs" : 1 + } + }, + "name" : "@Filter/ModuleBuild", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PkgVersion", + "name" : "@Filter/PkgVersion", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodCoverageTests", + "name" : "@Filter/PodCoverageTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodSyntaxTests", + "name" : "@Filter/PodSyntaxTests", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodVersion", + "name" : "@Filter/PodVersion", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::CPAN::Changes", + "config" : { + "Dist::Zilla::Plugin::Test::CPAN::Changes" : { + "changelog" : "Changes" + } + }, + "name" : "@Filter/Test::CPAN::Changes", + "version" : "0.012" + }, + { + "class" : "Dist::Zilla::Plugin::Test::NoTabs", + "config" : { + "Dist::Zilla::Plugin::Test::NoTabs" : { + "filename" : "xt/author/no-tabs.t", + "finder" : [ + ":InstallModules", + ":ExecFiles", + ":TestFiles" + ] + } + }, + "name" : "@Filter/Test::NoTabs", + "version" : "0.15" + }, + { + "class" : "Dist::Zilla::Plugin::Test::TrailingSpace", + "name" : "@Filter/Test::TrailingSpace", + "version" : "0.2.0" + }, + { + "class" : "Dist::Zilla::Plugin::TestRelease", + "name" : "@Filter/TestRelease", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::PodWeaver", + "config" : { + "Dist::Zilla::Plugin::PodWeaver" : { + "finder" : [ + ":InstallModules", + ":ExecFiles" + ], + "plugins" : [ + { + "class" : "Pod::Weaver::Plugin::EnsurePod5", + "name" : "@CorePrep/EnsurePod5", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Plugin::H1Nester", + "name" : "@CorePrep/H1Nester", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Plugin::SingleEncoding", + "name" : "-SingleEncoding", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "NAME", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Version", + "name" : "Version", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "prelude", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "SYNOPSIS", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "DESCRIPTION", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Generic", + "name" : "OVERVIEW", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "ATTRIBUTES", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Collect", + "name" : "METHODS", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Leftovers", + "name" : "Leftovers", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Region", + "name" : "postlude", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Authors", + "name" : "Authors", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Legal", + "name" : "Legal", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Bugs", + "name" : "Bugs", + "version" : "4.015" + }, + { + "class" : "Pod::Weaver::Section::Support", + "name" : "Support", + "version" : "1.010" + } + ] + } + }, + "name" : "@Filter/PodWeaver", + "version" : "4.008" + }, + { + "class" : "Dist::Zilla::Plugin::UploadToCPAN", + "name" : "@Filter/UploadToCPAN", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::Keywords", + "config" : { + "Dist::Zilla::Plugin::Keywords" : { + "keywords" : [ + "config", + "configuration", + "files", + "ini", + "ini", + "files", + "pure-perl", + "tested", + "tie", + "windows" + ] + } + }, + "name" : "Keywords", + "version" : "0.007" + }, + { + "class" : "Dist::Zilla::Plugin::RewriteVersion", + "config" : { + "Dist::Zilla::Plugin::RewriteVersion" : { + "add_tarball_name" : 0, + "finders" : [ + ":ExecFiles", + ":InstallModules" + ], + "global" : 0, + "skip_version_provider" : 0 + } + }, + "name" : "RewriteVersion", + "version" : "0.018" + }, + { + "class" : "Dist::Zilla::Plugin::Test::Compile", + "config" : { + "Dist::Zilla::Plugin::Test::Compile" : { + "bail_out_on_fail" : 0, + "fail_on_warning" : "author", + "fake_home" : 1, + "filename" : "t/00-compile.t", + "module_finder" : [ + ":InstallModules" + ], + "needs_display" : 0, + "phase" : "test", + "script_finder" : [ + ":PerlExecFiles" + ], + "skips" : [ + "bump-ver|tag-release|run_agg_tests" + ], + "switch" : [] + } + }, + "name" : "Test::Compile", + "version" : "2.058" + }, + { + "class" : "Dist::Zilla::Plugin::Test::TidyAll", + "name" : "Test::TidyAll", + "version" : "0.04" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":InstallModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":IncModules", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":TestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExtraTestFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":PerlExecFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":ShareFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":MainModule", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":AllFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : ":NoFiles", + "version" : "6.012" + }, + { + "class" : "Dist::Zilla::Plugin::FinderCode", + "name" : "@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", + "version" : "6.012" + } + ], + "zilla" : { + "class" : "Dist::Zilla::Dist::Builder", + "config" : { + "is_trial" : 0 + }, + "version" : "6.012" + } + }, + "x_generated_by_perl" : "v5.28.1", + "x_serialization_backend" : "Cpanel::JSON::XS version 4.08" } diff -Nru libconfig-inifiles-perl-2.94/META.yml libconfig-inifiles-perl-3.000001/META.yml --- libconfig-inifiles-perl-2.94/META.yml 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/META.yml 2019-01-16 09:53:16.000000000 +0000 @@ -12,15 +12,15 @@ IPC::Open3: '0' Module::Build: '0.28' Scalar::Util: '0' - Test::More: '0' + Test::More: '0.88' base: '0' - blib: '1.01' lib: '0' + parent: '0' configure_requires: ExtUtils::MakeMaker: '0' Module::Build: '0.28' dynamic_config: 0 -generated_by: 'Dist::Zilla version 5.047, CPAN::Meta::Converter version 2.150005' +generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' keywords: - config - configuration @@ -40,7 +40,7 @@ provides: Config::IniFiles: file: lib/Config/IniFiles.pm - version: '2.94' + version: '3.000001' requires: Carp: '0' Fcntl: '0' @@ -54,6 +54,348 @@ vars: '0' warnings: '0' resources: - bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Config-IniFiles - repository: ssh://git@github.com:shlomif/perl-Config-IniFiles.git -version: '2.94' + bugtracker: https://github.com/shlomif/perl-Config-IniFiles/issues + homepage: http://metacpan.org/release/Config-IniFiles + repository: git://github.com/shlomif/perl-Config-IniFiles.git +version: '3.000001' +x_Dist_Zilla: + perl: + version: '5.028001' + plugins: + - + class: Dist::Zilla::Plugin::Prereqs + config: + Dist::Zilla::Plugin::Prereqs: + phase: test + type: requires + name: '@Filter/TestMoreDoneTesting' + version: '6.012' + - + class: Dist::Zilla::Plugin::AutoPrereqs + name: '@Filter/AutoPrereqs' + version: '6.012' + - + class: Dist::Zilla::Plugin::ExecDir + name: '@Filter/ExecDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::GatherDir + config: + Dist::Zilla::Plugin::GatherDir: + exclude_filename: [] + exclude_match: [] + follow_symlinks: 0 + include_dotfiles: 0 + prefix: '' + prune_directory: [] + root: . + name: '@Filter/GatherDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::ManifestSkip + name: '@Filter/ManifestSkip' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaYAML + name: '@Filter/MetaYAML' + version: '6.012' + - + class: Dist::Zilla::Plugin::PruneCruft + name: '@Filter/PruneCruft' + version: '6.012' + - + class: Dist::Zilla::Plugin::RunExtraTests + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/RunExtraTests' + version: '0.029' + - + class: Dist::Zilla::Plugin::ShareDir + name: '@Filter/ShareDir' + version: '6.012' + - + class: Dist::Zilla::Plugin::MakeMaker + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/MakeMaker' + version: '6.012' + - + class: Dist::Zilla::Plugin::CheckChangesHasContent + name: '@Filter/CheckChangesHasContent' + version: '0.011' + - + class: Dist::Zilla::Plugin::ConfirmRelease + name: '@Filter/ConfirmRelease' + version: '6.012' + - + class: Dist::Zilla::Plugin::Manifest + name: '@Filter/Manifest' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaConfig + name: '@Filter/MetaConfig' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaJSON + name: '@Filter/MetaJSON' + version: '6.012' + - + class: Dist::Zilla::Plugin::MetaProvides::Package + config: + Dist::Zilla::Plugin::MetaProvides::Package: + finder_objects: + - + class: Dist::Zilla::Plugin::FinderCode + name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '6.012' + include_underscores: 0 + Dist::Zilla::Role::MetaProvider::Provider: + $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' + inherit_missing: '1' + inherit_version: '1' + meta_noindex: '1' + Dist::Zilla::Role::ModuleMetadata: + Module::Metadata: '1.000033' + version: '0.006' + name: '@Filter/MetaProvides::Package' + version: '2.004003' + - + class: Dist::Zilla::Plugin::MetaResources + name: '@Filter/MetaResources' + version: '6.012' + - + class: Dist::Zilla::Plugin::ModuleBuild + config: + Dist::Zilla::Role::TestRunner: + default_jobs: 1 + name: '@Filter/ModuleBuild' + version: '6.012' + - + class: Dist::Zilla::Plugin::PkgVersion + name: '@Filter/PkgVersion' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodCoverageTests + name: '@Filter/PodCoverageTests' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodSyntaxTests + name: '@Filter/PodSyntaxTests' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodVersion + name: '@Filter/PodVersion' + version: '6.012' + - + class: Dist::Zilla::Plugin::Test::CPAN::Changes + config: + Dist::Zilla::Plugin::Test::CPAN::Changes: + changelog: Changes + name: '@Filter/Test::CPAN::Changes' + version: '0.012' + - + class: Dist::Zilla::Plugin::Test::NoTabs + config: + Dist::Zilla::Plugin::Test::NoTabs: + filename: xt/author/no-tabs.t + finder: + - ':InstallModules' + - ':ExecFiles' + - ':TestFiles' + name: '@Filter/Test::NoTabs' + version: '0.15' + - + class: Dist::Zilla::Plugin::Test::TrailingSpace + name: '@Filter/Test::TrailingSpace' + version: 0.2.0 + - + class: Dist::Zilla::Plugin::TestRelease + name: '@Filter/TestRelease' + version: '6.012' + - + class: Dist::Zilla::Plugin::PodWeaver + config: + Dist::Zilla::Plugin::PodWeaver: + finder: + - ':InstallModules' + - ':ExecFiles' + plugins: + - + class: Pod::Weaver::Plugin::EnsurePod5 + name: '@CorePrep/EnsurePod5' + version: '4.015' + - + class: Pod::Weaver::Plugin::H1Nester + name: '@CorePrep/H1Nester' + version: '4.015' + - + class: Pod::Weaver::Plugin::SingleEncoding + name: -SingleEncoding + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: NAME + version: '4.015' + - + class: Pod::Weaver::Section::Version + name: Version + version: '4.015' + - + class: Pod::Weaver::Section::Region + name: prelude + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: SYNOPSIS + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: DESCRIPTION + version: '4.015' + - + class: Pod::Weaver::Section::Generic + name: OVERVIEW + version: '4.015' + - + class: Pod::Weaver::Section::Collect + name: ATTRIBUTES + version: '4.015' + - + class: Pod::Weaver::Section::Collect + name: METHODS + version: '4.015' + - + class: Pod::Weaver::Section::Leftovers + name: Leftovers + version: '4.015' + - + class: Pod::Weaver::Section::Region + name: postlude + version: '4.015' + - + class: Pod::Weaver::Section::Authors + name: Authors + version: '4.015' + - + class: Pod::Weaver::Section::Legal + name: Legal + version: '4.015' + - + class: Pod::Weaver::Section::Bugs + name: Bugs + version: '4.015' + - + class: Pod::Weaver::Section::Support + name: Support + version: '1.010' + name: '@Filter/PodWeaver' + version: '4.008' + - + class: Dist::Zilla::Plugin::UploadToCPAN + name: '@Filter/UploadToCPAN' + version: '6.012' + - + class: Dist::Zilla::Plugin::Keywords + config: + Dist::Zilla::Plugin::Keywords: + keywords: + - config + - configuration + - files + - ini + - ini + - files + - pure-perl + - tested + - tie + - windows + name: Keywords + version: '0.007' + - + class: Dist::Zilla::Plugin::RewriteVersion + config: + Dist::Zilla::Plugin::RewriteVersion: + add_tarball_name: 0 + finders: + - ':ExecFiles' + - ':InstallModules' + global: 0 + skip_version_provider: 0 + name: RewriteVersion + version: '0.018' + - + class: Dist::Zilla::Plugin::Test::Compile + config: + Dist::Zilla::Plugin::Test::Compile: + bail_out_on_fail: '0' + fail_on_warning: author + fake_home: 1 + filename: t/00-compile.t + module_finder: + - ':InstallModules' + needs_display: 0 + phase: test + script_finder: + - ':PerlExecFiles' + skips: + - bump-ver|tag-release|run_agg_tests + switch: [] + name: Test::Compile + version: '2.058' + - + class: Dist::Zilla::Plugin::Test::TidyAll + name: Test::TidyAll + version: '0.04' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':InstallModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':IncModules' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':TestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExtraTestFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':PerlExecFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':ShareFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':MainModule' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':AllFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: ':NoFiles' + version: '6.012' + - + class: Dist::Zilla::Plugin::FinderCode + name: '@Filter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' + version: '6.012' + zilla: + class: Dist::Zilla::Dist::Builder + config: + is_trial: '0' + version: '6.012' +x_generated_by_perl: v5.28.1 +x_serialization_backend: 'YAML::Tiny version 1.73' diff -Nru libconfig-inifiles-perl-2.94/scripts/tag-release.pl libconfig-inifiles-perl-3.000001/scripts/tag-release.pl --- libconfig-inifiles-perl-2.94/scripts/tag-release.pl 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/scripts/tag-release.pl 2019-01-16 09:53:16.000000000 +0000 @@ -17,11 +17,10 @@ } my @cmd = ( - "hg", "tag", "-m", + "git", "tag", "-m", "Tagging the Config-IniFiles release as $version", "releases/$version", ); print join(" ", map { /\s/ ? qq{"$_"} : $_ } @cmd), "\n"; exec(@cmd); - diff -Nru libconfig-inifiles-perl-2.94/t/00-compile.t libconfig-inifiles-perl-3.000001/t/00-compile.t --- libconfig-inifiles-perl-2.94/t/00-compile.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/00-compile.t 2019-01-16 09:53:16.000000000 +0000 @@ -2,7 +2,7 @@ use strict; use warnings; -# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 +# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; @@ -19,7 +19,9 @@ local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); -my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; +my @switches = ( + -d 'blib' ? '-Mblib' : '-Ilib', +); use File::Spec; use IPC::Open3; @@ -33,14 +35,18 @@ # see L my $stderr = IO::Handle->new; - my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); + diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } + $^X, @switches, '-e', "require q[$lib]")) + if $ENV{PERL_COMPILE_TEST_DEBUG}; + + my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ - and not eval { require blib; blib->VERSION('1.01') }; + and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { diff -Nru libconfig-inifiles-perl-2.94/t/00load.t libconfig-inifiles-perl-3.000001/t/00load.t --- libconfig-inifiles-perl-2.94/t/00load.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/00load.t 2019-01-16 09:53:16.000000000 +0000 @@ -14,7 +14,7 @@ BEGIN { # TEST - use_ok ('Config::IniFiles'); + use_ok('Config::IniFiles'); } my $ini; @@ -30,144 +30,164 @@ # exit $ini ? 0; 1 local *CONFIG; + # TEST # a filehandle glob, such as *CONFIG -if( open( CONFIG, "<", t_file("test.ini") ) ) { - $ini = Config::IniFiles->new(-file => *CONFIG); - ok ($ini, q{$ini was initialized}); - close CONFIG; -} else { - ok (0, "Could not open file"); +if ( open( CONFIG, "<", t_file("test.ini") ) ) +{ + $ini = Config::IniFiles->new( -file => *CONFIG ); + ok( $ini, q{$ini was initialized} ); + close CONFIG; +} +else +{ + ok( 0, "Could not open file" ); } # TEST # a reference to a glob, such as \*CONFIG -if( open( CONFIG, "<", t_file("test.ini") ) ) { - $ini = Config::IniFiles->new(-file => \*CONFIG); - ok ($ini, q{$ini was initialized with a reference to a glob.}); - close CONFIG; -} else { - ok( 0, q{could not open test.ini}); +if ( open( CONFIG, "<", t_file("test.ini") ) ) +{ + $ini = Config::IniFiles->new( -file => \*CONFIG ); + ok( $ini, q{$ini was initialized with a reference to a glob.} ); + close CONFIG; +} +else +{ + ok( 0, q{could not open test.ini} ); } # an IO::File object # TEST -if( my $fh = IO::File->new( t_file("test.ini") )) { - $ini = Config::IniFiles->new(-file => $fh); - ok ($ini, q{$ini was initialized with an IO::File reference.}); - $fh->close; -} else { - ok ( 0, "Could not open file" ); -} # endif - +if ( my $fh = IO::File->new( t_file("test.ini") ) ) +{ + $ini = Config::IniFiles->new( -file => $fh ); + ok( $ini, q{$ini was initialized with an IO::File reference.} ); + $fh->close; +} +else +{ + ok( 0, "Could not open file" ); +} # endif # TEST # Reread on an open handle -if( open( CONFIG, "<", t_file("test.ini") ) ) { - $ini = Config::IniFiles->new(-file => \*CONFIG); - ok (($ini && $ini->ReadConfig()), qq{ReadConfig() was successful}); - close CONFIG; -} else { - ok (0, "Could not open file" ); +if ( open( CONFIG, "<", t_file("test.ini") ) ) +{ + $ini = Config::IniFiles->new( -file => \*CONFIG ); + ok( ( $ini && $ini->ReadConfig() ), qq{ReadConfig() was successful} ); + close CONFIG; +} +else +{ + ok( 0, "Could not open file" ); } - use File::Temp qw(tempdir); use File::Spec (); -my $dir_name = tempdir(CLEANUP => 1); -my $test01_fn = File::Spec->catfile($dir_name, 'test01.ini'); +my $dir_name = tempdir( CLEANUP => 1 ); +my $test01_fn = File::Spec->catfile( $dir_name, 'test01.ini' ); # TEST -if( open( CONFIG, "<", t_file("test.ini") ) ) { - $ini = Config::IniFiles->new(-file => \*CONFIG); - $ini->SetFileName( $test01_fn ); - $ini->RewriteConfig(); - close CONFIG; - # Now test opening and re-write to the same handle - if(! open( CONFIG, "+<", $test01_fn )) { - die "Could not open " . $test01_fn . " for read/write"; - } - $ini = Config::IniFiles->new(-file => \*CONFIG); - my $badname = scalar(\*CONFIG); - # Have to use open/close because -e seems to be always true! - ok( $ini && $ini->RewriteConfig() && !(open( I, $badname ) && close(I)) , - qq{Write to a new file name and write to it}, - ); - close CONFIG; - # In case it failed, remove the file - # (old behavior was to write to a file whose filename is the scalar value of the handle!) - unlink $badname; -} else { - ok (0, "Could not open file"); -} # end if +if ( open( CONFIG, "<", t_file("test.ini") ) ) +{ + $ini = Config::IniFiles->new( -file => \*CONFIG ); + $ini->SetFileName($test01_fn); + $ini->RewriteConfig(); + close CONFIG; + + # Now test opening and re-write to the same handle + if ( !open( CONFIG, "+<", $test01_fn ) ) + { + die "Could not open " . $test01_fn . " for read/write"; + } + $ini = Config::IniFiles->new( -file => \*CONFIG ); + my $badname = scalar( \*CONFIG ); + + # Have to use open/close because -e seems to be always true! + ok( + $ini && $ini->RewriteConfig() && !( open( I, $badname ) && close(I) ), + qq{Write to a new file name and write to it}, + ); + close CONFIG; + +# In case it failed, remove the file +# (old behavior was to write to a file whose filename is the scalar value of the handle!) + unlink $badname; +} +else +{ + ok( 0, "Could not open file" ); +} # end if # the pathname of a file -$ini = Config::IniFiles->new(-file => t_file("test.ini")); +$ini = Config::IniFiles->new( -file => t_file("test.ini") ); + # TEST -ok ($ini, q{Opening with -file works}); +ok( $ini, q{Opening with -file works} ); # A non-INI file should fail, but not throw warnings local $@ = ''; my $ERRORS = ''; local $SIG{__WARN__} = sub { $ERRORS .= $_[0] }; -eval { $ini = Config::IniFiles->new(-file => t_file("00load.t")) }; +eval { $ini = Config::IniFiles->new( -file => t_file("00load.t") ) }; + # TEST -ok( - !$@ && !$ERRORS && !defined($ini), - "A non-INI file should fail, but not throw errors" -); +ok( !$@ && !$ERRORS && !defined($ini), + "A non-INI file should fail, but not throw errors" ); $@ = ''; -eval { $ini = Config::IniFiles->new(-file => \*DATA) }; +eval { $ini = Config::IniFiles->new( -file => \*DATA ) }; + # TEST -ok (!$@ && defined($ini), - "Read in the DATA file without errors" -); +ok( !$@ && defined($ini), "Read in the DATA file without errors" ); # Try a file with utf-8 encoding (has a Byte-Order-Mark at the start) # TEST -$ini = Config::IniFiles->new(-file => t_file("en.ini")); -ok ($ini, - "Try a file with utf-8 encoding (has a Byte-Order-Mark at the start)" -); - +$ini = Config::IniFiles->new( -file => t_file("en.ini") ); +ok( $ini, + "Try a file with utf-8 encoding (has a Byte-Order-Mark at the start)" ); # Create a new INI file, and set the name using SetFileName $ini = Config::IniFiles->new(); my $filename = $ini->GetFileName; + # TEST -ok ((! defined($filename)), - "Not defined filename on fresh Config::IniFiles" -); +ok( ( !defined($filename) ), "Not defined filename on fresh Config::IniFiles" ); # TEST -$ini->SetFileName(t_file("test9_name.ini")); +$ini->SetFileName( t_file("test9_name.ini") ); $filename = $ini->GetFileName; -is( - $filename, - t_file("test9_name.ini"), - "Check GetFileName method", -); +is( $filename, t_file("test9_name.ini"), "Check GetFileName method", ); $@ = ''; -eval { $ini = Config::IniFiles->new(-file => t_file('blank.ini')); }; +eval { $ini = Config::IniFiles->new( -file => t_file('blank.ini') ); }; + # TEST -ok ((!$@ && !defined($ini)), +ok( + ( !$@ && !defined($ini) ), "Make sure that no warnings are thrown for an empty file", ); $@ = ''; -eval { $ini = Config::IniFiles->new(-file => t_file('blank.ini'), -allowempty=>1); }; +eval { + $ini = + Config::IniFiles->new( -file => t_file('blank.ini'), -allowempty => 1 ); +}; + # TEST -ok((!$@ && defined($ini)), +ok( + ( !$@ && defined($ini) ), "Empty files should cause no rejection when appropriate switch set", ); $@ = ''; -eval { $ini = Config::IniFiles->new(-file => t_file('bad.ini')); }; +eval { $ini = Config::IniFiles->new( -file => t_file('bad.ini') ); }; + # TEST -ok((!$@ && !defined($ini) && @Config::IniFiles::errors), +ok( + ( !$@ && !defined($ini) && @Config::IniFiles::errors ), "A malformed file should throw an error message", ); diff -Nru libconfig-inifiles-perl-2.94/t/01basic.t libconfig-inifiles-perl-3.000001/t/01basic.t --- libconfig-inifiles-perl-2.94/t/01basic.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/01basic.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,97 +1,98 @@ -#!/usr/bin/perl -use strict; -use warnings; - -# Should be 10. -use Test::More tests => 10; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::Debug; -use Config::IniFiles::TestPaths; - -my ($value, @value); -umask 0000; - -my $ini = Config::IniFiles->new(-file => t_file("test.ini")); -$ini->_assert_invariants(); -t_unlink("test01.ini"); -$ini->SetFileName(t_file("test01.ini")); -$ini->SetWriteMode("0666"); - -# TEST -ok($ini, "Loading from a file"); - -$value = $ini->val('test1', 'one'); -$ini->_assert_invariants(); -# TEST -is ( - $value, 'value1', - "Reading a single value in scalar context" -); - -@value = $ini->val('test1', 'one'); -$ini->_assert_invariants(); -# TEST -is ($value[0], 'value1', "Reading a single value in list context"); - -$value = $ini->val('test1', 'mult'); -# TEST -is ($value, "one$/two$/three", - "Reading a multiple value in scalar context" -); - -@value = $ini->val('test1', 'mult'); -$value = join "|", @value; -# TEST -is_deeply( - \@value, - ["one", "two", "three"], - "Reading a multiple value in list context", -); - -@value = ("one", "two", "three"); -$ini->newval('test1', 'eight', @value); -$ini->_assert_invariants(); -$value = $ini->val('test1', 'eight'); -# TEST -is ( - $value, - "one$/two$/three", - "Creating a new multiple value", -); - -$ini->newval('test1', 'seven', 'value7'); -$ini->_assert_invariants(); -$ini->RewriteConfig; -$ini->ReadConfig; -$ini->_assert_invariants(); -$value=''; -$value = $ini->val('test1', 'seven'); -$ini->_assert_invariants(); -# TEST -is ($value, 'value7', "Creating a new value",); - -$ini->delval('test1', 'seven'); -$ini->_assert_invariants(); -$ini->RewriteConfig; -$ini->ReadConfig; -$ini->_assert_invariants(); -$value=''; -$value = $ini->val('test1', 'seven'); -# TEST -ok (! defined ($value), "Deleting a value"); - -$value = $ini->val('test1', 'not a real parameter name', '12345'); -# TEST -is ($value, '12345', "Reading a default values from existing section"); - -$value = $ini->val('not a real section', 'no parameter by this name', '12345'); -# TEST -is ($value, '12345', "Reading a default values from non-existent section"); - -# Clean up when we're done -t_unlink("test01.ini"); - +#!/usr/bin/perl +use strict; +use warnings; + +# Should be 10. +use Test::More tests => 10; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::Debug; +use Config::IniFiles::TestPaths; + +my ( $value, @value ); +umask 0000; + +my $ini = Config::IniFiles->new( -file => t_file("test.ini") ); +$ini->_assert_invariants(); +t_unlink("test01.ini"); +$ini->SetFileName( t_file("test01.ini") ); +$ini->SetWriteMode("0666"); + +# TEST +ok( $ini, "Loading from a file" ); + +$value = $ini->val( 'test1', 'one' ); +$ini->_assert_invariants(); + +# TEST +is( $value, 'value1', "Reading a single value in scalar context" ); + +@value = $ini->val( 'test1', 'one' ); +$ini->_assert_invariants(); + +# TEST +is( $value[0], 'value1', "Reading a single value in list context" ); + +$value = $ini->val( 'test1', 'mult' ); + +# TEST +is( $value, "one$/two$/three", "Reading a multiple value in scalar context" ); + +@value = $ini->val( 'test1', 'mult' ); +$value = join "|", @value; + +# TEST +is_deeply( + \@value, + [ "one", "two", "three" ], + "Reading a multiple value in list context", +); + +@value = ( "one", "two", "three" ); +$ini->newval( 'test1', 'eight', @value ); +$ini->_assert_invariants(); +$value = $ini->val( 'test1', 'eight' ); + +# TEST +is( $value, "one$/two$/three", "Creating a new multiple value", ); + +$ini->newval( 'test1', 'seven', 'value7' ); +$ini->_assert_invariants(); +$ini->RewriteConfig; +$ini->ReadConfig; +$ini->_assert_invariants(); +$value = ''; +$value = $ini->val( 'test1', 'seven' ); +$ini->_assert_invariants(); + +# TEST +is( $value, 'value7', "Creating a new value", ); + +$ini->delval( 'test1', 'seven' ); +$ini->_assert_invariants(); +$ini->RewriteConfig; +$ini->ReadConfig; +$ini->_assert_invariants(); +$value = ''; +$value = $ini->val( 'test1', 'seven' ); + +# TEST +ok( !defined($value), "Deleting a value" ); + +$value = $ini->val( 'test1', 'not a real parameter name', '12345' ); + +# TEST +is( $value, '12345', "Reading a default values from existing section" ); + +$value = + $ini->val( 'not a real section', 'no parameter by this name', '12345' ); + +# TEST +is( $value, '12345', "Reading a default values from non-existent section" ); + +# Clean up when we're done +t_unlink("test01.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/02weird.t libconfig-inifiles-perl-3.000001/t/02weird.t --- libconfig-inifiles-perl-2.94/t/02weird.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/02weird.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,88 +1,86 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -# Should be 6. -use Test::More tests => 6; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::Debug; -use Config::IniFiles::TestPaths; - -my ($ini, $value); - - -$ini = Config::IniFiles->new(-file => t_file("test.ini")); -$ini->_assert_invariants(); -$ini->SetFileName(t_file("test02.ini")); -$ini->SetWriteMode("0666"); - -# print "Weird characters in section name . "; -$value = $ini->val('[w]eird characters', 'multiline'); -$ini->_assert_invariants(); -# TEST -is( - $value, - "This$/is a multi-line$/value", - "Weird characters in section name", -); - -$ini->newval("test7|anything", "exists", "yes"); -$ini->_assert_invariants(); -$ini->RewriteConfig; -$ini->ReadConfig; -$ini->_assert_invariants(); -$value = $ini->val("test7|anything", "exists"); -# TEST -is( - $value, - "yes", - "More weird chars.", -); - -# Test 3/4 -# Make sure whitespace after parameter name is not included in name -# TEST -is( $ini->val( 'test7', 'criterion' ), - 'price <= maximum' , - "Make sure whitespace after parameter name is not included in name", -); -# TEST -ok( - ! defined $ini->val( 'test7', 'criterion ' ), - "For criterion containing whitespace returns undef.", -); - -# Test 5 -# Build a file from scratch with tied interface for testing -my %test; -# TEST -ok( (tie %test, 'Config::IniFiles'), "Tying is successful" ); -tied(%test)->SetFileName(t_file('test02.ini')); - -# Test 6 -# Also with pipes when using tied interface using vlaue of 0 -$test{'2'}={}; -tied(%test)->_assert_invariants(); -$test{'2'}{'test'}="sleep"; -tied(%test)->_assert_invariants(); -my $sectionheader="0|2"; -$test{$sectionheader}={}; -tied(%test)->_assert_invariants(); -$test{$sectionheader}{'vacation'}=0; -tied(%test)->_assert_invariants(); -tied(%test)->RewriteConfig(); -tied(%test)->ReadConfig; -# TEST -ok( - scalar($test{$sectionheader}{'vacation'} == 0), - "Returned 0", -); - -# Clean up when we're done -t_unlink("test02.ini"); - +#!/usr/bin/perl + +use strict; +use warnings; + +# Should be 6. +use Test::More tests => 6; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::Debug; +use Config::IniFiles::TestPaths; + +my ( $ini, $value ); + +$ini = Config::IniFiles->new( -file => t_file("test.ini") ); +$ini->_assert_invariants(); +$ini->SetFileName( t_file("test02.ini") ); +$ini->SetWriteMode("0666"); + +# print "Weird characters in section name . "; +$value = $ini->val( '[w]eird characters', 'multiline' ); +$ini->_assert_invariants(); + +# TEST +is( + $value, + "This$/is a multi-line$/value", + "Weird characters in section name", +); + +$ini->newval( "test7|anything", "exists", "yes" ); +$ini->_assert_invariants(); +$ini->RewriteConfig; +$ini->ReadConfig; +$ini->_assert_invariants(); +$value = $ini->val( "test7|anything", "exists" ); + +# TEST +is( $value, "yes", "More weird chars.", ); + +# Test 3/4 +# Make sure whitespace after parameter name is not included in name +# TEST +is( + $ini->val( 'test7', 'criterion' ), + 'price <= maximum', + "Make sure whitespace after parameter name is not included in name", +); + +# TEST +ok( + !defined $ini->val( 'test7', 'criterion ' ), + "For criterion containing whitespace returns undef.", +); + +# Test 5 +# Build a file from scratch with tied interface for testing +my %test; + +# TEST +ok( ( tie %test, 'Config::IniFiles' ), "Tying is successful" ); +tied(%test)->SetFileName( t_file('test02.ini') ); + +# Test 6 +# Also with pipes when using tied interface using value of 0 +$test{'2'} = {}; +tied(%test)->_assert_invariants(); +$test{'2'}{'test'} = "sleep"; +tied(%test)->_assert_invariants(); +my $sectionheader = "0|2"; +$test{$sectionheader} = {}; +tied(%test)->_assert_invariants(); +$test{$sectionheader}{'vacation'} = 0; +tied(%test)->_assert_invariants(); +tied(%test)->RewriteConfig(); +tied(%test)->ReadConfig; + +# TEST +ok( scalar( $test{$sectionheader}{'vacation'} == 0 ), "Returned 0", ); + +# Clean up when we're done +t_unlink("test02.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/03comments.t libconfig-inifiles-perl-3.000001/t/03comments.t --- libconfig-inifiles-perl-2.94/t/03comments.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/03comments.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,178 +1,197 @@ -#!/usr/bin/perl -# -# Comment preservation -# - -use strict; -use warnings; - -use Test::More tests => 17; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::TestPaths; -use Config::IniFiles::Slurp qw( slurp ); - -my $ors = $\ || "\n"; -my $irs = $/ || "\n"; -my ($ini, $value); - -# Load ini file and write as new file -$ini = Config::IniFiles->new( -file => t_file("test.ini")); -$ini->SetFileName(t_file("test03.ini")); -$ini->SetWriteMode("0666"); -t_unlink("test03.ini"); -$ini->RewriteConfig; -$ini->ReadConfig; -# TEST -ok($ini, "ini is still initialised"); - -sub t_slurp -{ - return slurp(t_file(@_)); -} - -# Section comments preserved -my $contents = t_slurp("test03.ini"); -# TEST -ok ( - scalar($contents =~ /\# This is a section comment[$ors]\[test1\]/), - "Found section comment." -); - -# Parameter comments preserved -# TEST -ok( - scalar($contents =~ /\# This is a parm comment[$ors]five=value5/), - "Contains Parm comment.", -); - -# Setting Section Comment -$ini->setval('foo','bar','qux'); -# TEST -ok ($ini->SetSectionComment('foo', 'This is a section comment', 'This comment takes two lines!'), - "SetSectionComment returns a true value.", -); - -# Getting Section Comment -my @comment = $ini->GetSectionComment('foo'); -# TEST -is_deeply( - \@comment, - ['# This is a section comment', '# This comment takes two lines!',], - "Section comments are OK.", -); - -# This is a test for: https://rt.cpan.org/Ticket/Display.html?id=8612 -# TEST -is( - scalar($ini->GetSectionComment('foo')), - "# This is a section comment$irs# This comment takes two lines!", - "GetSectionComment in scalar context returns a joined one.", -); - -# Deleting Section Comment -$ini->DeleteSectionComment('foo'); -# Should not exist! -# TEST -ok( - !defined($ini->GetSectionComment('foo')), - "foo section comment does not exist", -); - -# Setting Parameter Comment -# TEST -ok ( - $ini->SetParameterComment( - 'foo', 'bar', 'This is a parameter comment', - 'This comment takes two lines!' - ), - "SetParameterCount was successful", -); - -# Getting Parameter Comment -@comment = $ini->GetParameterComment('foo', 'bar'); -# TEST -is_deeply( - \@comment, - ['# This is a parameter comment', '# This comment takes two lines!'], - "GetParameterComment returns the correct result.", -); - -# TEST -is( - scalar($ini->GetParameterComment('foo', 'bar')), - "# This is a parameter comment$irs# This comment takes two lines!", - "GetParameterComment returns comments separated by newlines", -); - -# Deleting Parameter Comment -$ini->DeleteParameterComment('foo', 'bar'); -# Should not exist! -# TEST -ok( - !defined($ini->GetSectionComment('foo','bar')), - "GetSectionComment for foo/bar should not exist" -); - -# Reading a section comment from the file -@comment = $ini->GetSectionComment('test1'); -# TEST -is_deeply( - \@comment, - ['# This is a section comment'], - "A single section comment for test1", -); - -# Reading a parameter comment from the file -@comment = $ini->GetParameterComment('test2', 'five'); -# TEST -is_deeply( - \@comment, - [ '# This is a parm comment'], - "Reading a parameter comment from the file", -); - -# Reading a comment that starts with ';' -@comment = $ini->GetSectionComment('MixedCaseSect'); -# TEST -is_deeply( - \@comment, - [ '; This is a semi-colon comment' ], - "Singled Section Comment for MixedCaseSect. Reading a comment that starts with ;", -); - -# Test 13 -# Loading from a file with alternate comment characters -# and also test continuation characters (in one file) -$ini = Config::IniFiles->new( - -file => t_file("cmt.ini"), - -commentchar => '@', - -allowcontinue => 1 -); - -# TEST -ok($ini, "cmt.ini instance was properly initialised."); - -$value = $ini->GetParameterComment('Library', 'addmultf_lib'); - -# TEST -ok ( - scalar($value =~ /\@#\@CF Automatically created by 'config_project' at Thu Mar 21 08:46:54 2002/), - "Contains Parameter Comment starting with an at-sign.", -); - -# Test 15 -$value = $ini->val('turbo_library', 'TurboLibPaths'); - -# TEST -ok ( - scalar($value =~ m{\$WORKAREA/resources/c11_test_flow/vhdl_rtl\s+\$WORKAREA/resources/cstarlib_reg_1v5/vhdl_rtl}), - "value is OK." -); - -# Clean up when we're done -t_unlink("test03.ini"); - +#!/usr/bin/perl +# +# Comment preservation +# + +use strict; +use warnings; + +use Test::More tests => 17; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; +use Config::IniFiles::Slurp qw( slurp ); + +my $ors = $\ || "\n"; +my $irs = $/ || "\n"; +my ( $ini, $value ); + +# Load ini file and write as new file +$ini = Config::IniFiles->new( -file => t_file("test.ini") ); +$ini->SetFileName( t_file("test03.ini") ); +$ini->SetWriteMode("0666"); +t_unlink("test03.ini"); +$ini->RewriteConfig; +$ini->ReadConfig; + +# TEST +ok( $ini, "ini is still initialised" ); + +sub t_slurp +{ + return slurp( t_file(@_) ); +} + +# Section comments preserved +my $contents = t_slurp("test03.ini"); + +# TEST +ok( scalar( $contents =~ /\# This is a section comment[$ors]\[test1\]/ ), + "Found section comment." ); + +# Parameter comments preserved +# TEST +ok( + scalar( $contents =~ /\# This is a parm comment[$ors]five=value5/ ), + "Contains Parm comment.", +); + +# Setting Section Comment +$ini->setval( 'foo', 'bar', 'qux' ); + +# TEST +ok( + $ini->SetSectionComment( + 'foo', + 'This is a section comment', + 'This comment takes two lines!' + ), + "SetSectionComment returns a true value.", +); + +# Getting Section Comment +my @comment = $ini->GetSectionComment('foo'); + +# TEST +is_deeply( + \@comment, + [ '# This is a section comment', '# This comment takes two lines!', ], + "Section comments are OK.", +); + +# This is a test for: https://rt.cpan.org/Ticket/Display.html?id=8612 +# TEST +is( + scalar( $ini->GetSectionComment('foo') ), + "# This is a section comment$irs# This comment takes two lines!", + "GetSectionComment in scalar context returns a joined one.", +); + +# Deleting Section Comment +$ini->DeleteSectionComment('foo'); + +# Should not exist! +# TEST +ok( + !defined( $ini->GetSectionComment('foo') ), + "foo section comment does not exist", +); + +# Setting Parameter Comment +# TEST +ok( + $ini->SetParameterComment( + 'foo', 'bar', + 'This is a parameter comment', 'This comment takes two lines!' + ), + "SetParameterCount was successful", +); + +# Getting Parameter Comment +@comment = $ini->GetParameterComment( 'foo', 'bar' ); + +# TEST +is_deeply( + \@comment, + [ '# This is a parameter comment', '# This comment takes two lines!' ], + "GetParameterComment returns the correct result.", +); + +# TEST +is( + scalar( $ini->GetParameterComment( 'foo', 'bar' ) ), + "# This is a parameter comment$irs# This comment takes two lines!", + "GetParameterComment returns comments separated by newlines", +); + +# Deleting Parameter Comment +$ini->DeleteParameterComment( 'foo', 'bar' ); + +# Should not exist! +# TEST +ok( + !defined( $ini->GetSectionComment( 'foo', 'bar' ) ), + "GetSectionComment for foo/bar should not exist" +); + +# Reading a section comment from the file +@comment = $ini->GetSectionComment('test1'); + +# TEST +is_deeply( + \@comment, + ['# This is a section comment'], + "A single section comment for test1", +); + +# Reading a parameter comment from the file +@comment = $ini->GetParameterComment( 'test2', 'five' ); + +# TEST +is_deeply( + \@comment, + ['# This is a parm comment'], + "Reading a parameter comment from the file", +); + +# Reading a comment that starts with ';' +@comment = $ini->GetSectionComment('MixedCaseSect'); + +# TEST +is_deeply( + \@comment, + ['; This is a semi-colon comment'], +"Singled Section Comment for MixedCaseSect. Reading a comment that starts with ;", +); + +# Test 13 +# Loading from a file with alternate comment characters +# and also test continuation characters (in one file) +$ini = Config::IniFiles->new( + -file => t_file("cmt.ini"), + -commentchar => '@', + -allowcontinue => 1 +); + +# TEST +ok( $ini, "cmt.ini instance was properly initialised." ); + +$value = $ini->GetParameterComment( 'Library', 'addmultf_lib' ); + +# TEST +ok( + scalar( + $value =~ +/\@#\@CF Automatically created by 'config_project' at Thu Mar 21 08:46:54 2002/ + ), + "Contains Parameter Comment starting with an at-sign.", +); + +# Test 15 +$value = $ini->val( 'turbo_library', 'TurboLibPaths' ); + +# TEST +ok( + scalar( + $value =~ +m{\$WORKAREA/resources/c11_test_flow/vhdl_rtl\s+\$WORKAREA/resources/cstarlib_reg_1v5/vhdl_rtl} + ), + "value is OK." +); + +# Clean up when we're done +t_unlink("test03.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/04import.t libconfig-inifiles-perl-3.000001/t/04import.t --- libconfig-inifiles-perl-2.94/t/04import.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/04import.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,101 +1,111 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 19; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::TestPaths; - -my $ors = $\ || "\n"; - -my ($ini,$value); - -# -# Import tests added by JW/WADG -# - -# test 1 -# print "Import a file .................... "; -my $en = Config::IniFiles->new( -file => t_file('en.ini') ); -# TEST -ok ($en, "IniEn was initialized." ); - -# test 2 -my $es = Config::IniFiles->new( -file => t_file('es.ini'), -import => $en ); -# TEST -ok( $es, "Ini es was initialized." ); - - -# test 3 -# Imported values are good -my $en_sn = $en->val( 'x', 'ShortName' ); -my $es_sn = $es->val( 'x', 'ShortName' ); -my $en_ln = $en->val( 'x', 'LongName' ); -my $es_ln = $es->val( 'x', 'LongName' ); -my $en_dn = $en->val( 'm', 'DataName' ); -my $es_dn = $es->val( 'm', 'DataName' ); - -# TEST -is ($en_sn, 'GENERAL', "en_sn is GENERAL"); - -# TEST -is ($es_sn, 'GENERAL', "es_sn is GENERAL too"); - -# TEST -is ($en_ln, 'General Summary', "en_ln is OK."); - -# TEST -is ($es_ln, 'Resumen general', "es_ln is in Spanish"); - -# TEST -is ($en_dn, 'Month', "dn is in English"); - -# TEST -is ($es_dn, 'Mes', "es_dn is in Spanish"); - -# test 4 -# Import another level -my $ca = Config::IniFiles->new( -file => t_file('ca.ini'), -import => $es ); - -# TEST -is ($en_sn, $ca->val( 'x', 'ShortName' ), "en_sn is OK."); -# TEST -is ($es_sn, $ca->val( 'x', 'ShortName' ), "es_sn is OK."); -# TEST -is ($ca->val( 'x', 'LongName' ), 'Resum general', "LongName is OK."); -# TEST -is ($ca->val( 'm', 'DataName' ), 'Mes', "DateName is OK."); - -# test 5 -# Try creating a config file that imports from a hand-built object -my $ini_a = Config::IniFiles->new(); -$ini_a -> AddSection('alpha'); -$ini_a -> AddSection('x'); -$ini_a -> newval('x', 'x', 1); -$ini_a -> newval('x', 'LongName', 1); -$ini_a -> newval('m', 'z', 1); -# TEST -is ($ini_a->val('x', 'x'), 1, "x/x"); - -# TEST -is ($ini_a->val('x', 'LongName'), 1, "x/LongName"); - -# TEST -is ($ini_a->val('m', 'z'), 1, "m/z"); - -# test 6 -## show that importing a file-less object into a file-based one works -my $ini_b = Config::IniFiles->new( -file=>t_file('ca.ini'), -import=>$ini_a ); -# TEST -is ($ini_b->val('x', 'LongName'), 'Resum general', "x/Longname"); -# TEST -is ($ini_b->val('x', 'x', 0), 1, "x/x"); -# TEST -is ($ini_b->val('m', 'z', 0), 1, "m/z"); -# TEST -is ($ini_b->val('m', 'LongName'), 'Resum mensual', "m/LongName"); +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 19; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; + +my $ors = $\ || "\n"; + +my ( $ini, $value ); + +# +# Import tests added by JW/WADG +# + +# test 1 +# print "Import a file .................... "; +my $en = Config::IniFiles->new( -file => t_file('en.ini') ); + +# TEST +ok( $en, "IniEn was initialized." ); + +# test 2 +my $es = Config::IniFiles->new( -file => t_file('es.ini'), -import => $en ); + +# TEST +ok( $es, "Ini es was initialized." ); + +# test 3 +# Imported values are good +my $en_sn = $en->val( 'x', 'ShortName' ); +my $es_sn = $es->val( 'x', 'ShortName' ); +my $en_ln = $en->val( 'x', 'LongName' ); +my $es_ln = $es->val( 'x', 'LongName' ); +my $en_dn = $en->val( 'm', 'DataName' ); +my $es_dn = $es->val( 'm', 'DataName' ); + +# TEST +is( $en_sn, 'GENERAL', "en_sn is GENERAL" ); + +# TEST +is( $es_sn, 'GENERAL', "es_sn is GENERAL too" ); + +# TEST +is( $en_ln, 'General Summary', "en_ln is OK." ); + +# TEST +is( $es_ln, 'Resumen general', "es_ln is in Spanish" ); + +# TEST +is( $en_dn, 'Month', "dn is in English" ); + +# TEST +is( $es_dn, 'Mes', "es_dn is in Spanish" ); + +# test 4 +# Import another level +my $ca = Config::IniFiles->new( -file => t_file('ca.ini'), -import => $es ); + +# TEST +is( $en_sn, $ca->val( 'x', 'ShortName' ), "en_sn is OK." ); + +# TEST +is( $es_sn, $ca->val( 'x', 'ShortName' ), "es_sn is OK." ); + +# TEST +is( $ca->val( 'x', 'LongName' ), 'Resum general', "LongName is OK." ); + +# TEST +is( $ca->val( 'm', 'DataName' ), 'Mes', "DateName is OK." ); + +# test 5 +# Try creating a config file that imports from a hand-built object +my $ini_a = Config::IniFiles->new(); +$ini_a->AddSection('alpha'); +$ini_a->AddSection('x'); +$ini_a->newval( 'x', 'x', 1 ); +$ini_a->newval( 'x', 'LongName', 1 ); +$ini_a->newval( 'm', 'z', 1 ); + +# TEST +is( $ini_a->val( 'x', 'x' ), 1, "x/x" ); + +# TEST +is( $ini_a->val( 'x', 'LongName' ), 1, "x/LongName" ); + +# TEST +is( $ini_a->val( 'm', 'z' ), 1, "m/z" ); + +# test 6 +## show that importing a file-less object into a file-based one works +my $ini_b = + Config::IniFiles->new( -file => t_file('ca.ini'), -import => $ini_a ); + +# TEST +is( $ini_b->val( 'x', 'LongName' ), 'Resum general', "x/Longname" ); + +# TEST +is( $ini_b->val( 'x', 'x', 0 ), 1, "x/x" ); + +# TEST +is( $ini_b->val( 'm', 'z', 0 ), 1, "m/z" ); + +# TEST +is( $ini_b->val( 'm', 'LongName' ), 'Resum mensual', "m/LongName" ); diff -Nru libconfig-inifiles-perl-2.94/t/05hash.t libconfig-inifiles-perl-3.000001/t/05hash.t --- libconfig-inifiles-perl-2.94/t/05hash.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/05hash.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,178 +1,197 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 19; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::TestPaths; - -my %ini; -my ($ini, $value); -my (@value); - -# Get files from the 't' directory, portably -t_unlink("test05.ini"); - -# Test 1 -# Tying a hash. -# TEST -ok ( - (tie %ini, 'Config::IniFiles', - ( -file => t_file("test.ini"), -default => 'test1', -nocase => 1 ) - ), - "Tie to test.ini was successful." -); - -tied(%ini)->SetFileName(t_file("test05.ini")); -tied(%ini)->SetWriteMode("0666"); - -# Test 2 -# Retrieve scalar value -$value = $ini{test1}{one}; -# TEST -is($value, 'value1', - "Value is value1" -); - -# Test 3 -# Retrieve array reference -$value = $ini{test1}{mult}; -# TEST -is (ref($value), 'ARRAY', "test1/mult is an array."); - -# Test 4 -# Creating a scalar value using tied hash -$ini{'test2'}{'seven'} = 'value7'; -tied(%ini)->RewriteConfig; -tied(%ini)->ReadConfig; -$value = $ini{'test2'}{'seven'}; -# TEST -is ($value, 'value7', "test2/seven is value7"); - -# Test 5 -# Deleting a scalar value using tied hash -delete $ini{test2}{seven}; -tied(%ini)->RewriteConfig; -tied(%ini)->ReadConfig; -$value=''; -$value = $ini{test2}{seven}; -# TEST -ok(! defined ($value), "test2/seven does not exist"); - -# Test 6 -# Testing default values using tied hash -# TEST -is ( $ini{test2}{three}, 'value3', "test2/three is equal to value3" ); - -# Test 7 -# Case insensitivity in a hash parameter -# TEST -is ($ini{test2}{FOUR}, 'value4', "test2/FOUR is value4 - case insensitivity" ); - -# Test 8 -# Case insensitivity in a hash section -# TEST -is( $ini{TEST2}{four}, 'value4', "TEST2/four is value4 - case insensitivity" ); - -# Test 9 -# Listing section names using keys -$ini = Config::IniFiles->new( -file => t_file("test.ini"), -default => 'test1', -nocase => 1 ); -$ini->SetFileName(t_file("test05b.ini")); -{ - my @S1 = $ini->Sections; - my @S2 = keys %ini; - - # TEST - is_deeply (\@S1, \@S2, "All sections OK."); -} - -# Test 10 -# Listing parameter names using keys -{ - my @S1 = sort { $a cmp $b } $ini->Parameters('test1'); - my @S2 = sort { $a cmp $b } keys %{$ini{test1}}; - # TEST - is_deeply (\@S1, \@S2, "All keys of section 'test1' are OK."); -} - -# Test 11 -# Copying a section using tied hash -my %bak = %{$ini{test2}}; -# TEST -is ($bak{six}, "value6", "Copied value is OK."); - -# Test 12 -# Deleting a whole section using tied hash -delete $ini{test2}; -$value = $ini{test2}; -# TEST -ok ( (!$value), "test2 section was deleted"); - -# Test 13 -# Creating a section and parameters using a hash -$ini{newsect} = {}; -%{$ini{newsect}} = %bak; -$value = $ini{newsect}{four} || ''; -# TEST -is ($value, 'value4', "Creating a section and parameters using a hash"); - -# Test 14 -# Checking use of default values for newly created section -$value = $ini{newsect}{one}; -# TEST -is ( $value , "value1", - "Checking use of default values for newly created section" -); - -# Test 15 -# print "Store new section in hash ........ "; -tied(%ini)->RewriteConfig; -tied(%ini)->ReadConfig; -$value = $ini{newsect}{four}; -# TEST -is ($value, 'value4', "Store new section in hash"); - -# Test 16 -# Writing 2 line multivalue and returning it -$ini{newsect} = {}; -$ini{test1}{multi_2} = ['line 1', 'line 2']; -tied(%ini)->RewriteConfig; -tied(%ini)->ReadConfig; -@value = @{$ini{test1}{multi_2}}; -# TEST -is_deeply ( \@value, ['line 1', 'line 2'], - "Writing 2 line multivalue and returning it" -); - -# Test 17 -# Getting a default value not in the file -tie %ini, 'Config::IniFiles', ( -file => t_file("test.ini"), -default => 'default', -nocase => 1 ); -$ini{default}{cassius} = 'clay'; -$value = $ini{test1}{cassius}; -# TEST -is ( $value, 'clay', "Getting a default value not in the file"); - -# Test 18 -# Setting value to number of elements in array -my @thing = ("one", "two", "three"); -$ini{newsect}{five} = @thing; -$value = $ini{newsect}{five}; -# TEST -is ($value, 3, "Setting value to number of elements in array"); - -# Test 19 -# Setting value to number of elements in array -@thing = ("one"); -$ini{newsect}{five} = @thing; -$value = $ini{newsect}{five}; -# TEST -is ($value, 1, "Testing that value is 1."); - -# Clean up when we're done -t_unlink("test05.ini"); - +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 19; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; + +my %ini; +my ( $ini, $value ); +my (@value); + +# Get files from the 't' directory, portably +t_unlink("test05.ini"); + +# Test 1 +# Tying a hash. +# TEST +ok( + ( + tie %ini, 'Config::IniFiles', + ( -file => t_file("test.ini"), -default => 'test1', -nocase => 1 ) + ), + "Tie to test.ini was successful." +); + +tied(%ini)->SetFileName( t_file("test05.ini") ); +tied(%ini)->SetWriteMode("0666"); + +# Test 2 +# Retrieve scalar value +$value = $ini{test1}{one}; + +# TEST +is( $value, 'value1', "Value is value1" ); + +# Test 3 +# Retrieve array reference +$value = $ini{test1}{mult}; + +# TEST +is( ref($value), 'ARRAY', "test1/mult is an array." ); + +# Test 4 +# Creating a scalar value using tied hash +$ini{'test2'}{'seven'} = 'value7'; +tied(%ini)->RewriteConfig; +tied(%ini)->ReadConfig; +$value = $ini{'test2'}{'seven'}; + +# TEST +is( $value, 'value7', "test2/seven is value7" ); + +# Test 5 +# Deleting a scalar value using tied hash +delete $ini{test2}{seven}; +tied(%ini)->RewriteConfig; +tied(%ini)->ReadConfig; +$value = ''; +$value = $ini{test2}{seven}; + +# TEST +ok( !defined($value), "test2/seven does not exist" ); + +# Test 6 +# Testing default values using tied hash +# TEST +is( $ini{test2}{three}, 'value3', "test2/three is equal to value3" ); + +# Test 7 +# Case insensitivity in a hash parameter +# TEST +is( $ini{test2}{FOUR}, 'value4', "test2/FOUR is value4 - case insensitivity" ); + +# Test 8 +# Case insensitivity in a hash section +# TEST +is( $ini{TEST2}{four}, 'value4', "TEST2/four is value4 - case insensitivity" ); + +# Test 9 +# Listing section names using keys +$ini = Config::IniFiles->new( + -file => t_file("test.ini"), + -default => 'test1', + -nocase => 1 +); +$ini->SetFileName( t_file("test05b.ini") ); +{ + my @S1 = $ini->Sections; + my @S2 = keys %ini; + + # TEST + is_deeply( \@S1, \@S2, "All sections OK." ); +} + +# Test 10 +# Listing parameter names using keys +{ + my @S1 = sort { $a cmp $b } $ini->Parameters('test1'); + my @S2 = sort { $a cmp $b } keys %{ $ini{test1} }; + + # TEST + is_deeply( \@S1, \@S2, "All keys of section 'test1' are OK." ); +} + +# Test 11 +# Copying a section using tied hash +my %bak = %{ $ini{test2} }; + +# TEST +is( $bak{six}, "value6", "Copied value is OK." ); + +# Test 12 +# Deleting a whole section using tied hash +delete $ini{test2}; +$value = $ini{test2}; + +# TEST +ok( ( !$value ), "test2 section was deleted" ); + +# Test 13 +# Creating a section and parameters using a hash +$ini{newsect} = {}; +%{ $ini{newsect} } = %bak; +$value = $ini{newsect}{four} || ''; + +# TEST +is( $value, 'value4', "Creating a section and parameters using a hash" ); + +# Test 14 +# Checking use of default values for newly created section +$value = $ini{newsect}{one}; + +# TEST +is( $value, "value1", + "Checking use of default values for newly created section" ); + +# Test 15 +# print "Store new section in hash ........ "; +tied(%ini)->RewriteConfig; +tied(%ini)->ReadConfig; +$value = $ini{newsect}{four}; + +# TEST +is( $value, 'value4', "Store new section in hash" ); + +# Test 16 +# Writing 2 line multivalue and returning it +$ini{newsect} = {}; +$ini{test1}{multi_2} = [ 'line 1', 'line 2' ]; +tied(%ini)->RewriteConfig; +tied(%ini)->ReadConfig; +@value = @{ $ini{test1}{multi_2} }; + +# TEST +is_deeply( + \@value, + [ 'line 1', 'line 2' ], + "Writing 2 line multivalue and returning it" +); + +# Test 17 +# Getting a default value not in the file +tie %ini, 'Config::IniFiles', + ( -file => t_file("test.ini"), -default => 'default', -nocase => 1 ); +$ini{default}{cassius} = 'clay'; +$value = $ini{test1}{cassius}; + +# TEST +is( $value, 'clay', "Getting a default value not in the file" ); + +# Test 18 +# Setting value to number of elements in array +my @thing = ( "one", "two", "three" ); +$ini{newsect}{five} = @thing; +$value = $ini{newsect}{five}; + +# TEST +is( $value, 3, "Setting value to number of elements in array" ); + +# Test 19 +# Setting value to number of elements in array +@thing = ("one"); +$ini{newsect}{five} = @thing; +$value = $ini{newsect}{five}; + +# TEST +is( $value, 1, "Testing that value is 1." ); + +# Clean up when we're done +t_unlink("test05.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/06oo.t libconfig-inifiles-perl-3.000001/t/06oo.t --- libconfig-inifiles-perl-2.94/t/06oo.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/06oo.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,102 +1,117 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -# Originally: 9 -use Test::More tests => 11; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::TestPaths; - -my ($en, $ini, $success); - -# test 1 -# print "Empty list when no groups ........ "; -$en = Config::IniFiles->new( -file => t_file('en.ini') ); -# TEST -is ( scalar($en->Groups), 0, "Empty list when no groups" ); - -# test 2 -# print "Creating new object, no file ..... "; -$ini = Config::IniFiles->new; -# TEST -ok ($ini, "Creating new object"); - -# test 3 -# print "Setting new file name ............."; -# TEST -ok ($ini->SetFileName(t_file('test06.ini')), "Setting new file name"); - -# test 4 -# print "Saving under new file name ........"; -# TEST -ok ($ini->RewriteConfig() && (-f t_file('test06.ini')), - "Saving under new file name ........" -); - -# test 5 -# print "SetSectionComment ................."; -$ini->newval("Section1", "Parameter1", "Value1"); -my @section_comment = ("Line 1 of section comment.", "Line 2 of section comment", "Line 3 of section comment"); - -# TEST -ok( - $ini->SetSectionComment("Section1", @section_comment), - "SetSectionComment() was successful." -); - -# test 6 -# print "GetSectionComment ................."; -{ - my @comment = $ini->GetSectionComment("Section1"); - - # TEST - is_deeply( - \@comment, - [ - "# Line 1 of section comment.", - "# Line 2 of section comment", - "# Line 3 of section comment", - ], - "multi-line GetSectionComment", - ); -} - -# test 7 -# print "DeleteSectionComment .............."; -$ini->DeleteSectionComment("Section1"); -# TEST -ok(!defined($ini->GetSectionComment("Section1")), - "DeleteSectionComment was successful."); - -# test 8 -# CopySection -$ini->CopySection( 'Section1', 'Section2' ); -# TEST -ok( $ini->Parameters( 'Section2' ), "CopySection was successful." ); - -# test 9 -# DeleteSection -$ini->DeleteSection( 'Section1' ); -# TEST -ok( ! $ini->Parameters( 'Section1' ), "DeleteSection was successful." ); - -# test 10 -# RenameSection -$ini->RenameSection( 'Section2', 'Section1' ); -# TEST -ok( ! $ini->Parameters( 'Section2' ) && $ini->Parameters( 'Section1' ) && $ini->val('Section1','Parameter1') eq 'Value1' , "RenameSection was successful." ); - -# test 11 -# Delete entire config -$ini->Delete(); -# TEST -ok( ! $ini->Sections(), "Delete entire config"); - -# Clean up when we're done -t_unlink("test06.ini"); - +#!/usr/bin/perl + +use strict; +use warnings; + +# Originally: 9 +use Test::More tests => 11; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; + +my ( $en, $ini, $success ); + +# test 1 +# print "Empty list when no groups ........ "; +$en = Config::IniFiles->new( -file => t_file('en.ini') ); + +# TEST +is( scalar( $en->Groups ), 0, "Empty list when no groups" ); + +# test 2 +# print "Creating new object, no file ..... "; +$ini = Config::IniFiles->new; + +# TEST +ok( $ini, "Creating new object" ); + +# test 3 +# print "Setting new file name ............."; +# TEST +ok( $ini->SetFileName( t_file('test06.ini') ), "Setting new file name" ); + +# test 4 +# print "Saving under new file name ........"; +# TEST +ok( $ini->RewriteConfig() && ( -f t_file('test06.ini') ), + "Saving under new file name ........" ); + +# test 5 +# print "SetSectionComment ................."; +$ini->newval( "Section1", "Parameter1", "Value1" ); +my @section_comment = ( + "Line 1 of section comment.", + "Line 2 of section comment", + "Line 3 of section comment" +); + +# TEST +ok( $ini->SetSectionComment( "Section1", @section_comment ), + "SetSectionComment() was successful." ); + +# test 6 +# print "GetSectionComment ................."; +{ + my @comment = $ini->GetSectionComment("Section1"); + + # TEST + is_deeply( + \@comment, + [ + "# Line 1 of section comment.", + "# Line 2 of section comment", + "# Line 3 of section comment", + ], + "multi-line GetSectionComment", + ); +} + +# test 7 +# print "DeleteSectionComment .............."; +$ini->DeleteSectionComment("Section1"); + +# TEST +ok( + !defined( $ini->GetSectionComment("Section1") ), + "DeleteSectionComment was successful." +); + +# test 8 +# CopySection +$ini->CopySection( 'Section1', 'Section2' ); + +# TEST +ok( $ini->Parameters('Section2'), "CopySection was successful." ); + +# test 9 +# DeleteSection +$ini->DeleteSection('Section1'); + +# TEST +ok( !$ini->Parameters('Section1'), "DeleteSection was successful." ); + +# test 10 +# RenameSection +$ini->RenameSection( 'Section2', 'Section1' ); + +# TEST +ok( + !$ini->Parameters('Section2') + && $ini->Parameters('Section1') + && $ini->val( 'Section1', 'Parameter1' ) eq 'Value1', + "RenameSection was successful." +); + +# test 11 +# Delete entire config +$ini->Delete(); + +# TEST +ok( !$ini->Sections(), "Delete entire config" ); + +# Clean up when we're done +t_unlink("test06.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/07misc.t libconfig-inifiles-perl-3.000001/t/07misc.t --- libconfig-inifiles-perl-2.94/t/07misc.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/07misc.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,71 +1,79 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 5; - -use Config::IniFiles; - -use lib "./t/lib"; - -use Config::IniFiles::TestPaths; - -my ($ini, $value); - -t_unlink("test07.ini"); - -# Test 1 -# Multiple equals in a parameter - should split on the first -$ini = Config::IniFiles->new( -file => t_file('test.ini') ); -# TEST -is ( scalar($ini->val('test7', 'criterion')), 'price <= maximum', - "Multiple equals in a parameter - should split on the first", -); - -# Test 2 -# Parameters whose name is a substring of existing parameters should be loaded -$value = $ini->val('substring', 'boot'); -# TEST -is( $value, 'smarty', - "Parameters whose name is a substring of existing parameters should be loaded"); - -# test 3 -# See if default option works -$ini = Config::IniFiles->new( -file => t_file("test.ini"), -default => 'test1', -nocase => 1 ); -$ini->SetFileName(t_file("test07.ini")); -$ini->SetWriteMode("0666"); - -# TEST -ok (defined($ini), - "default option works - \$ini works."); - -# TEST -is ( scalar($ini->val('test2', 'three')), 'value3', - "default option works - ->val" -); - -# Test 4 -# Check that Config::IniFiles respects RO permission on original INI file -$ini->WriteConfig(t_file("test07.ini")); -chmod 0444, t_file("test07.ini"); - -SKIP: -{ - if (-w t_file("test07.ini")) - { - skip ('RO Permissions not settable.', 1); - } - else - { - $ini->setval('test2', 'three', 'should not be here'); - $value = $ini->WriteConfig(t_file("test07.ini")); - warn "Value is $value!" if (defined $value); - # TEST - ok(!defined($value), "Value is undefined."); - } # end if -} - -# Clean up when we're done -t_unlink("test07.ini"); - +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 5; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; + +my ( $ini, $value ); + +t_unlink("test07.ini"); + +# Test 1 +# Multiple equals in a parameter - should split on the first +$ini = Config::IniFiles->new( -file => t_file('test.ini') ); + +# TEST +is( + scalar( $ini->val( 'test7', 'criterion' ) ), + 'price <= maximum', + "Multiple equals in a parameter - should split on the first", +); + +# Test 2 +# Parameters whose name is a substring of existing parameters should be loaded +$value = $ini->val( 'substring', 'boot' ); + +# TEST +is( $value, 'smarty', +"Parameters whose name is a substring of existing parameters should be loaded" +); + +# test 3 +# See if default option works +$ini = Config::IniFiles->new( + -file => t_file("test.ini"), + -default => 'test1', + -nocase => 1 +); +$ini->SetFileName( t_file("test07.ini") ); +$ini->SetWriteMode("0666"); + +# TEST +ok( defined($ini), "default option works - \$ini works." ); + +# TEST +is( scalar( $ini->val( 'test2', 'three' ) ), + 'value3', "default option works - ->val" ); + +# Test 4 +# Check that Config::IniFiles respects RO permission on original INI file +$ini->WriteConfig( t_file("test07.ini") ); +chmod 0444, t_file("test07.ini"); + +SKIP: +{ + if ( -w t_file("test07.ini") ) + { + skip( 'RO Permissions not settable.', 1 ); + } + else + { + $ini->setval( 'test2', 'three', 'should not be here' ); + $value = $ini->WriteConfig( t_file("test07.ini") ); + warn "Value is $value!" if ( defined $value ); + + # TEST + ok( !defined($value), "Value is undefined." ); + } # end if +} + +# Clean up when we're done +t_unlink("test07.ini"); + diff -Nru libconfig-inifiles-perl-2.94/t/08group.t libconfig-inifiles-perl-3.000001/t/08group.t --- libconfig-inifiles-perl-2.94/t/08group.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/08group.t 2019-01-16 09:53:16.000000000 +0000 @@ -19,8 +19,8 @@ # TEST is_deeply( - [$ini->GroupMembers("group")], - ["group member one", "group member two", "group member three"], + [ $ini->GroupMembers("group") ], + [ "group member one", "group member two", "group member three" ], "Group members with spaces", ); diff -Nru libconfig-inifiles-perl-2.94/t/09case.t libconfig-inifiles-perl-3.000001/t/09case.t --- libconfig-inifiles-perl-2.94/t/09case.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/09case.t 2019-01-16 09:53:16.000000000 +0000 @@ -1,6 +1,5 @@ #!/usr/bin/perl - use strict; use warnings; @@ -14,7 +13,6 @@ use Config::IniFiles::TestPaths; - my $ini; my @members; my $string; @@ -24,26 +22,26 @@ # Test 1 # newval and val - Check that correct case brings back the correct value $ini = Config::IniFiles->new; -$ini->newval("Section", "PaRaMeTeR", "Mixed Case"); -$ini->newval("Section", "Parameter", "Title Case"); -my $mixed_case = $ini->val("Section", "PaRaMeTeR"); -my $title_case = $ini->val("Section", "Parameter"); +$ini->newval( "Section", "PaRaMeTeR", "Mixed Case" ); +$ini->newval( "Section", "Parameter", "Title Case" ); +my $mixed_case = $ini->val( "Section", "PaRaMeTeR" ); +my $title_case = $ini->val( "Section", "Parameter" ); # TEST -is ($mixed_case, "Mixed Case", "correct case - Mixed Case"); +is( $mixed_case, "Mixed Case", "correct case - Mixed Case" ); # TEST -is ($title_case, "Title Case", "correct case - Title Case"); +is( $title_case, "Title Case", "correct case - Title Case" ); # Test 2 # Sections # Set up a controlled environment $ini = Config::IniFiles->new; -$ini->newval("Section", "Parameter", "Value"); -$ini->newval("section", "parameter", "value"); +$ini->newval( "Section", "Parameter", "Value" ); +$ini->newval( "section", "parameter", "value" ); # TEST -is (scalar($ini->Sections()), 2, "2 sections"); +is( scalar( $ini->Sections() ), 2, "2 sections" ); # Test 3 # Deleting values @@ -51,48 +49,49 @@ $ini = Config::IniFiles->new; -$ini->newval("Section", "Parameter", "Title Case"); -$ini->newval("Section", "parameter", "lower case"); -$ini->newval("Section", "PARAMETER", "UPPER CASE"); +$ini->newval( "Section", "Parameter", "Title Case" ); +$ini->newval( "Section", "parameter", "lower case" ); +$ini->newval( "Section", "PARAMETER", "UPPER CASE" ); my $delete_case_check_pass = 1; @members = $ini->Parameters("Section"); # TEST -is (scalar(@members), 3, "Delete check pass - 3 members"); +is( scalar(@members), 3, "Delete check pass - 3 members" ); -$ini->delval("Section", "PARAMETER"); +$ini->delval( "Section", "PARAMETER" ); @members = $ini->Parameters("Section"); # TEST -is (scalar(@members), 2 , "Delete check pass after delete - 2 members"); +is( scalar(@members), 2, "Delete check pass after delete - 2 members" ); # TEST -ok (first { index($_, "Parameter") >= 0 } @members, "Parameter exists"); +ok( first { index( $_, "Parameter" ) >= 0 } @members, "Parameter exists" ); # TEST -ok (first { index($_, "parameter") >= 0 } @members, "parameter exists"); +ok( first { index( $_, "parameter" ) >= 0 } @members, "parameter exists" ); { # Test 4 # Parameters $ini = Config::IniFiles->new; - $ini->newval("Section", "PaRaMeTeR", "Mixed Case"); - $ini->newval("Section", "Parameter", "Title Case"); - $ini->newval("SECTION", "Parameter", "N/A"); - my @parameter_list = $ini->Parameters("SECTION"); + $ini->newval( "Section", "PaRaMeTeR", "Mixed Case" ); + $ini->newval( "Section", "Parameter", "Title Case" ); + $ini->newval( "SECTION", "Parameter", "N/A" ); + my @parameter_list = $ini->Parameters("SECTION"); my $parameters_case_check_pass = 1; $parameters_case_check_pass = 0 unless scalar(@parameter_list) == 1; $parameters_case_check_pass = 0 unless $parameter_list[0] eq "Parameter"; - @parameter_list = $ini->Parameters("Section"); + @parameter_list = $ini->Parameters("Section"); $parameters_case_check_pass = 0 unless scalar(@parameter_list) == 2; my $parameters = join " ", @parameter_list; - $parameters_case_check_pass = 0 unless ($parameters =~ /PaRaMeTeR/); - $parameters_case_check_pass = 0 unless ($parameters =~ /Parameter/); + $parameters_case_check_pass = 0 unless ( $parameters =~ /PaRaMeTeR/ ); + $parameters_case_check_pass = 0 unless ( $parameters =~ /Parameter/ ); + # TEST - ok ($parameters_case_check_pass, "Parameters case check pass"); + ok( $parameters_case_check_pass, "Parameters case check pass" ); } { @@ -100,78 +99,80 @@ # Case sensitive handling of groups # Set up a controlled environment $ini = Config::IniFiles->new; - $ini->newval("interface foo", "parameter", "foo"); - $ini->newval("interface bar", "parameter", "bar"); - $ini->newval("INTERFACE blurgle", "parameter", "flurgle"); + $ini->newval( "interface foo", "parameter", "foo" ); + $ini->newval( "interface bar", "parameter", "bar" ); + $ini->newval( "INTERFACE blurgle", "parameter", "flurgle" ); my $group_case_check_pass = 1; + # We should have two groups - "interface" and "Interface" my $group_case_count = $ini->Groups(); - $group_case_check_pass = 0 unless ($group_case_count == 2); + $group_case_check_pass = 0 unless ( $group_case_count == 2 ); + # We don't want to get the "interface" entries when we use the wrong case - @members = $ini->GroupMembers("Interface"); - $group_case_check_pass = 0 unless (scalar(@members) == 0); + @members = $ini->GroupMembers("Interface"); + $group_case_check_pass = 0 unless ( scalar(@members) == 0 ); + # We *do* want to get the "interface" entries when we use the right case - @members = $ini->GroupMembers("interface"); - $group_case_check_pass = 0 unless (scalar(@members) == 2); - $group_case_check_pass = 0 unless (grep {/interface foo/} @members); - $group_case_check_pass = 0 unless (grep {/interface bar/} @members); + @members = $ini->GroupMembers("interface"); + $group_case_check_pass = 0 unless ( scalar(@members) == 2 ); + $group_case_check_pass = 0 unless ( grep { /interface foo/ } @members ); + $group_case_check_pass = 0 unless ( grep { /interface bar/ } @members ); + # TEST - ok ($group_case_check_pass, "Group cae check pass"); + ok( $group_case_check_pass, "Group cae check pass" ); } - - # CASE INSENSITIVE CHECKS { # Test 6 # newval - Check that case-insensitive version returns one value $ini = Config::IniFiles->new( -nocase => "1" ); - $ini->newval("Section", "PaRaMeTeR", "Mixed Case"); - $ini->newval("Section", "Parameter", "Title Case"); - my @values = $ini->val("Section", "parameter"); + $ini->newval( "Section", "PaRaMeTeR", "Mixed Case" ); + $ini->newval( "Section", "Parameter", "Title Case" ); + my @values = $ini->val( "Section", "parameter" ); # TEST - is_deeply (\@values, ["Title Case"], - "case-insensitive version returns one value" - ); + is_deeply( \@values, ["Title Case"], + "case-insensitive version returns one value" ); } # Test 7 # Case insensitive handling of groups -$ini = Config::IniFiles->new( -file =>t_file('test.ini'), -nocase => 1 ); +$ini = Config::IniFiles->new( -file => t_file('test.ini'), -nocase => 1 ); + # TEST -is_deeply( - [$ini->GroupMembers("GrOuP")], - ["group member one", "group member two", "group member three"] -); +is_deeply( [ $ini->GroupMembers("GrOuP") ], + [ "group member one", "group member two", "group member three" ] ); -$ini = Config::IniFiles->new( -file => t_file("test.ini"), -default => 'test1', -nocase => 1 ); -$ini->SetFileName(t_file("test09.ini")); +$ini = Config::IniFiles->new( + -file => t_file("test.ini"), + -default => 'test1', + -nocase => 1 +); +$ini->SetFileName( t_file("test09.ini") ); # test 8 # Case insensitivity in parameters # TEST -is( scalar($ini->val('test2', 'FOUR')), - 'value4', - "Case insensitivity in parameters", +is( + scalar( $ini->val( 'test2', 'FOUR' ) ), + 'value4', "Case insensitivity in parameters", ); # test 9 # Case insensitivity in sections # TEST -is ( scalar($ini->val('TEST2', 'four')), - 'value4', - "Case insensitivity in sections", +is( + scalar( $ini->val( 'TEST2', 'four' ) ), + 'value4', "Case insensitivity in sections", ); - # TEST -is ( - scalar($ini->val('mixedcasesect', 'mixedcaseparam')), - 'MixedCaseVal', - "Mixed case val.", +is( + scalar( $ini->val( 'mixedcasesect', 'mixedcaseparam' ) ), + 'MixedCaseVal', "Mixed case val.", ); diff -Nru libconfig-inifiles-perl-2.94/t/10delta.t libconfig-inifiles-perl-3.000001/t/10delta.t --- libconfig-inifiles-perl-2.94/t/10delta.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/10delta.t 2019-01-16 09:53:16.000000000 +0000 @@ -13,7 +13,7 @@ use Config::IniFiles::Slurp qw( slurp ); my $ors = $\ || "\n"; -my ($ini,$value); +my ( $ini, $value ); # # Delta tests added by D/DO/DOMQ @@ -24,7 +24,7 @@ my $en = Config::IniFiles->new( -file => t_file('en.ini') ); # TEST -ok ( $en, "En was instantiated." ); +ok( $en, "En was instantiated." ); # test 2 my $es = Config::IniFiles->new( -file => t_file('es.ini'), -import => $en ); @@ -32,37 +32,37 @@ # TEST ok( $es, "Es was instantiated." ); -my $estext=slurp(t_file("es.ini")); +my $estext = slurp( t_file("es.ini") ); $estext =~ s/\s*//g; # test 3 ## Delta without any update should result in exact same file (ignoring ## distinctions about leading whitespace) t_unlink('delta.ini'); -$es->WriteConfig(t_file('delta.ini'), -delta=>1); +$es->WriteConfig( t_file('delta.ini'), -delta => 1 ); -my $deltatext=slurp(t_file('delta.ini')); +my $deltatext = slurp( t_file('delta.ini') ); $deltatext =~ s/\s*//g; # TEST -is ($deltatext, $estext, - "Delta without any update should result in exact same file " -); +is( $deltatext, $estext, + "Delta without any update should result in exact same file " ); t_unlink('delta.ini'); # test 4 ## Delta with updates -$es->newval("something", "completely", "different"); -$es->WriteConfig(t_file('delta.ini'), -delta=>1); -$deltatext=slurp(t_file('delta.ini')); +$es->newval( "something", "completely", "different" ); +$es->WriteConfig( t_file('delta.ini'), -delta => 1 ); +$deltatext = slurp( t_file('delta.ini') ); # TEST -if (!ok( - scalar($deltatext =~ m/^[something].*completely=different/sm), - "Delta with updates", +if ( + !ok( + scalar( $deltatext =~ m/^[something].*completely=different/sm ), + "Delta with updates", + ) ) -) { diag($deltatext); } @@ -71,17 +71,19 @@ # test 5 ## Delta with deletion marks -$es->delval("x", "LongName"); +$es->delval( "x", "LongName" ); $es->DeleteSection("m"); -$es->WriteConfig(t_file('delta.ini'), -delta=>1); -$deltatext=slurp(t_file('delta.ini')); +$es->WriteConfig( t_file('delta.ini'), -delta => 1 ); +$deltatext = slurp( t_file('delta.ini') ); # TEST -if (!ok(($deltatext =~ m/^. \[m\] is deleted/m) && - ($deltatext =~ m/^. LongName is deleted/m), - "Delta with deletion marks", - ), - ) +if ( + !ok( + ( $deltatext =~ m/^. \[m\] is deleted/m ) + && ( $deltatext =~ m/^. LongName is deleted/m ), + "Delta with deletion marks", + ), + ) { diag($deltatext); } @@ -89,9 +91,9 @@ # test 6 ## Parsing back deletion marks -$es=Config::IniFiles->new( -file => t_file('delta.ini'), -import => $en ); +$es = Config::IniFiles->new( -file => t_file('delta.ini'), -import => $en ); + # TEST -ok((!defined $es->val("x", "LongName")) && - (! $es->SectionExists("m")), - "Parsing back deletion marks"); +ok( ( !defined $es->val( "x", "LongName" ) ) && ( !$es->SectionExists("m") ), + "Parsing back deletion marks" ); t_unlink("delta.ini"); diff -Nru libconfig-inifiles-perl-2.94/t/11copy-ties-with-array-vals.t libconfig-inifiles-perl-3.000001/t/11copy-ties-with-array-vals.t --- libconfig-inifiles-perl-2.94/t/11copy-ties-with-array-vals.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/11copy-ties-with-array-vals.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,15 +11,14 @@ { tie my %ini, 'Config::IniFiles', - (-file => File::Spec->catfile('t', 'array.ini')) - ; + ( -file => File::Spec->catfile( 't', 'array.ini' ) ); my %new_sect; - %new_sect = %{$ini{Sect}}; + %new_sect = %{ $ini{Sect} }; $new_sect{Par}[1] = 'A'; # TEST - is_deeply ($ini{Sect}{Par}, [1,2,3], '%ini was not modified'); + is_deeply( $ini{Sect}{Par}, [ 1, 2, 3 ], '%ini was not modified' ); } diff -Nru libconfig-inifiles-perl-2.94/t/12open-empty-file.t libconfig-inifiles-perl-3.000001/t/12open-empty-file.t --- libconfig-inifiles-perl-2.94/t/12open-empty-file.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/12open-empty-file.t 2019-01-16 09:53:16.000000000 +0000 @@ -15,15 +15,15 @@ my $filename = t_file("empty.ini"); { - my $cfg=Config::IniFiles->new; + my $cfg = Config::IniFiles->new; $cfg->WriteConfig($filename); } { - my $cfg=Config::IniFiles->new(-file => $filename, -allowempty => 1); + my $cfg = Config::IniFiles->new( -file => $filename, -allowempty => 1 ); # TEST - isa_ok ($cfg, "Config::IniFiles", '$cfg'); + isa_ok( $cfg, "Config::IniFiles", '$cfg' ); } t_unlink("empty.ini"); diff -Nru libconfig-inifiles-perl-2.94/t/13val-in-list-context.t libconfig-inifiles-perl-3.000001/t/13val-in-list-context.t --- libconfig-inifiles-perl-2.94/t/13val-in-list-context.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/13val-in-list-context.t 2019-01-16 09:53:16.000000000 +0000 @@ -14,12 +14,10 @@ { my $ini = Config::IniFiles->new( - -file => File::Spec->catfile('t', 'array.ini') - ); - + -file => File::Spec->catfile( 't', 'array.ini' ) ); my $verdict; - if (my @v = $ini->val("Sect", "NotExist")) + if ( my @v = $ini->val( "Sect", "NotExist" ) ) { $verdict = 1; } @@ -29,6 +27,6 @@ } # TEST - ok(!$verdict, "False should be returned in list context."); + ok( !$verdict, "False should be returned in list context." ); } diff -Nru libconfig-inifiles-perl-2.94/t/14brackets-within-values.t libconfig-inifiles-perl-3.000001/t/14brackets-within-values.t --- libconfig-inifiles-perl-2.94/t/14brackets-within-values.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/14brackets-within-values.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,13 +11,15 @@ use Config::IniFiles; -my $filename = File::Spec->catfile(File::Spec->curdir(), "t", "brackets-in-values.ini"); +my $filename = + File::Spec->catfile( File::Spec->curdir(), "t", "brackets-in-values.ini" ); { - my $cfg=Config::IniFiles->new(-file => $filename, -allowempty => 1); + my $cfg = Config::IniFiles->new( -file => $filename, -allowempty => 1 ); # TEST - is ($cfg->val('SiteName', 'file'), + is( + $cfg->val( 'SiteName', 'file' ), "http://www.example.com/files/file[1-22].gz", "Reading value containing brackets well" ); diff -Nru libconfig-inifiles-perl-2.94/t/15store-and-retrieve-here-doc-terminator.t libconfig-inifiles-perl-3.000001/t/15store-and-retrieve-here-doc-terminator.t --- libconfig-inifiles-perl-2.94/t/15store-and-retrieve-here-doc-terminator.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/15store-and-retrieve-here-doc-terminator.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,12 +11,10 @@ use Config::IniFiles; -my $filename = File::Spec->catfile( - File::Spec->curdir(), "t", "store-and-retrieve-here-doc-terminator.ini" -); +my $filename = File::Spec->catfile( File::Spec->curdir(), "t", + "store-and-retrieve-here-doc-terminator.ini" ); -my @file_write_subs = -( +my @file_write_subs = ( sub { my ($cfg) = @_; @@ -41,23 +39,24 @@ { # Delete the stray file - we want to over-write it. unlink($filename); - my $cfg=Config::IniFiles->new(); + my $cfg = Config::IniFiles->new(); - $cfg->newval ("MySection", "MyParam", "Hello\nEOT\n"); + $cfg->newval( "MySection", "MyParam", "Hello\nEOT\n" ); $write_sub->($cfg); } { - my $cfg=Config::IniFiles->new(-file => $filename); + my $cfg = Config::IniFiles->new( -file => $filename ); # TEST*2 - is (scalar($cfg->val ("MySection", "MyParam")), + is( + scalar( $cfg->val( "MySection", "MyParam" ) ), "Hello\nEOT\n", "Default here-doc terminator was stored and retrieved correctly", ); } -# Delete it again to keep the working-copy clean. + # Delete it again to keep the working-copy clean. unlink($filename); } diff -Nru libconfig-inifiles-perl-2.94/t/16case-sensitive-default.t libconfig-inifiles-perl-3.000001/t/16case-sensitive-default.t --- libconfig-inifiles-perl-2.94/t/16case-sensitive-default.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/16case-sensitive-default.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,17 +11,20 @@ use Config::IniFiles; -my $filename = File::Spec->catfile( - File::Spec->curdir(), "t", "case-sensitive-default.ini", -); +my $filename = File::Spec->catfile( File::Spec->curdir(), "t", + "case-sensitive-default.ini", ); { - my $cfg=Config::IniFiles->new(-file => $filename, -default => "Common", -nocase => 1,); + my $cfg = Config::IniFiles->new( + -file => $filename, + -default => "Common", + -nocase => 1, + ); # TEST - is ($cfg->val("MyScript", "stopfile", "not defined"), - "myscript-stop", - "Default section handled in nocase => 1", + is( + $cfg->val( "MyScript", "stopfile", "not defined" ), + "myscript-stop", "Default section handled in nocase => 1", ); } diff -Nru libconfig-inifiles-perl-2.94/t/17untainted-multiline-values.t libconfig-inifiles-perl-3.000001/t/17untainted-multiline-values.t --- libconfig-inifiles-perl-2.94/t/17untainted-multiline-values.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/17untainted-multiline-values.t 2019-01-16 09:53:16.000000000 +0000 @@ -12,19 +12,21 @@ use Config::IniFiles; -my $filename = File::Spec->catfile( - File::Spec->curdir(), "t", "array.ini", -); +my $filename = File::Spec->catfile( File::Spec->curdir(), "t", "array.ini", ); { - my $cfg=Config::IniFiles->new(-file => $filename, -default => "Common", -nocase => 1,); + my $cfg = Config::IniFiles->new( + -file => $filename, + -default => "Common", + -nocase => 1, + ); - my @val = $cfg->val("Sect", "Par"); + my @val = $cfg->val( "Sect", "Par" ); # TEST - ok (!tainted($val[0]), "val[0] is not tainted"); + ok( !tainted( $val[0] ), "val[0] is not tainted" ); # TEST - ok (!tainted($val[1]), "val[1] is not tainted"); + ok( !tainted( $val[1] ), "val[1] is not tainted" ); } diff -Nru libconfig-inifiles-perl-2.94/t/18non-contiguous-groups.t libconfig-inifiles-perl-3.000001/t/18non-contiguous-groups.t --- libconfig-inifiles-perl-2.94/t/18non-contiguous-groups.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/18non-contiguous-groups.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,19 +11,15 @@ use Config::IniFiles; -my $filename = File::Spec->catfile( - File::Spec->curdir(), "t", "non-contiguous-groups.ini", -); +my $filename = File::Spec->catfile( File::Spec->curdir(), "t", + "non-contiguous-groups.ini", ); { - my $cfg=Config::IniFiles->new(-file => $filename); + my $cfg = Config::IniFiles->new( -file => $filename ); my @members = $cfg->GroupMembers("A"); # TEST - is_deeply( - \@members, - ["A 1", "A 2", "A 3"], - ); + is_deeply( \@members, [ "A 1", "A 2", "A 3" ], ); } diff -Nru libconfig-inifiles-perl-2.94/t/19param-found-outside-section.t libconfig-inifiles-perl-3.000001/t/19param-found-outside-section.t --- libconfig-inifiles-perl-2.94/t/19param-found-outside-section.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/19param-found-outside-section.t 2019-01-16 09:53:16.000000000 +0000 @@ -4,76 +4,72 @@ # https://rt.cpan.org/Ticket/Display.html?id=36584 # Written by Shlomi Fish. -# This file is licensed under the MIT/X11 License. +# This file is licensed under the MIT/Expat License. use strict; use warnings; use Test::More tests => 7; +use lib "./t/lib"; use Config::IniFiles; use File::Spec; +use Config::IniFiles::Slurp qw( slurp ); use File::Temp qw(tempdir); { - my $dir_name = tempdir(CLEANUP => 1); - my $filename = File::Spec->catfile($dir_name, "foo.ini"); - my $data = join "", ; + my $dir_name = tempdir( CLEANUP => 1 ); + my $filename = File::Spec->catfile( $dir_name, "foo.ini" ); { open my $fh, '>', $filename; - print {$fh} $data; - close ($fh); + print {$fh} <<'EOF'; + +; This is a malformed ini file with a key/value outside a section + +wrong = wronger + +[section] + +right = more right + +EOF + close($fh); } - my $ini = Config::IniFiles->new(-file => $filename); + my $ini = Config::IniFiles->new( -file => $filename ); # TEST - ok(!defined($ini), "Ini was not initialised"); + ok( !defined($ini), "Ini was not initialised" ); # TEST - is (scalar(@Config::IniFiles::errors), 1, - "There is one error." - ); + is( scalar(@Config::IniFiles::errors), 1, "There is one error." ); # TEST - like ($Config::IniFiles::errors[0], + like( + $Config::IniFiles::errors[0], qr/parameter found outside a section/, "Error was correct - 'parameter found outside a section'", ); - $ini = Config::IniFiles->new(-file => $filename, -fallback => 'GENERAL'); + $ini = Config::IniFiles->new( -file => $filename, -fallback => 'GENERAL' ); # TEST - ok(defined($ini), "(-fallback) Ini was initialised"); + ok( defined($ini), "(-fallback) Ini was initialised" ); # TEST - ok($ini->SectionExists('GENERAL'), "(-fallback) Fallback section exists"); + ok( $ini->SectionExists('GENERAL'), "(-fallback) Fallback section exists" ); # TEST - ok($ini->exists('GENERAL', 'wrong'), - "(-fallback) Fallback section catches parameter"); + ok( $ini->exists( 'GENERAL', 'wrong' ), + "(-fallback) Fallback section catches parameter" ); # TEST - my $newfilename = File::Spec->catfile($dir_name, "new.ini"); - my $content; + my $newfilename = File::Spec->catfile( $dir_name, "new.ini" ); $ini->WriteConfig($newfilename); - { - local $/; - open my $fh, '<', $newfilename; - $content = <$fh>; - } - ok($content =~ /^wrong/m && $content !~ /^\[GENERAL\]/m, - "(-fallback) Outputting fallback section without section header"); + my $content = slurp($newfilename); + ok( + $content =~ /^wrong/m && $content !~ /^\[GENERAL\]/m, + "(-fallback) Outputting fallback section without section header" + ); } - -__DATA__ - -; This is a malformed ini file with a key/value outside a scrtion - -wrong = wronger - -[section] - -right = more right - diff -Nru libconfig-inifiles-perl-2.94/t/20allowedcommentchars.t libconfig-inifiles-perl-3.000001/t/20allowedcommentchars.t --- libconfig-inifiles-perl-2.94/t/20allowedcommentchars.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/20allowedcommentchars.t 2019-01-16 09:53:16.000000000 +0000 @@ -11,21 +11,16 @@ use Config::IniFiles; -my $filename = File::Spec->catfile( - File::Spec->curdir(), "t", "allowed-comment-chars.ini", -); +my $filename = File::Spec->catfile( File::Spec->curdir(), "t", + "allowed-comment-chars.ini", ); { - my $cfg = - Config::IniFiles->new( - -file => $filename, - -allowedcommentchars => '};', - ); + my $cfg = Config::IniFiles->new( + -file => $filename, + -allowedcommentchars => '};', + ); # TEST - is ($cfg->val("cat1", "mykey"), - "500", - "Proper comments are ignored.", - ); + is( $cfg->val( "cat1", "mykey" ), "500", "Proper comments are ignored.", ); } diff -Nru libconfig-inifiles-perl-2.94/t/22trailing-comment-lines.t libconfig-inifiles-perl-3.000001/t/22trailing-comment-lines.t --- libconfig-inifiles-perl-2.94/t/22trailing-comment-lines.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/22trailing-comment-lines.t 2019-01-16 09:53:16.000000000 +0000 @@ -10,32 +10,26 @@ use strict; use warnings; +use lib "./t/lib"; use File::Spec; - use Config::IniFiles; +use Config::IniFiles::Slurp qw( slurp ); { my $conf = Config::IniFiles->new( - -file => File::Spec->catfile(File::Spec->curdir(), 't', 'trailing-comments.ini') + -file => File::Spec->catfile( + File::Spec->curdir(), 't', 'trailing-comments.ini' + ) ); - my $new_file = File::Spec->catfile( - File::Spec->curdir(), 't', 'new-trail.ini' - ); + my $new_file = + File::Spec->catfile( File::Spec->curdir(), 't', 'new-trail.ini' ); $conf->WriteConfig($new_file); - my $buffer; - { - local $/; - open my $fh, "<", $new_file; - $buffer = <$fh>; - close($fh); - } - # TEST like( - $buffer, + scalar( slurp($new_file) ), qr{; End Comment 1\n; End Comment 2\n+\z}ms, "WriteConfig() Preserved end comments." ); diff -Nru libconfig-inifiles-perl-2.94/t/23scalar-ref.t libconfig-inifiles-perl-3.000001/t/23scalar-ref.t --- libconfig-inifiles-perl-2.94/t/23scalar-ref.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/23scalar-ref.t 2019-01-16 09:53:16.000000000 +0000 @@ -13,7 +13,7 @@ use Config::IniFiles; -if ( ! eval { require IO::Scalar; } ) +if ( !eval { require IO::Scalar; } ) { plan skip_all => "IO::Scalar is not available"; } @@ -28,15 +28,12 @@ key = val EOF - my $conf = Config::IniFiles->new( -file => \$contents); + my $conf = Config::IniFiles->new( -file => \$contents ); # TEST - ok ($conf, "Object was initialised from reference to scalar."); + ok( $conf, "Object was initialised from reference to scalar." ); # TEST - is ($conf->val("section1", "key"), - "val", - "Object works." - ); + is( $conf->val( "section1", "key" ), "val", "Object works." ); } diff -Nru libconfig-inifiles-perl-2.94/t/24case-sensitive-exists.t libconfig-inifiles-perl-3.000001/t/24case-sensitive-exists.t --- libconfig-inifiles-perl-2.94/t/24case-sensitive-exists.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/24case-sensitive-exists.t 2019-01-16 09:53:16.000000000 +0000 @@ -16,20 +16,20 @@ { my $conf = Config::IniFiles->new( - -file => File::Spec->catfile(File::Spec->curdir(), - 't', 'case-sensitive.ini' + -file => File::Spec->catfile( + File::Spec->curdir(), 't', 'case-sensitive.ini' ), -nocase => 1 ); # TEST - ok (scalar($conf->exists('FOO', 'BAR')), + ok( + scalar( $conf->exists( 'FOO', 'BAR' ) ), "->exists() Handles case well" ); # TEST - is (scalar($conf->val('FOO', 'BAR')), "goodness", - "->val() Handles case well" - ); + is( scalar( $conf->val( 'FOO', 'BAR' ) ), + "goodness", "->val() Handles case well" ); } diff -Nru libconfig-inifiles-perl-2.94/t/25line-endings.t libconfig-inifiles-perl-3.000001/t/25line-endings.t --- libconfig-inifiles-perl-2.94/t/25line-endings.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/25line-endings.t 2019-01-16 09:53:16.000000000 +0000 @@ -15,15 +15,12 @@ use File::Spec; my $ini_filename = - File::Spec->catfile( - File::Spec->curdir(), "t", 'test25.ini' - ); + File::Spec->catfile( File::Spec->curdir(), "t", 'test25.ini' ); { - # being pedantic, we don't take line breaks from this or an external file for granted - my $sample_ini = - " +# being pedantic, we don't take line breaks from this or an external file for granted + my $sample_ini = " # this is a sample file for testing the proper detection of line endings in Config::IniFiles [single values] @@ -39,42 +36,40 @@ "; - foreach my $lf (("\x0d\x0a", "\x0d", "\x0a", "\x15", "\n")) { + foreach my $lf ( ( "\x0d\x0a", "\x0d", "\x0a", "\x15", "\n" ) ) + { my $ini = $sample_ini; $ini =~ s/[^<]*/$lf/g; open my $INI, '>', $ini_filename or die $!; binmode $INI; - print $INI $ini; + print {$INI} $ini; close $INI; - my $lf_print = join('', map {sprintf '\x%0.2x', ord $_} split(//, $lf)); + my $lf_print = + join( '', map { sprintf '\x%0.2x', ord $_ } split( //, $lf ) ); - my $cfg = Config::IniFiles->new(-file => $ini_filename); + my $cfg = Config::IniFiles->new( -file => $ini_filename ); # TEST - ok($cfg, "Loading from a '$lf_print'-separated file"); + ok( $cfg, "Loading from a '$lf_print'-separated file" ); # TEST - my $value = $cfg->val('single values', 'firstval'); - is ( - $value, 'first value', - "Reading a single value from a '$lf_print'-separated file" - ); + my $value = $cfg->val( 'single values', 'firstval' ); + is( $value, 'first value', + "Reading a single value from a '$lf_print'-separated file" ); # TEST - $value = $cfg->val('single values', 'secondval'); - is ( - $value, '2nd', - "Reading a single value from a '$lf_print'-separated file" - ); + $value = $cfg->val( 'single values', 'secondval' ); + is( $value, '2nd', + "Reading a single value from a '$lf_print'-separated file" ); - my @vals = $cfg->val("multi value", "Paths"); + my @vals = $cfg->val( "multi value", "Paths" ); # TEST is_deeply( \@vals, - ['path1', 'path2'], + [ 'path1', 'path2' ], "Reading a multiple value from a '$lf_print'-separated file", ); @@ -82,4 +77,4 @@ } -unlink ($ini_filename); +unlink($ini_filename); diff -Nru libconfig-inifiles-perl-2.94/t/26scalar-filehandle.t libconfig-inifiles-perl-3.000001/t/26scalar-filehandle.t --- libconfig-inifiles-perl-2.94/t/26scalar-filehandle.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/26scalar-filehandle.t 2019-01-16 09:53:16.000000000 +0000 @@ -18,9 +18,10 @@ use Config::IniFiles; -if ( ! eval { require 5.008; } ) +if ( !eval { require 5.008; } ) { - plan skip_all => "We need filehandles made from scalar which is a feature of Perl above 5.8.x"; + plan skip_all => +"We need filehandles made from scalar which is a feature of Perl above 5.8.x"; } else { @@ -38,17 +39,15 @@ my $conf = eval { $WARNING = 1; $SIG{__WARN__} = \&Carp::croak; - Config::IniFiles->new( -file => $scalar_fh); + Config::IniFiles->new( -file => $scalar_fh ); } or warn $EVAL_ERROR; # TEST - ok(!$EVAL_ERROR, "Object was initialised from filehandle made out of a scalar."); + ok( !$EVAL_ERROR, + "Object was initialised from filehandle made out of a scalar." ); # TEST - is ($conf->val("section1", "key"), - "val", - "Object works." - ); + is( $conf->val( "section1", "key" ), "val", "Object works." ); undef $conf; close $scalar_fh; diff -Nru libconfig-inifiles-perl-2.94/t/27empty-ini.t libconfig-inifiles-perl-3.000001/t/27empty-ini.t --- libconfig-inifiles-perl-2.94/t/27empty-ini.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/27empty-ini.t 2019-01-16 09:53:16.000000000 +0000 @@ -13,20 +13,17 @@ use Config::IniFiles; use File::Spec; -my $empty_fn = File::Spec->catfile(File::Spec->curdir(), "t", "for-27-empty.ini"); +my $empty_fn = + File::Spec->catfile( File::Spec->curdir(), "t", "for-27-empty.ini" ); { - my $cfg = Config::IniFiles->new( -file => $empty_fn, -allowempty => 1); + my $cfg = Config::IniFiles->new( -file => $empty_fn, -allowempty => 1 ); # TEST - ok ($cfg, "object was initialized."); + ok( $cfg, "object was initialized." ); my @Groups = $cfg->GroupMembers("test"); # TEST - is_deeply ( - \@Groups, - [], - "Groups is empty." - ); + is_deeply( \@Groups, [], "Groups is empty." ); } diff -Nru libconfig-inifiles-perl-2.94/t/28nomultiline.t libconfig-inifiles-perl-3.000001/t/28nomultiline.t --- libconfig-inifiles-perl-2.94/t/28nomultiline.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/28nomultiline.t 2019-01-16 09:53:16.000000000 +0000 @@ -7,37 +7,31 @@ use Config::IniFiles; use File::Spec; - use File::Temp qw(tempdir); +use lib "./t/lib"; +use Config::IniFiles::Slurp qw( slurp ); { - my $dir_name = tempdir(CLEANUP => 1); - my $filename = File::Spec->catfile($dir_name, "foo.ini"); - my $data = join "", ; + my $dir_name = tempdir( CLEANUP => 1 ); + my $filename = File::Spec->catfile( $dir_name, "foo.ini" ); { open my $out, '>', $filename; - print {$out} $data; - close( $out ); + print {$out} <<'EOF'; +[section] +a = 1 +a = 2 + +EOF + close($out); } - my $ini = Config::IniFiles->new(-file => $filename, -nomultiline => 1); + my $ini = Config::IniFiles->new( -file => $filename, -nomultiline => 1 ); # TEST - ok(defined($ini), "Ini was initialised"); + ok( defined($ini), "Ini was initialised" ); $ini->RewriteConfig; - my $content; - { - open my $fh, '<', $filename; - local $/; - $content = <$fh>; - } - ok($content !~ /EOT/ && $content =~ /^a=1/m && $content =~ /^a=2/m, - "No multiline is output"); + my $content = slurp($filename); + ok( $content !~ /EOT/ && $content =~ /^a=1/m && $content =~ /^a=2/m, + "No multiline is output" ); } - -__DATA__ -[section] -a = 1 -a = 2 - diff -Nru libconfig-inifiles-perl-2.94/t/29end-of-line-comment.t libconfig-inifiles-perl-3.000001/t/29end-of-line-comment.t --- libconfig-inifiles-perl-2.94/t/29end-of-line-comment.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/29end-of-line-comment.t 2019-01-16 09:53:16.000000000 +0000 @@ -13,64 +13,84 @@ use File::Temp qw(tempdir); -my $writefile = "end-trailing-comment-writeback.ini"; - # Test of handle_trailing_comment enabled { - my $ini = Config::IniFiles->new( -file => t_file( - "end-of-line-comment.ini"), -handle_trailing_comment => 1); + my $ini = Config::IniFiles->new( + -file => t_file("end-of-line-comment.ini"), + -handle_trailing_comment => 1 + ); # TEST - is($ini->val("section1", "param1"), "value1", - "Comments after ';' should be omitted when tailing comment enabled"); + is( $ini->val( "section1", "param1" ), + "value1", + "Comments after ';' should be omitted when tailing comment enabled" ); # TEST - is($ini->GetParameterTrailingComment("section1", "param1"), - "comment1", "Test GetParameterTrailingComment()"); + is( $ini->GetParameterTrailingComment( "section1", "param1" ), + "comment1", "Test GetParameterTrailingComment()" ); # Test write back - my $dirname = tempdir(CLEANUP => 1); - my $filename = File::Spec->catfile($dirname, $writefile); + my $dirname = tempdir( CLEANUP => 1 ); + my $filename = + File::Spec->catfile( $dirname, "end-trailing-comment-writeback.ini" ); + # TEST - ok($ini->WriteConfig($filename), "Write trailing comments back"); + ok( $ini->WriteConfig($filename), "Write trailing comments back" ); open my $fh, '<', $filename; my $works = 0; - while (my $line = <$fh>) { - $works = 1 if ($line =~ /param1\s*=\s*value1\s*[;#]\s*comment1/); + while ( my $line = <$fh> ) + { + $works = 1 if ( $line =~ /param1\s*=\s*value1\s*[;#]\s*comment1/ ); } close $fh; + # TEST - ok($works, "Test trailing comment rewrite ok."); + ok( $works, "Test trailing comment rewrite ok." ); # Test set() # TEST - ok($ini->SetParameterTrailingComment("section1", "param1", - "changed comment1"), "Test SetParameterTrailingComment() returns."); + ok( + $ini->SetParameterTrailingComment( + "section1", "param1", "changed comment1" + ), + "Test SetParameterTrailingComment() returns." + ); + # TEST - is($ini->GetParameterTrailingComment("section1", "param1"), - "changed comment1", "Test whether SetParameterTrailingComments() works."); + is( + $ini->GetParameterTrailingComment( "section1", "param1" ), + "changed comment1", + "Test whether SetParameterTrailingComments() works." + ); } # Test of handle_trailing_comment disabled { - my $ini = Config::IniFiles->new( -file => t_file( - "end-of-line-comment.ini"), -handle_trailing_comment => 0); + my $ini = Config::IniFiles->new( + -file => t_file("end-of-line-comment.ini"), + -handle_trailing_comment => 0 + ); + # TEST - is($ini->val("section1", "param1"), "value1;comment1", - "Comments after ';' should be kept when tailing comment disabled"); + is( $ini->val( "section1", "param1" ), + "value1;comment1", + "Comments after ';' should be kept when tailing comment disabled" ); + # TEST - is($ini->GetParameterTrailingComment("section1", "param1"), - "", "Test whether SetParameterTrailingComments() works."); + is( $ini->GetParameterTrailingComment( "section1", "param1" ), + "", "Test whether SetParameterTrailingComments() works." ); } # Test of default handle_trailing_comment { # The default handle_trailing_comment param should be off - my $ini = Config::IniFiles->new( -file => - t_file("end-of-line-comment.ini") ); + my $ini = + Config::IniFiles->new( -file => t_file("end-of-line-comment.ini") ); + # TEST - is($ini->val("section1", "param1"), "value1;comment1", - "Test default trailing comment, which should be off."); + is( $ini->val( "section1", "param1" ), + "value1;comment1", + "Test default trailing comment, which should be off." ); } diff -Nru libconfig-inifiles-perl-2.94/t/30parameters-with-empty-values.t libconfig-inifiles-perl-3.000001/t/30parameters-with-empty-values.t --- libconfig-inifiles-perl-2.94/t/30parameters-with-empty-values.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/30parameters-with-empty-values.t 2019-01-16 09:53:16.000000000 +0000 @@ -25,7 +25,7 @@ my $ini = Config::IniFiles->new(); - $ini->newval('MySection', 'MyParam', ''); + $ini->newval( 'MySection', 'MyParam', '' ); $ini->WriteConfig($filename); @@ -34,14 +34,14 @@ unlink($filename); # TEST - like ($contents, qr{^MyParam=$}ms, 'Empty parameter was written.'); + like( $contents, qr{^MyParam=$}ms, 'Empty parameter was written.' ); } =head1 COPYRIGHT & LICENSE Copyright 2011 by Shlomi Fish -This program is distributed under the MIT (X11) License: +This program is distributed under the MIT (Expat) License: L Permission is hereby granted, free of charge, to any person diff -Nru libconfig-inifiles-perl-2.94/t/31comments_with_spaces.t libconfig-inifiles-perl-3.000001/t/31comments_with_spaces.t --- libconfig-inifiles-perl-2.94/t/31comments_with_spaces.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/31comments_with_spaces.t 2019-01-16 09:53:16.000000000 +0000 @@ -12,35 +12,36 @@ use Config::IniFiles; my $ini_filename = - File::Spec->catfile( - File::Spec->curdir(), "t", 'test31.ini' - ); + File::Spec->catfile( File::Spec->curdir(), "t", 'test31.ini' ); -my $content = <<'EOT'; +{ + open my $ini_fh, '>', $ini_filename + or die "Cannot open '$ini_filename' - $!"; + print {$ini_fh} <<'EOT'; [section] value1 = xxx ; My Comment value2 = xxx ; My_Comment EOT - -{ - open my $ini_fh, '>', $ini_filename - or die "Cannot open '$ini_filename' - $!"; - print {$ini_fh} $content; - close ($ini_fh); + close($ini_fh); } -my $ini = Config::IniFiles->new( -file => $ini_filename, --handle_trailing_comment => 1, --commentchar => ';', --allowedcommentchars => ';#'); +my $ini = Config::IniFiles->new( + -file => $ini_filename, + -handle_trailing_comment => 1, + -commentchar => ';', + -allowedcommentchars => ';#' +); # TEST -is( $ini->val('section','value1'), 'xxx' ); +is( $ini->val( 'section', 'value1' ), 'xxx' ); + # TEST -is( $ini->GetParameterTrailingComment('section','value1'), 'My Comment'); +is( $ini->GetParameterTrailingComment( 'section', 'value1' ), 'My Comment' ); + # TEST -is( $ini->val('section','value2'), 'xxx' ); +is( $ini->val( 'section', 'value2' ), 'xxx' ); + # TEST -is( $ini->GetParameterTrailingComment('section','value2'), 'My_Comment'); +is( $ini->GetParameterTrailingComment( 'section', 'value2' ), 'My_Comment' ); -unlink( $ini_filename ); +unlink($ini_filename); diff -Nru libconfig-inifiles-perl-2.94/t/32mswin-outputs-contain-crs.t libconfig-inifiles-perl-3.000001/t/32mswin-outputs-contain-crs.t --- libconfig-inifiles-perl-2.94/t/32mswin-outputs-contain-crs.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/32mswin-outputs-contain-crs.t 2019-01-16 09:53:16.000000000 +0000 @@ -14,7 +14,7 @@ use Test::More; -if ($^O !~ m/\AMSWin/) +if ( $^O !~ m/\AMSWin/ ) { plan skip_all => 'Test is only relevant for Microsoft Windows'; } @@ -26,57 +26,59 @@ use Config::IniFiles; use File::Spec; -my $config_filename = File::Spec->catdir(File::Spec->curdir(), "t", "testConfig.ini"); +my $config_filename = + File::Spec->catdir( File::Spec->curdir(), "t", "testConfig.ini" ); -writeNewUserIni ($config_filename); +writeNewUserIni($config_filename); -for my $s (1 .. 4) +for my $s ( 1 .. 4 ) { print "s = $s\n"; - for my $p (1 ..4) + for my $p ( 1 .. 4 ) { print "p = $p\n"; - writeIni($config_filename, "Section$s", "Param$p", "Value$p"); + writeIni( $config_filename, "Section$s", "Param$p", "Value$p" ); } } - # TEST unlike( - scalar(bin_slurp($config_filename)), - qr/[^\x0D]\x0A/, # \x0D is CR ; \x0A is LF. See "man ascii". + scalar( bin_slurp($config_filename) ), + qr/[^\x0D]\x0A/, # \x0D is CR ; \x0A is LF. See "man ascii". "Checking that all line feeds are preceded by carriage returns", ); sub writeNewUserIni { - my ($config_fn) = @_; + my ($config_fn) = @_; - open my $fh, '>', $config_fn + open my $fh, '>', $config_fn or die "Cannot open $config_fn for writing. - $!"; - print {$fh} "[UserConfigFile]\n"; - close ($fh); + print {$fh} "[UserConfigFile]\n"; + close($fh); return; } sub writeIni { - my ($userConfig_fn, $section, $param, $value) = @_; - - my $usrCfg = Config::IniFiles->new( -file => $userConfig_fn ) - or die "Failed! Could not open $userConfig_fn with error @Config::IniFiles::errors\n" ; + my ( $userConfig_fn, $section, $param, $value ) = @_; - $usrCfg->newval($section, $param, $value) - or die "Could not set newval in writeIni for $section, $param -> $value\n"; + my $usrCfg = Config::IniFiles->new( -file => $userConfig_fn ) + or die +"Failed! Could not open $userConfig_fn with error @Config::IniFiles::errors\n"; + + $usrCfg->newval( $section, $param, $value ) + or die + "Could not set newval in writeIni for $section, $param -> $value\n"; my $c = 0; - while ($c < 6) + while ( $c < 6 ) { if ( $usrCfg->RewriteConfig() ) { - $c=6; + $c = 6; print "Writing [$section] $param -> $value\n"; } else diff -Nru libconfig-inifiles-perl-2.94/t/33update-using-tied-fh-w-shorter-names.t libconfig-inifiles-perl-3.000001/t/33update-using-tied-fh-w-shorter-names.t --- libconfig-inifiles-perl-2.94/t/33update-using-tied-fh-w-shorter-names.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/33update-using-tied-fh-w-shorter-names.t 2019-01-16 09:53:16.000000000 +0000 @@ -20,8 +20,8 @@ use File::Temp qw(tempdir); -my $dirname = tempdir(CLEANUP => 1); -my $filename = File::Spec->catfile($dirname, 'toto.ini'); +my $dirname = tempdir( CLEANUP => 1 ); +my $filename = File::Spec->catfile( $dirname, 'toto.ini' ); { { @@ -38,24 +38,23 @@ { my %ini; - my $fh = IO::File->new( $filename , 'r+' ); + my $fh = IO::File->new( $filename, 'r+' ); die "Couldn't open file ${filename}: $!" if not defined $fh; tie %ini, 'Config::IniFiles', ( -file => $fh, -allowempty => 1 ); - - tied( %ini )->delval("toto", "tata"); - tied( %ini )->RewriteConfig; + tied(%ini)->delval( "toto", "tata" ); + tied(%ini)->RewriteConfig; $ini{toto}{tata} = 'short'; - tied( %ini )->RewriteConfig; + tied(%ini)->RewriteConfig; $fh->close; untie %ini; } # TEST - is ( - scalar (slurp($filename)), + is( + scalar( slurp($filename) ), <<'EOF', [toto] tata=short diff -Nru libconfig-inifiles-perl-2.94/t/34trailing-comments-double-delimeter.t libconfig-inifiles-perl-3.000001/t/34trailing-comments-double-delimeter.t --- libconfig-inifiles-perl-2.94/t/34trailing-comments-double-delimeter.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/34trailing-comments-double-delimeter.t 2019-01-16 09:53:16.000000000 +0000 @@ -19,15 +19,13 @@ EOF my $cfg = Config::IniFiles->new( - -file => \$ini_contents, + -file => \$ini_contents, -handle_trailing_comment => 1, ); # TEST - is (scalar( $cfg->val("MySect", "key") ), - "val", - "Value with a double trailing comment." - ); + is( scalar( $cfg->val( "MySect", "key" ) ), + "val", "Value with a double trailing comment." ); } __END__ diff -Nru libconfig-inifiles-perl-2.94/t/35reload-config-no-file.t libconfig-inifiles-perl-3.000001/t/35reload-config-no-file.t --- libconfig-inifiles-perl-2.94/t/35reload-config-no-file.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/35reload-config-no-file.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,79 @@ +use strict; +use warnings; +use Config::IniFiles; +use Test::More tests => 8; +use File::Temp 'tempfile'; + +my $config_nofile = Config::IniFiles->new( -allowempty => 1 ); +$config_nofile->newval( 'section', 'param', 1 ); + +my ( $fh, $filename ) = tempfile; + +## Import config, set filename, read config, then read again +my $config = + Config::IniFiles->new( -import => $config_nofile, -allowempty => 1 ); + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is imported' ); + +$config->SetFileName($filename); +$config->ReadConfig; + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is still imported' ); + +$config->ReadConfig; + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is still imported' ); + +## Import config that has already been imported +$config = Config::IniFiles->new( + -import => $config_nofile, + -allowempty => 1, + -file => $filename +); + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is imported again' ); + +$config_nofile = Config::IniFiles->new; +$config_nofile->newval( 'section', 'param', 1 ); + +## Import config and set filename in constructor, then read again +$config = Config::IniFiles->new( + -import => $config_nofile, + -allowempty => 1, + -file => $filename +); + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is imported' ); + +$config->ReadConfig; + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is still imported' ); + +## Import config that is written to file, but with parameters not written to file, then read again + +my ( $fh2, $filename2 ) = tempfile; +my $config_file = + Config::IniFiles->new( -allowempty => 1, -file => $filename2 ); +$config_file->newval( 'section', 'param2', 1 ); +$config_file->RewriteConfig; +$config_file->newval( 'section', 'param', 1 ); + +$config = Config::IniFiles->new( + -import => $config_file, + -allowempty => 1, + -file => $filename +); + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is imported' ); + +$config->ReadConfig; + +# TEST +ok( $config->val( 'section', 'param' ), 'Configuration is still imported' ); diff -Nru libconfig-inifiles-perl-2.94/t/35section-iterators.t libconfig-inifiles-perl-3.000001/t/35section-iterators.t --- libconfig-inifiles-perl-2.94/t/35section-iterators.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/35section-iterators.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +# See: https://bugs.debian.org/849298 + +use strict; +use warnings; + +use Test::More tests => 2; + +use Config::IniFiles; + +my $ini_contents = <<'EOF'; +[foo] +bar=baz +rab=zab +EOF + +tie( my %ini, 'Config::IniFiles', -file => \$ini_contents ); + +my ( $k1, $v1 ) = each %{ $ini{foo} }; +my ( $k2, $v2 ) = each %{ $ini{foo} }; + +# TEST +isnt( $k1, $k2, "got different keys with successive each() calls" ); + +# TEST +isnt( $v1, $v2, "got different values with successive each() calls" ); diff -Nru libconfig-inifiles-perl-2.94/t/36php-compat.t libconfig-inifiles-perl-3.000001/t/36php-compat.t --- libconfig-inifiles-perl-2.94/t/36php-compat.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/36php-compat.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 3; + +use Config::IniFiles; + +use lib "./t/lib"; + +use Config::IniFiles::TestPaths; + +my $ini = Config::IniFiles->new( + -file => t_file('php-compat.ini'), + -php_compat => 1 +) or die($!); + +# Test 1 +# strings enclosed with " are processed as double quoted string + +# TEST +is_deeply( + [ scalar( $ini->val( "group1", "val1" ) ) ], + [q{str"ing}], "value with double-quotes in php_compat", +); + +# Test 2 +# strings enclosed with ' are processed as single quoted string + +# TEST +is_deeply( + [ $ini->val( "group1", "val2" ) ], + [q{string}], "value with single-quotes in php_compat", +); + +# Test 3 +# ignore [] in val-Names + +# TEST +is_deeply( + [ $ini->val( "group2", "val1" ) ], + [ 1, 2 ], + "value with php array key in php_compat", +); diff -Nru libconfig-inifiles-perl-2.94/t/author-pod-coverage.t libconfig-inifiles-perl-3.000001/t/author-pod-coverage.t --- libconfig-inifiles-perl-2.94/t/author-pod-coverage.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/author-pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{AUTHOR_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for testing by the author'); - } -} - -# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. - -use Test::Pod::Coverage 1.08; -use Pod::Coverage::TrustPod; - -all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff -Nru libconfig-inifiles-perl-2.94/t/author-pod-syntax.t libconfig-inifiles-perl-3.000001/t/author-pod-syntax.t --- libconfig-inifiles-perl-2.94/t/author-pod-syntax.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/author-pod-syntax.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{AUTHOR_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for testing by the author'); - } -} - -# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. -use strict; use warnings; -use Test::More; -use Test::Pod 1.41; - -all_pod_files_ok(); diff -Nru libconfig-inifiles-perl-2.94/t/cmt.ini libconfig-inifiles-perl-3.000001/t/cmt.ini --- libconfig-inifiles-perl-2.94/t/cmt.ini 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/cmt.ini 2019-01-16 09:53:16.000000000 +0000 @@ -1,6 +1,6 @@ @vlmap rc file Version 1.0 @------------------------------------------------------------------------------ -@-- Id : @(#)debussy.rc /main/32 Tue Aug 31 09:17:35 1999 roehm +@-- Id : @(#)debussy.rc /main/32 Tue Aug 31 09:17:35 1999 roehm @-- Name : debussy.rc @-- Description : Control file for DEBUSSY @-- Version : /main/32 (roehm) diff -Nru libconfig-inifiles-perl-2.94/t/cpan-changes.t libconfig-inifiles-perl-3.000001/t/cpan-changes.t --- libconfig-inifiles-perl-2.94/t/cpan-changes.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/cpan-changes.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More; - -eval 'use Test::CPAN::Changes'; -plan skip_all => 'Test::CPAN::Changes required for this test' if $@; - -changes_ok(); - diff -Nru libconfig-inifiles-perl-2.94/t/lib/Config/IniFiles/Debug.pm libconfig-inifiles-perl-3.000001/t/lib/Config/IniFiles/Debug.pm --- libconfig-inifiles-perl-2.94/t/lib/Config/IniFiles/Debug.pm 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/lib/Config/IniFiles/Debug.pm 2019-01-16 09:53:16.000000000 +0000 @@ -13,37 +13,51 @@ # # This should be the case whenever control flows outside this module. Croaks # upon any error. -sub Config::IniFiles::_assert_invariants { - my ($self)=@_; - my %set; - foreach my $sect (@{$self->{sects}}) { - croak "Non-lowercase section $sect" if ($self->{nocase} && - (lc($sect) ne $sect)); - $set{$sect}++; - } - foreach my $sect (keys %{$self->{v}}) { - croak "Key $sect in \$self->{v} and not in \$self->{sects}" unless - ($set{$sect}++); - } - grep { croak "Key $_ in \$self->{sects} and not in in \$self->{v}" unless - $set{$_} eq 2 } (keys %set); +sub Config::IniFiles::_assert_invariants +{ + my ($self) = @_; + my %set; + foreach my $sect ( @{ $self->{sects} } ) + { + croak "Non-lowercase section $sect" + if ( $self->{nocase} + && ( lc($sect) ne $sect ) ); + $set{$sect}++; + } + foreach my $sect ( keys %{ $self->{v} } ) + { + croak "Key $sect in \$self->{v} and not in \$self->{sects}" + unless ( $set{$sect}++ ); + } + grep { + croak "Key $_ in \$self->{sects} and not in in \$self->{v}" + unless $set{$_} eq 2 + } ( keys %set ); - foreach my $sect (@{$self->{sects}}) { - %set=(); + foreach my $sect ( @{ $self->{sects} } ) + { + %set = (); - foreach my $parm (@{$self->{parms}{$sect}}) { - croak "Non-lowercase parameter $parm" if ($self->{nocase} && - (lc($parm) ne $parm)); - $set{$parm}++; - } - foreach my $parm (keys %{$self->{v}{$sect}}) { - croak "Key $parm in \$self->{v}{'$sect'} and not in \$self->{parms}{'$sect'}" - unless ($set{$parm}++); - } - grep { croak "Key $_ in \$self->{parms}{'$sect'} and not in in \$self->{v}{'$sect'}" - unless $set{$_} eq 2 } (keys %set); - } + foreach my $parm ( @{ $self->{parms}{$sect} } ) + { + croak "Non-lowercase parameter $parm" + if ( $self->{nocase} + && ( lc($parm) ne $parm ) ); + $set{$parm}++; + } + foreach my $parm ( keys %{ $self->{v}{$sect} } ) + { + croak +"Key $parm in \$self->{v}{'$sect'} and not in \$self->{parms}{'$sect'}" + unless ( $set{$parm}++ ); + } + grep + { + croak +"Key $_ in \$self->{parms}{'$sect'} and not in in \$self->{v}{'$sect'}" + unless $set{$_} eq 2 + } ( keys %set ); + } } 1; - diff -Nru libconfig-inifiles-perl-2.94/t/lib/Config/IniFiles/Slurp.pm libconfig-inifiles-perl-3.000001/t/lib/Config/IniFiles/Slurp.pm --- libconfig-inifiles-perl-2.94/t/lib/Config/IniFiles/Slurp.pm 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/lib/Config/IniFiles/Slurp.pm 2019-01-16 09:53:16.000000000 +0000 @@ -5,7 +5,7 @@ use File::Spec; -use base 'Exporter'; +use parent 'Exporter'; use vars (qw(@EXPORT_OK)); @@ -17,7 +17,6 @@ =cut - sub slurp { my $filename = shift; @@ -38,6 +37,7 @@ Reads the entire file with binmode =cut + sub bin_slurp { my $filename = shift; diff -Nru libconfig-inifiles-perl-2.94/t/php-compat.ini libconfig-inifiles-perl-3.000001/t/php-compat.ini --- libconfig-inifiles-perl-2.94/t/php-compat.ini 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/php-compat.ini 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,7 @@ +[group1] +val1="str\"in""g" +val2='strin''g' + +[group2] +val1[]=1 +val1[]=2 diff -Nru libconfig-inifiles-perl-2.94/t/php-compat.php libconfig-inifiles-perl-3.000001/t/php-compat.php --- libconfig-inifiles-perl-2.94/t/php-compat.php 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/php-compat.php 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,2 @@ + "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; -all_pod_coverage_ok(); diff -Nru libconfig-inifiles-perl-2.94/t/pod.t libconfig-inifiles-perl-3.000001/t/pod.t --- libconfig-inifiles-perl-2.94/t/pod.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/pod.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -#!perl -T - -use Test::More; -eval "use Test::Pod 1.14"; -plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; -all_pod_files_ok(); diff -Nru libconfig-inifiles-perl-2.94/t/release-cpan-changes.t libconfig-inifiles-perl-3.000001/t/release-cpan-changes.t --- libconfig-inifiles-perl-2.94/t/release-cpan-changes.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/release-cpan-changes.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -use strict; -use warnings; - -use Test::More 0.96 tests => 2; -use_ok('Test::CPAN::Changes'); -subtest 'changes_ok' => sub { - changes_file_ok('Changes'); -}; -done_testing(); diff -Nru libconfig-inifiles-perl-2.94/t/release-kwalitee.t libconfig-inifiles-perl-3.000001/t/release-kwalitee.t --- libconfig-inifiles-perl-2.94/t/release-kwalitee.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/release-kwalitee.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#!perl - -BEGIN { - unless ($ENV{RELEASE_TESTING}) { - require Test::More; - Test::More::plan(skip_all => 'these tests are for release candidate testing'); - } -} - - -# This test is generated by Dist::Zilla::Plugin::Test::Kwalitee::Extra -use strict; -use warnings; -use Test::More; # needed to provide plan. - -eval { require Test::Kwalitee::Extra }; -plan skip_all => "Test::Kwalitee::Extra required for testing kwalitee: $@" if $@; - -eval "use Test::Kwalitee::Extra"; diff -Nru libconfig-inifiles-perl-2.94/t/style-trailing-space.t libconfig-inifiles-perl-3.000001/t/style-trailing-space.t --- libconfig-inifiles-perl-2.94/t/style-trailing-space.t 2016-11-29 17:30:06.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/t/style-trailing-space.t 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More; - -eval "use Test::TrailingSpace"; -if ($@) -{ - plan skip_all => "Test::TrailingSpace required for trailing space test."; -} -else -{ - plan tests => 1; -} - -my $finder = Test::TrailingSpace->new( - { - root => '.', - filename_regex => qr/(?:(?:\.(?:t|pm|pl|PL|yml|json|arc|vim))|README|Changes|LICENSE)\z/, - }, -); - -# TEST -$finder->no_trailing_space( - "No trailing space was found." -); - diff -Nru libconfig-inifiles-perl-2.94/xt/author/no-tabs.t libconfig-inifiles-perl-3.000001/xt/author/no-tabs.t --- libconfig-inifiles-perl-2.94/xt/author/no-tabs.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/author/no-tabs.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,73 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15 + +use Test::More 0.88; +use Test::NoTabs; + +my @files = ( + 'lib/Config/IniFiles.pm', + 't/00-compile.t', + 't/00load.t', + 't/01basic.t', + 't/02weird.t', + 't/03comments.t', + 't/04import.t', + 't/05hash.t', + 't/06oo.t', + 't/07misc.t', + 't/08group.t', + 't/09case.t', + 't/10delta.t', + 't/11copy-ties-with-array-vals.t', + 't/12open-empty-file.t', + 't/13val-in-list-context.t', + 't/14brackets-within-values.t', + 't/15store-and-retrieve-here-doc-terminator.t', + 't/16case-sensitive-default.t', + 't/17untainted-multiline-values.t', + 't/18non-contiguous-groups.t', + 't/19param-found-outside-section.t', + 't/20allowedcommentchars.t', + 't/22trailing-comment-lines.t', + 't/23scalar-ref.t', + 't/24case-sensitive-exists.t', + 't/25line-endings.t', + 't/26scalar-filehandle.t', + 't/27empty-ini.t', + 't/28nomultiline.t', + 't/29end-of-line-comment.t', + 't/30parameters-with-empty-values.t', + 't/31comments_with_spaces.t', + 't/32mswin-outputs-contain-crs.t', + 't/33update-using-tied-fh-w-shorter-names.t', + 't/34trailing-comments-double-delimeter.t', + 't/35reload-config-no-file.t', + 't/35section-iterators.t', + 't/36php-compat.t', + 't/allowed-comment-chars.ini', + 't/array.ini', + 't/bad.ini', + 't/blank.ini', + 't/brackets-in-values.ini', + 't/ca.ini', + 't/case-sensitive-default.ini', + 't/case-sensitive.ini', + 't/cmt.ini', + 't/en.ini', + 't/end-of-line-comment.ini', + 't/es.ini', + 't/for-27-empty.ini', + 't/lib/Config/IniFiles/Debug.pm', + 't/lib/Config/IniFiles/Slurp.pm', + 't/lib/Config/IniFiles/TestPaths.pm', + 't/non-contiguous-groups.ini', + 't/php-compat.ini', + 't/php-compat.php', + 't/test.ini', + 't/trailing-comments.ini' +); + +notabs_ok($_) foreach @files; +done_testing; diff -Nru libconfig-inifiles-perl-2.94/xt/author/pod-coverage.t libconfig-inifiles-perl-3.000001/xt/author/pod-coverage.t --- libconfig-inifiles-perl-2.94/xt/author/pod-coverage.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/author/pod-coverage.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,7 @@ +#!perl +# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. + +use Test::Pod::Coverage 1.08; +use Pod::Coverage::TrustPod; + +all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); diff -Nru libconfig-inifiles-perl-2.94/xt/author/pod-syntax.t libconfig-inifiles-perl-3.000001/xt/author/pod-syntax.t --- libconfig-inifiles-perl-2.94/xt/author/pod-syntax.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/author/pod-syntax.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,7 @@ +#!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(); diff -Nru libconfig-inifiles-perl-2.94/xt/author/tidyall.t libconfig-inifiles-perl-3.000001/xt/author/tidyall.t --- libconfig-inifiles-perl-2.94/xt/author/tidyall.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/author/tidyall.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,11 @@ +# This file was automatically generated by Dist::Zilla::Plugin::Test::TidyAll v$VERSION + +use Test::More 0.88; +use Test::Code::TidyAll 0.24; + +tidyall_ok( + verbose => ( exists $ENV{TEST_TIDYALL_VERBOSE} ? $ENV{TEST_TIDYALL_VERBOSE} : 0 ), + jobs => ( exists $ENV{TEST_TIDYALL_JOBS} ? $ENV{TEST_TIDYALL_JOBS} : 1 ), +); + +done_testing; diff -Nru libconfig-inifiles-perl-2.94/xt/release/cpan-changes.t libconfig-inifiles-perl-3.000001/xt/release/cpan-changes.t --- libconfig-inifiles-perl-2.94/xt/release/cpan-changes.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/release/cpan-changes.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,10 @@ +use strict; +use warnings; + +# this test was generated with Dist::Zilla::Plugin::Test::CPAN::Changes 0.012 + +use Test::More 0.96 tests => 1; +use Test::CPAN::Changes; +subtest 'changes_ok' => sub { + changes_file_ok('Changes'); +}; diff -Nru libconfig-inifiles-perl-2.94/xt/release/trailing-space.t libconfig-inifiles-perl-3.000001/xt/release/trailing-space.t --- libconfig-inifiles-perl-2.94/xt/release/trailing-space.t 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-inifiles-perl-3.000001/xt/release/trailing-space.t 2019-01-16 09:53:16.000000000 +0000 @@ -0,0 +1,30 @@ +#!perl + +use strict; +use warnings; + +use Test::More; + +eval "use Test::TrailingSpace"; +if ($@) +{ + plan skip_all => "Test::TrailingSpace required for trailing space test."; +} +else +{ + plan tests => 1; +} + +# TODO: add .pod, .PL, the README/Changes/TODO/etc. documents and possibly +# some other stuff. +my $finder = Test::TrailingSpace->new( + { + root => '.', + filename_regex => qr#(?:\.(?:t|pm|pl|xs|c|h|txt|pod|PL)|README|Changes|TODO|LICENSE)\z#, + }, +); + +# TEST +$finder->no_trailing_space( + "No trailing space was found." +);