From: David Golden Date: Tue, 25 Jan 2011 04:06:38 +0000 (-0500) Subject: Update Module::Build to CPAN version 0.3622 X-Git-Tag: v5.13.10~447^2~57 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/7cf8bfc08bba55cf85781cc2cdb8d5ace99245ec Update Module::Build to CPAN version 0.3622 [DELTA] 0.3622 - Mon Jan 24 21:06:50 EST 2011 - No changes from 0.36_21 0.36_21 - Fri Jan 21 11:01:28 EST 2011 - Changed YAML::Tiny references to the new CPAN::Meta::YAML module instead, which is the YAML-variant that is going into the Perl core 0.36_20 - Fri Dec 10 15:36:03 EST 2010 *** DEPRECATIONS *** - Module::Build::Version has been deprecated. Module::Build now depends directly upon version.pm. A pure-perl version has been bundled in inc/ solely for bootstrapping in case configure_requires is not supported. M::B::Version remains as a wrapper around version.pm. - Module::Build::ModuleInfo has been deprecated. Module::Build now depends directly upon Module::Metadata (which is an extraction of M::B::ModuleInfo intended for general reuse). A pure-perl version has been bundled in inc/ solely for bootstrapping in case configure_requires is not supported. M::B::ModuleInfo remains as a wrapper around Module::Metadata. - Module::Build::YAML has been deprecated. Module::Build now depends directly upon YAML::Tiny. M::B::YAML remains as a subclass wrapper. The YAML_support feature has been removed, as YAML is now an ordinary dependency. 0.36_19 - Tue Dec 7 13:43:42 EST 2010 Bug fixes: - Perl::OSType is declared as a 'configure_requires' dependency, but is also bundled in inc (and loaded if needed) [David Golden] 0.36_18 - Mon Dec 6 16:46:49 EST 2010 Changes: - Added dependency on Perl::OSType to refactor and centralize management of OS type mapping [David Golden] - When parsing a version number out of a file, any trailing alphabetical characters will be dropped to avoid fatal errors when comparing version numbers. These would have been dropped (with a warning) anyway during an ordinary numeric comparison. (RT#56071) [David Golden] Bug fixes: - A Perl interpreter mismatch between running Build.PL and running Build is now a fatal error, not a warning (RT#55183) [David Golden] - Bundled Module::Build::Version updated to bring into sync with CPAN version.pm 0.86 [David Golden] - No longer uses fake user 'foo' in t/tilde (RT#61793) [David Golden] - Won't fail tests if an ancient Tie::IxHash is installed [Christopher J. Madsen] - Correctly report missing metafile field names [David Golden] - Suppress uninitialized value errors during Pod creation on ActiveState Perl [David Golden] - Return to starting directory after install action; this is an attempt to fix an install.t heisenbug (RT#63003) [David Golden] - A broken version.pm load won't cause Module::Build::Version to die trying to install itself as a mock version (RT#59499) [Eric Wilhelm and David Golden] - PERL_DL_NONLAZY is now always set when tests are run (RT#56055) [Dmitry Karasik] - 'fakeinstall' will use .modulebuildrc actions for 'install' if no specific 'fakeinstall' options are provided (RT#57279) [David Golden] - Add install*script to search path for installdeps client and search site, then vendor, then core paths - Skip noexec tmpdir check on Windows (RT#55667) [Jan Dubois] - Arguments with key value pairs may now have keys with "-" in them (RT#53050) [David Golden] - Add quotemeta to t/tilde.t test to fix Cygwin fails [Chris Williams and David Golden] - Build script now checks that M::B is at least the same version of M::B as provided in 'configure_requires' in META (RT#54954) [David Golden] 0.36_17 - Wed Oct 27 18:08:36 EDT 2010 Enhancements: - Added 'distinstall' action to run 'Build install' inside the generated distribution directory [Jeff Thalhammer] 0.36_16 - Thu Aug 26 12:44:07 EDT 2010 Bug fixes: - Better error message in case package declaration is not found when searching for version. [Alexandr Ciornii] - Skips 'release_status' tests on perl < 5.8.1 due to buggy treatment of dotted-decimal version numbers [David Golden] 0.36_15 - Wed Aug 25 10:41:28 EDT 2010 Bug fixes: - Added a mock Software::License to prevent t/properties/license.t from failing. 0.36_14 - Sun Aug 22 22:56:50 EDT 2010 Enhancements: - Adds 'release_status' and 'dist_suffix' properties in preparation for adding CPAN Meta Spec 2 support. 'dist_suffix' will be set to 'TRIAL' automatically when necessary. [David Golden] - Makes 'license' more liberal. You can now specify either a license key from the approved list (c.f. Module::Build::API) or just a Software::License subclass name (e.g. 'Perl_5'). This should provide better support for custom or proprietary licenses. [David Golden] 0.36_13 - Wed Jul 28 22:40:25 EDT 2010 Bug-fixes: - Bundled Module::Build::Version updated to bring into sync with CPAN version.pm 0.82 [David Golden] 0.36_12 - Tue Jul 27 00:08:51 EDT 2010 Enhancements: - Module::Build::Compat will now convert dotted-decimal prereqs into decimal rather than dying (and will warn about this). [Apocalypse] Bug fixes: - Caches case-sensitivity checks to boost performance, fixes RT#55162 and RT#56513 [Reini Urban] - Won't try to use ActivePerl doc generation tools without confirming that they are indeed installed. [David Golden] - Sets temporary $ENV{HOME} in testing to an absolute path, which fixes some issues when tested as part of the Perl core [Nicholas Clark] - Module::Build::ModuleInfo now warns instead of dying when a module has an invalid version. ->version now just returns undef (RT#59593) [David Golden] Changes: - When authors do not specify Module::Build in configure_requires and Module::Build is automatically added, a warning will be issued showing the added prerequisite [David Golden] - Moved automatic configure_requires generation into get_metadata() and added an 'auto' argument to toggle it (on for META and off for MYMETA) [David Golden] 0.36_11 - Thu May 27 09:41:23 EDT 2010 Bug fixes: - Handle META/MYMETA reading and writing within Module::Build to ensure utf8 mode on filehandles. Now passes/gets only strings to YAML::Tiny or Module::Build::YAML 0.36_10 - Wed May 19 18:36:06 EDT 2010 Bug fixes: - Fix failing t/manifypods.t on Windows from 0.36_09 changes [Klaus Eichner] 0.36_09 - Tue May 11 09:19:12 EDT 2010 Bug fixes: - Improve HTML documentation generation on ActivePerl (RT#53478) [Scott Renner and Klaus Eichner] 0.36_08 - Mon Apr 26 08:00:15 EDT 2010 Enhancements: - Give a list of valid licenses when given one we don't recognize (RT#55951) [Yanick Champoux] - Added 'Build manifest_skip' action to generate a default MANIFEST.SKIP [David Golden] Changes: - When temporarily generating a MANIFEST.SKIP when none exists, it will be removed on exit instead of hanging around until 'Build clean'. This is less surprising/confusing and the 'Build manifest_skip' action is now available instead to bootstrap the file [David Golden] Bug fixes: - Fixed runtime error on cygwin when searching for an executable command during installdeps testing [David Golden] --- diff --git a/MANIFEST b/MANIFEST index d253cbe..1500509 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1524,8 +1524,10 @@ cpan/Module-Build/lib/Module/Build/YAML.pm Module::Build cpan/Module-Build/scripts/config_data Module::Build cpan/Module-Build/t/00-compile.t Module::Build cpan/Module-Build/t/actions/installdeps.t Module::Build +cpan/Module-Build/t/actions/manifest_skip.t cpan/Module-Build/t/add_property.t Module::Build cpan/Module-Build/t/basic.t Module::Build +cpan/Module-Build/t/bundled/Software/License.pm cpan/Module-Build/t/bundled/Tie/CPHash.pm Module::Build cpan/Module-Build/t/bundle_inc.t Module::Build cpan/Module-Build/t/compat/exit.t Module::Build @@ -1540,10 +1542,10 @@ cpan/Module-Build/t/install_extra_target.t Module::Build cpan/Module-Build/t/install.t Module::Build cpan/Module-Build/t/lib/DistGen.pm Module::Build cpan/Module-Build/t/lib/MBTest.pm Module::Build +cpan/Module-Build/t/lib/Software/License/VaporWare.pm cpan/Module-Build/t/manifypods.t Module::Build cpan/Module-Build/t/metadata2.t Module::Build cpan/Module-Build/t/metadata.t Module::Build -cpan/Module-Build/t/moduleinfo.t Module::Build cpan/Module-Build/t/mymeta.t Module::Build cpan/Module-Build/t/new_from_context.t Module::Build cpan/Module-Build/t/notes.t Module::Build @@ -1552,8 +1554,11 @@ cpan/Module-Build/t/perl_mb_opt.t Module::Build cpan/Module-Build/t/PL_files.t Module::Build cpan/Module-Build/t/pod_parser.t Module::Build cpan/Module-Build/t/ppm.t Module::Build +cpan/Module-Build/t/properties/dist_suffix.t +cpan/Module-Build/t/properties/license.t cpan/Module-Build/t/properties/module_name.t Module::Build cpan/Module-Build/t/properties/needs_compiler.t Module::Build +cpan/Module-Build/t/properties/release_status.t cpan/Module-Build/t/properties/share_dir.t Module::Build cpan/Module-Build/t/README.pod Module::Build cpan/Module-Build/t/resume.t Module::Build diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index f41a267..f6b0800 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1020,7 +1020,7 @@ use File::Glob qw(:case); 'Module::Build' => { 'MAINTAINER' => 'kwilliams', - 'DISTRIBUTION' => 'DAGOLDEN/Module-Build-0.3607.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/Module-Build-0.3622.tar.gz', 'FILES' => q[cpan/Module-Build], 'EXCLUDED' => [ qw{ t/par.t t/signature.t }, qr!^contrib/!, qr!^devtools! ], diff --git a/cpan/Module-Build/.gitignore b/cpan/Module-Build/.gitignore new file mode 100644 index 0000000..b4b3125 --- /dev/null +++ b/cpan/Module-Build/.gitignore @@ -0,0 +1,2 @@ +^t/par.t +^t/signature.t diff --git a/cpan/Module-Build/Changes b/cpan/Module-Build/Changes index 7da9782..e77367e 100644 --- a/cpan/Module-Build/Changes +++ b/cpan/Module-Build/Changes @@ -1,5 +1,222 @@ Revision history for Perl extension Module::Build. +0.3622 - Mon Jan 24 21:06:50 EST 2011 + + - No changes from 0.36_21 + +0.36_21 - Fri Jan 21 11:01:28 EST 2011 + + - Changed YAML::Tiny references to the new CPAN::Meta::YAML module + instead, which is the YAML-variant that is going into the Perl core + +0.36_20 - Fri Dec 10 15:36:03 EST 2010 + + *** DEPRECATIONS *** + + - Module::Build::Version has been deprecated. Module::Build now depends + directly upon version.pm. A pure-perl version has been bundled in inc/ + solely for bootstrapping in case configure_requires is not supported. + M::B::Version remains as a wrapper around version.pm. + + - Module::Build::ModuleInfo has been deprecated. Module::Build now + depends directly upon Module::Metadata (which is an extraction of + M::B::ModuleInfo intended for general reuse). A pure-perl version has + been bundled in inc/ solely for bootstrapping in case + configure_requires is not supported. M::B::ModuleInfo remains as a + wrapper around Module::Metadata. + + - Module::Build::YAML has been deprecated. Module::Build now depends + directly upon YAML::Tiny. M::B::YAML remains as a subclass wrapper. + The YAML_support feature has been removed, as YAML is now an ordinary + dependency. + +0.36_19 - Tue Dec 7 13:43:42 EST 2010 + + Bug fixes: + + - Perl::OSType is declared as a 'configure_requires' dependency, but is + also bundled in inc (and loaded if needed) [David Golden] + +0.36_18 - Mon Dec 6 16:46:49 EST 2010 + + Changes: + + - Added dependency on Perl::OSType to refactor and centralize + management of OS type mapping [David Golden] + + - When parsing a version number out of a file, any trailing alphabetical + characters will be dropped to avoid fatal errors when comparing version + numbers. These would have been dropped (with a warning) anyway during + an ordinary numeric comparison. (RT#56071) [David Golden] + + Bug fixes: + + - A Perl interpreter mismatch between running Build.PL and running Build + is now a fatal error, not a warning (RT#55183) [David Golden] + + - Bundled Module::Build::Version updated to bring into sync with CPAN + version.pm 0.86 [David Golden] + + - No longer uses fake user 'foo' in t/tilde (RT#61793) [David Golden] + + - Won't fail tests if an ancient Tie::IxHash is installed + [Christopher J. Madsen] + + - Correctly report missing metafile field names [David Golden] + + - Suppress uninitialized value errors during Pod creation + on ActiveState Perl [David Golden] + + - Return to starting directory after install action; this is + an attempt to fix an install.t heisenbug (RT#63003) [David Golden] + + - A broken version.pm load won't cause Module::Build::Version to + die trying to install itself as a mock version (RT#59499) + [Eric Wilhelm and David Golden] + + - PERL_DL_NONLAZY is now always set when tests are run + (RT#56055) [Dmitry Karasik] + + - 'fakeinstall' will use .modulebuildrc actions for 'install' if + no specific 'fakeinstall' options are provided (RT#57279) + [David Golden] + + - Add install*script to search path for installdeps client + and search site, then vendor, then core paths + + - Skip noexec tmpdir check on Windows (RT#55667) [Jan Dubois] + + - Arguments with key value pairs may now have keys with "-" in them + (RT#53050) [David Golden] + + - Add quotemeta to t/tilde.t test to fix Cygwin fails + [Chris Williams and David Golden] + + - Build script now checks that M::B is at least the same version + of M::B as provided in 'configure_requires' in META + (RT#54954) [David Golden] + +0.36_17 - Wed Oct 27 18:08:36 EDT 2010 + + Enhancements: + + - Added 'distinstall' action to run 'Build install' inside the + generated distribution directory [Jeff Thalhammer] + +0.36_16 - Thu Aug 26 12:44:07 EDT 2010 + + Bug fixes: + + - Better error message in case package declaration is not found + when searching for version. [Alexandr Ciornii] + + - Skips 'release_status' tests on perl < 5.8.1 due to buggy + treatment of dotted-decimal version numbers [David Golden] + +0.36_15 - Wed Aug 25 10:41:28 EDT 2010 + + Bug fixes: + + - Added a mock Software::License to prevent t/properties/license.t + from failing. + +0.36_14 - Sun Aug 22 22:56:50 EDT 2010 + + Enhancements: + + - Adds 'release_status' and 'dist_suffix' properties in preparation + for adding CPAN Meta Spec 2 support. 'dist_suffix' will be set + to 'TRIAL' automatically when necessary. [David Golden] + + - Makes 'license' more liberal. You can now specify either a license + key from the approved list (c.f. Module::Build::API) or just a + Software::License subclass name (e.g. 'Perl_5'). This should + provide better support for custom or proprietary licenses. + [David Golden] + +0.36_13 - Wed Jul 28 22:40:25 EDT 2010 + + Bug-fixes: + + - Bundled Module::Build::Version updated to bring into sync with CPAN + version.pm 0.82 [David Golden] + +0.36_12 - Tue Jul 27 00:08:51 EDT 2010 + + Enhancements: + + - Module::Build::Compat will now convert dotted-decimal prereqs into + decimal rather than dying (and will warn about this). [Apocalypse] + + Bug fixes: + + - Caches case-sensitivity checks to boost performance, fixes + RT#55162 and RT#56513 [Reini Urban] + + - Won't try to use ActivePerl doc generation tools without confirming + that they are indeed installed. [David Golden] + + - Sets temporary $ENV{HOME} in testing to an absolute path, which fixes + some issues when tested as part of the Perl core [Nicholas Clark] + + - Module::Build::ModuleInfo now warns instead of dying when a module + has an invalid version. ->version now just returns undef + (RT#59593) [David Golden] + + Changes: + + - When authors do not specify Module::Build in configure_requires and + Module::Build is automatically added, a warning will be issued + showing the added prerequisite [David Golden] + + - Moved automatic configure_requires generation into get_metadata() + and added an 'auto' argument to toggle it (on for META and off + for MYMETA) [David Golden] + +0.36_11 - Thu May 27 09:41:23 EDT 2010 + + Bug fixes: + + - Handle META/MYMETA reading and writing within Module::Build to ensure + utf8 mode on filehandles. Now passes/gets only strings to YAML::Tiny + or Module::Build::YAML + +0.36_10 - Wed May 19 18:36:06 EDT 2010 + + Bug fixes: + + - Fix failing t/manifypods.t on Windows from 0.36_09 changes [Klaus + Eichner] + +0.36_09 - Tue May 11 09:19:12 EDT 2010 + + Bug fixes: + + - Improve HTML documentation generation on ActivePerl (RT#53478) + [Scott Renner and Klaus Eichner] + +0.36_08 - Mon Apr 26 08:00:15 EDT 2010 + + Enhancements: + + - Give a list of valid licenses when given one we don't recognize + (RT#55951) [Yanick Champoux] + + - Added 'Build manifest_skip' action to generate a default MANIFEST.SKIP + [David Golden] + + Changes: + + - When temporarily generating a MANIFEST.SKIP when none exists, it will + be removed on exit instead of hanging around until 'Build clean'. This + is less surprising/confusing and the 'Build manifest_skip' action + is now available instead to bootstrap the file [David Golden] + + Bug fixes: + + - Fixed runtime error on cygwin when searching for an executable command + during installdeps testing [David Golden] + 0.3607 - Thu Apr 1 11:27:16 EDT 2010 Bug fixes: diff --git a/cpan/Module-Build/lib/Module/Build.pm b/cpan/Module-Build/lib/Module/Build.pm index 224e245..e23375e 100644 --- a/cpan/Module-Build/lib/Module/Build.pm +++ b/cpan/Module-Build/lib/Module/Build.pm @@ -10,68 +10,15 @@ use strict; use File::Spec (); use File::Path (); use File::Basename (); +use Perl::OSType (); use Module::Build::Base; use vars qw($VERSION @ISA); @ISA = qw(Module::Build::Base); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; -# Okay, this is the brute-force method of finding out what kind of -# platform we're on. I don't know of a systematic way. These values -# came from the latest (bleadperl) perlport.pod. - -my %OSTYPES = qw( - aix Unix - bsdos Unix - beos Unix - dgux Unix - dragonfly Unix - dynixptx Unix - freebsd Unix - linux Unix - haiku Unix - hpux Unix - irix Unix - darwin Unix - machten Unix - midnightbsd Unix - mirbsd Unix - next Unix - openbsd Unix - netbsd Unix - dec_osf Unix - nto Unix - svr4 Unix - svr5 Unix - sco_sv Unix - unicos Unix - unicosmk Unix - solaris Unix - sunos Unix - cygwin Unix - os2 Unix - interix Unix - gnu Unix - gnukfreebsd Unix - nto Unix - - dos Windows - MSWin32 Windows - - os390 EBCDIC - os400 EBCDIC - posix-bc EBCDIC - vmesa EBCDIC - - MacOS MacOS - VMS VMS - VOS VOS - riscos RiscOS - amigaos Amiga - mpeix MPEiX - ); # Inserts the given module into the @ISA hierarchy between # Module::Build and its immediate parent @@ -94,18 +41,18 @@ sub _interpose_module { if (grep {-e File::Spec->catfile($_, qw(Module Build Platform), $^O) . '.pm'} @INC) { __PACKAGE__->_interpose_module("Module::Build::Platform::$^O"); -} elsif (exists $OSTYPES{$^O}) { - __PACKAGE__->_interpose_module("Module::Build::Platform::$OSTYPES{$^O}"); +} elsif ( my $ostype = os_type() ) { + __PACKAGE__->_interpose_module("Module::Build::Platform::$ostype"); } else { warn "Unknown OS type '$^O' - using default settings\n"; } -sub os_type { $OSTYPES{$^O} } +sub os_type { return Perl::OSType::os_type() } -sub is_vmsish { return ((os_type() || '') eq 'VMS') } -sub is_windowsish { return ((os_type() || '') eq 'Windows') } -sub is_unixish { return ((os_type() || '') eq 'Unix') } +sub is_vmsish { return Perl::OSType::is_os_type('VMS') } +sub is_windowsish { return Perl::OSType::is_os_type('Windows') } +sub is_unixish { return Perl::OSType::is_os_type('Unix') } 1; @@ -121,7 +68,6 @@ testall testcover testdb testpod testpodcoverage versioninstall Module::Build - Build and install Perl modules - =head1 SYNOPSIS Standard process for building & installing modules: @@ -168,7 +114,28 @@ This illustrates initial configuration and the running of three 'actions'. In this case the actions run are 'build' (the default action), 'test', and 'install'. Other actions defined so far include: - + build manifest_skip + checkchanges manpages + checkgit pardist + clean patch_blead + code ppd + config_data ppmdist + diff prereq_data + dist prereq_report + distcheck pure_install + distclean realclean + distdir retest + distinstall skipcheck + distmeta tag_git + distsign test + disttest testall + docs testcover + fakeinstall testdb + help testpod + html testpodcoverage + install upload + installdeps versioninstall + manifest You can run the 'help' action for a complete list of actions. @@ -328,6 +295,15 @@ Creates a "distribution directory" named C<$dist_name-$dist_version> copies all the files listed in the F file to that directory. This directory is what the distribution tarball is created from. +=item distinstall + +[version 0.37] + +Performs the 'distdir' action, then switches into that directory and runs a +C, followed by the 'build' and 'install' actions in that +directory. Use PERL_MB_OPT or F<.modulebuildrc> to set options that should be +applied during subprocesses + =item distmeta [version 0.21] @@ -337,17 +313,13 @@ Creates the F file that describes the distribution. F is a file containing various bits of I about the distribution. The metadata includes the distribution name, version, abstract, prerequisites, license, and various other data about the -distribution. This file is created as F in YAML format. -It is recommended that the C module be installed to create it. -If the C module is not installed, an internal module supplied -with Module::Build will be used to write the META.yml file, and this -will most likely be fine. +distribution. This file is created as F in a simplified YAML format. F file must also be listed in F - if it's not, a warning will be issued. -The current version of the F specification can be found at -L +The current version of the F specification can be found +on CPAN as L. =item distsign @@ -361,9 +333,11 @@ MANIFEST. [version 0.05] -Performs the 'distdir' action, then switches into that directory and -runs a C, followed by the 'build' and 'test' actions in -that directory. +Performs the 'distdir' action, then switches into that directory and runs a +C, followed by the 'build' and 'test' actions in that directory. +Use PERL_MB_OPT or F<.modulebuildrc> to set options that should be applied +during subprocesses + =item docs @@ -473,6 +447,14 @@ add your own stuff to it: See the L and L actions if you want to find out what the C action would do, without actually doing anything. +=item manifest_skip + +[version 0.3608] + +This is an action intended for use by module authors, not people +installing modules. It will generate a boilerplate MANIFEST.SKIP file +if one does not already exist. + =item manpages [version 0.28] @@ -734,7 +716,8 @@ Suppress informative messages on output. =item verbose -Display extra information about the Build on output. +Display extra information about the Build on output. C will +turn off C =item cpan_client @@ -1117,10 +1100,10 @@ modify it under the same terms as Perl itself. =head1 SEE ALSO perl(1), L, L, -L, L, L +L, L F Specification: -L +L L diff --git a/cpan/Module-Build/lib/Module/Build/API.pod b/cpan/Module-Build/lib/Module/Build/API.pod index 494297f..1106bc8 100644 --- a/cpan/Module-Build/lib/Module/Build/API.pod +++ b/cpan/Module-Build/lib/Module/Build/API.pod @@ -266,6 +266,25 @@ a reasonable default. However, some agglomerative distributions like C or C have names that don't correspond directly to a module name, so C can be set independently. +=item dist_suffix + +[version 0.37] + +Specifies an optional suffix to include after the version number +in the distribution directory (and tarball) name. The only suffix +currently recognized by PAUSE is 'TRIAL', which indicates that the +distribution should not be indexed. For example: + + Foo-Bar-1.23-TRIAL.tar.gz + +This will automatically do the "right thing" depending on C and +C. When C does not have an underscore and +C is not 'stable', then C will default to 'TRIAL'. +Otherwise it will default to the empty string, disabling the suffix. + +In general, authors should only set this if they B override the default +behavior for some particular purpose. + =item dist_version [version 0.11] @@ -452,8 +471,12 @@ L [version 0.07] -Specifies the licensing terms of your distribution. Valid options include: +Specifies the licensing terms of your distribution. +As of Module::Build version 0.36_14, you may use a L +subclass name (e.g. 'Apache_2_0') instead of one of the keys below. + +The legacy list of valid license values include: =over 4 @@ -530,9 +553,9 @@ restrictions. =back - Note that you must still include the terms of your license in your -documentation - this field only lets automated tools figure out your +code and documentation - this field only sets the information that is included +in distribution metadata to let automated tools figure out your licensing restrictions. Humans still need something to read. If you choose to provide this field, you should make sure that you keep it in sync with your written documentation if you ever change your licensing @@ -541,13 +564,7 @@ terms. You may also use a license type of C if you don't wish to specify your terms in the metadata. -It is a fatal error to use a license other than the ones mentioned -above. This is not because I wish to impose licensing terms on you - -please let me know if you would like another license option to be -added to the list. I just started out with a small set of licenses to -keep things simple, figuring I'd let people with actual working -knowledge in this area tell me what to do. So if that's you, drop me -a line. +Also see the C parameter. =item meta_add @@ -716,6 +733,22 @@ Normally, C does not search subdirectories when looking for tests to run. When this options is set it will search recursively in all subdirectories of the standard 't' test directory. +=item release_status + +[version 0.37] + +The CPAN Meta Spec version 2 adds C to allow authors +to specify how a distribution should be indexed. Consistent with the +spec, this parameter can only have one three values: 'stable', +'testing' or 'unstable'. + +Unless explicitly set by the author, C will default +to 'stable' unless C contains an underscore, in which +case it will default to 'testing'. + +It is an error to specify a C of 'stable' when +C contains an underscore character. + =item requires [version 0.07] @@ -1593,11 +1626,24 @@ of F. E.g. return $data; } -The only valid argument is C, which indicates whether missing required +Valid arguments include: + +=over + +=item * + +C -- indicates whether missing required metadata fields should be a fatal error or not. For META creation, it generally should, but for MYMETA creation for end-users, it should not be fatal. +=item * + +C -- indicates whether any necessary configure_requires should be +automatically added. This is used in META creation. + +=back + This method is a wrapper around the old prepare_metadata API now that we no longer use YAML::Node to hold metadata. @@ -1832,7 +1878,129 @@ accessor methods for the following properties: =over 4 - +=item PL_files() + +=item allow_mb_mismatch() + +=item auto_configure_requires() + +=item autosplit() + +=item base_dir() + +=item bindoc_dirs() + +=item blib() + +=item build_bat() + +=item build_class() + +=item build_elements() + +=item build_requires() + +=item build_script() + +=item bundle_inc() + +=item bundle_inc_preload() + +=item c_source() + +=item config_dir() + +=item configure_requires() + +=item conflicts() + +=item cpan_client() + +=item create_license() + +=item create_makefile_pl() + +=item create_packlist() + +=item create_readme() + +=item debug() + +=item debugger() + +=item destdir() + +=item get_options() + +=item html_css() + +=item include_dirs() + +=item install_base() + +=item installdirs() + +=item libdoc_dirs() + +=item license() + +=item magic_number() + +=item mb_version() + +=item meta_add() + +=item meta_merge() + +=item metafile() + +=item module_name() + +=item mymetafile() + +=item needs_compiler() + +=item orig_dir() + +=item perl() + +=item pm_files() + +=item pod_files() + +=item pollute() + +=item prefix() + +=item prereq_action_types() + +=item program_name() + +=item quiet() + +=item recommends() + +=item recurse_into() + +=item recursive_test_files() + +=item requires() + +=item scripts() + +=item sign() + +=item tap_harness_args() + +=item test_file_exts() + +=item use_rcfile() + +=item use_tap_harness() + +=item verbose() + +=item xs_files() =back @@ -1882,7 +2050,7 @@ modify it under the same terms as Perl itself. =head1 SEE ALSO perl(1), L(3), L(3), -L(3), L(3), L(3) +L(3), L(3) F Specification: L diff --git a/cpan/Module-Build/lib/Module/Build/Base.pm b/cpan/Module-Build/lib/Module/Build/Base.pm index 45205e8..d42c8af 100644 --- a/cpan/Module-Build/lib/Module/Build/Base.pm +++ b/cpan/Module-Build/lib/Module/Build/Base.pm @@ -4,7 +4,7 @@ package Module::Build::Base; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; BEGIN { require 5.00503 } @@ -62,6 +62,7 @@ EOF $self->dist_name; $self->dist_version; + $self->release_status; $self->_guess_module_name unless $self->module_name; $self->_find_nested_builds; @@ -95,8 +96,12 @@ sub resume { unless ($self->_perl_is_same($self->{properties}{perl})) { my $perl = $self->find_perl_interpreter; - $self->log_warn(" * WARNING: Configuration was initially created with '$self->{properties}{perl}',\n". - " but we are now using '$perl'.\n"); + die(<<"DIEFATAL"); +* FATAL ERROR: Perl interpreter mismatch. Configuration was initially + created with '$self->{properties}{perl}' + but we are now using '$perl'. You must + run 'Build realclean' or 'make realclean' and re-configure. +DIEFATAL } $self->cull_args(@ARGV); @@ -105,7 +110,7 @@ sub resume { my $mb_version = $Module::Build::VERSION; if ( $mb_version ne $self->{properties}{mb_version} ) { $self->log_warn(<<"MISMATCH"); -* WARNING: Configuration was initially created with Module::Build +* WARNING: Configuration was initially created with Module::Build version '$self->{properties}{mb_version}' but we are now using version '$mb_version'. If errors occur, you must re-run the Build.PL or Makefile.PL script. MISMATCH @@ -201,15 +206,15 @@ sub _construct { sub log_info { my $self = shift; - print @_ unless(ref($self) and $self->quiet); + print @_ if ref($self) && ( $self->verbose || ! $self->quiet ); } sub log_verbose { my $self = shift; - $self->log_info(@_) if(ref($self) and $self->verbose); + print @_ if ref($self) && $self->verbose; } sub log_debug { my $self = shift; - print @_ if ref $self && $self->debug; + print @_ if ref($self) && $self->debug; } sub log_warn { @@ -926,8 +931,7 @@ __PACKAGE__->add_property( ); { - my $Is_ActivePerl = eval {require ActivePerl::DocTools}; - __PACKAGE__->add_property(html_css => $Is_ActivePerl ? 'Active.css' : ''); + __PACKAGE__->add_property(html_css => ''); } { @@ -964,6 +968,7 @@ __PACKAGE__->add_property($_) for qw( dist_abstract dist_author dist_name + dist_suffix dist_version dist_version_from extra_compiler_flags @@ -984,6 +989,7 @@ __PACKAGE__->add_property($_) for qw( program_name quiet recursive_test_files + release_status script_files scripts share_dir @@ -1124,6 +1130,41 @@ sub dist_name { return $p->{dist_name}; } +sub release_status { + my ($self) = @_; + my $p = $self->{properties}; + + if ( ! defined $p->{release_status} ) { + $p->{release_status} = $self->_is_dev_version ? 'testing' : 'stable'; + } + + unless ( $p->{release_status} =~ qr/\A(?:stable|testing|unstable)\z/ ) { + die "Illegal value '$p->{release_status}' for release_status\n"; + } + + if ( $p->{release_status} eq 'stable' && $self->_is_dev_version ) { + my $version = $self->dist_version; + die "Illegal value '$p->{release_status}' with version '$version'\n"; + } + return $p->{release_status}; +} + +sub dist_suffix { + my ($self) = @_; + my $p = $self->{properties}; + return $p->{dist_suffix} if defined $p->{dist_suffix}; + + if ( $self->release_status eq 'stable' ) { + $p->{dist_suffix} = ""; + } + else { + # non-stable release but non-dev version number needs '-TRIAL' appended + $p->{dist_suffix} = $self->_is_dev_version ? "" : "TRIAL" ; + } + + return $p->{dist_suffix}; +} + sub dist_version_from { my ($self) = @_; my $p = $self->{properties}; @@ -1144,7 +1185,11 @@ sub dist_version { my $version_from = File::Spec->catfile( split( qr{/}, $dist_version_from ) ); my $pm_info = Module::Build::ModuleInfo->new_from_file( $version_from ) or die "Can't find file $version_from to determine version"; + #$p->{dist_version} is undef here $p->{dist_version} = $self->normalize_version( $pm_info->version() ); + unless (defined $p->{dist_version}) { + die "Can't determine distribution version from $version_from"; + } } die ("Can't determine distribution version, must supply either 'dist_version',\n". @@ -1154,6 +1199,16 @@ sub dist_version { return $p->{dist_version}; } +sub _is_dev_version { + my ($self) = @_; + my $dist_version = $self->dist_version; + my $version_obj = eval { Module::Build::Version->new( $dist_version ) }; + # assume it's normal if the version string is fatal -- in this case + # the author might be doing something weird so should play along and + # assume they'll specify all necessary behavior + return $@ ? 0 : $version_obj->is_alpha; +} + sub dist_author { shift->_pod_parse('author') } sub dist_abstract { shift->_pod_parse('abstract') } @@ -1182,6 +1237,26 @@ sub find_module_by_name { # Method provided for backwards compatibility return Module::Build::ModuleInfo->find_module_by_name(@_[1,2]); } +{ + # $unlink_list_for_pid{$$} = [ ... ] + my %unlink_list_for_pid; + + sub _unlink_on_exit { + my $self = shift; + for my $f ( @_ ) { + push @{$unlink_list_for_pid{$$}}, $f if -f $f; + } + return 1; + } + + END { + for my $f ( map glob($_), @{ $unlink_list_for_pid{$$} || [] } ) { + next unless -e $f; + File::Path::rmtree($f, 0, 0); + } + } +} + sub add_to_cleanup { my $self = shift; my %files = map {$self->localize_file_path($_), 1} @_; @@ -1389,8 +1464,8 @@ sub _feature_deps_msg { return $log_text; } -# Automatically detect and add prerequisites based on configuration -sub auto_require { +# Automatically detect configure_requires prereqs +sub auto_config_requires { my ($self) = @_; my $p = $self->{properties}; @@ -1401,6 +1476,10 @@ sub auto_require { && ! exists $p->{configure_requires}{'Module::Build'} ) { (my $ver = $VERSION) =~ s/^(\d+\.\d\d).*$/$1/; # last major release only + $self->log_warn(< { 'Module::Build' => $ver } +EOM $self->_add_prereq('configure_requires', 'Module::Build', $ver); } @@ -1415,6 +1494,14 @@ sub auto_require { } } + return; +} + +# Automatically detect and add prerequisites based on configuration +sub auto_require { + my ($self) = @_; + my $p = $self->{properties}; + # If needs_compiler is not explictly set, automatically set it # If set, we need ExtUtils::CBuilder (and a compiler) my $xs_files = $self->find_xs_files; @@ -1555,6 +1642,24 @@ sub _parse_conditions { } } +sub try_require { + my ($self, $modname, $spec) = @_; + my $status = $self->check_installed_status($modname, defined($spec) ? $spec : 0); + return unless $status->{ok}; + my $path = $modname; + $path =~ s{::}{/}g; + $path .= ".pm"; + if ( defined $INC{$path} ) { + return 1; + } + elsif ( exists $INC{$path} ) { # failed before, don't try again + return; + } + else { + return eval "require $modname"; + } +} + sub check_installed_status { my ($self, $modname, $spec) = @_; my %status = (need => $spec); @@ -1572,7 +1677,7 @@ sub check_installed_status { return \%status; } - $status{have} = $pm_info->version(); + $status{have} = eval { $pm_info->version() }; if ($spec and !defined($status{have})) { @status{ qw(have message) } = (undef, "Couldn't find a \$VERSION in prerequisite $modname"); return \%status; @@ -1684,11 +1789,15 @@ sub print_build_script { my $closedata=""; + my $config_requires; + if ( -f $self->metafile ) { + my $meta = eval { $self->read_metafile( $self->metafile ) }; + $config_requires = $meta && $meta->{configure_requires}{'Module::Build'}; + } + $config_requires ||= 0; + my %q = map {$_, $self->$_()} qw(config_dir base_dir); - my $case_tolerant = 0+(File::Spec->can('case_tolerant') - && File::Spec->case_tolerant); - $q{base_dir} = uc $q{base_dir} if $case_tolerant; $q{base_dir} = Win32::GetShortPathName($q{base_dir}) if $self->is_windowsish; $q{magic_numfile} = $self->config_file('magicnum'); @@ -1744,6 +1853,7 @@ $quoted_INC close(*DATA) unless eof(*DATA); # ensure no open handles to this script use $build_package; +Module::Build->VERSION(q{$config_requires}); # Some platforms have problems setting \$^X in shebang contexts, fix it up here \$^X = Module::Build->find_perl_interpreter; @@ -1783,8 +1893,8 @@ sub create_mymeta { # if we read META OK, just update it if ( defined $mymeta ) { my $prereqs = $self->_normalize_prereqs; - for my $t ( keys %$prereqs ) { - $mymeta->{$t} = $prereqs->{$t}; + for my $t ( 'configure_requires', @{$self->prereq_action_types} ) { + $mymeta->{$t} = $prereqs->{$t} if $prereqs->{$t}; } } # but generate from scratch, ignoring errors if META doesn't exist @@ -1797,7 +1907,8 @@ sub create_mymeta { # Note which M::B created it $mymeta->{generated_by} = "Module::Build version $Module::Build::VERSION"; - $self->write_metafile( $mymetafile, $mymeta ); + $self->write_metafile( $mymetafile, $mymeta ) or + $self->log_warn("Could not create MYMETA.yml\n"); return 1; } @@ -1958,7 +2069,6 @@ sub _translate_option { create_readme extra_compiler_flags extra_linker_flags - html_css install_base install_path meta_add @@ -2068,7 +2178,7 @@ sub read_args { $args{$_} ||= []; $args{$_} = [ $args{$_} ] unless ref $args{$_}; foreach my $arg ( @{$args{$_}} ) { - $arg =~ /(\w+)=(.*)/ + $arg =~ /($opt_re)=(.*)/ or die "Malformed '$_' argument: '$arg' should be something like 'foo=bar'"; $hash{$1} = $2; } @@ -2208,6 +2318,11 @@ sub read_modulebuildrc { my ($global_opts) = $self->read_args( $self->split_like_shell( $options{'*'} || '' ) ); + + # let fakeinstall act like install if not provided + if ( $action eq 'fakeinstall' && ! exists $options{fakeinstall} ) { + $action = 'install'; + } my ($action_opts) = $self->read_args( $self->split_like_shell( $options{$action} || '' ) ); @@ -2552,6 +2667,8 @@ sub do_tests { my $tests = $self->find_test_files; + local $ENV{PERL_DL_NONLAZY} = 1; + if(@$tests) { my $args = $self->tap_harness_args; if($self->use_tap_harness or ($args and %$args)) { @@ -2667,7 +2784,7 @@ sub ACTION_testcover { # testcover was run. If so, start over. if (-e 'cover_db') { my $pm_files = $self->rscan_dir - (File::Spec->catdir($self->blib, 'lib'), file_qr('\.pm$') ); + (File::Spec->catdir($self->blib, 'lib'), $self->file_qr('\.pm$') ); my $cover_files = $self->rscan_dir('cover_db', sub {-f $_ and not /\.html$/}); $self->do_system(qw(cover -delete)) @@ -2732,11 +2849,11 @@ sub process_support_files { if (ref($p->{c_source}) eq "ARRAY") { push @{$p->{include_dirs}}, @{$p->{c_source}}; for my $path (@{$p->{c_source}}) { - push @$files, @{ $self->rscan_dir($path, file_qr('\.c(c|p|pp|xx|\+\+)?$')) }; + push @$files, @{ $self->rscan_dir($path, $self->file_qr('\.c(c|p|pp|xx|\+\+)?$')) }; } } else { push @{$p->{include_dirs}}, $p->{c_source}; - $files = $self->rscan_dir($p->{c_source}, file_qr('\.c(c|p|pp|xx|\+\+)?$')); + $files = $self->rscan_dir($p->{c_source}, $self->file_qr('\.c(c|p|pp|xx|\+\+)?$')); } foreach my $file (@$files) { @@ -2860,8 +2977,10 @@ sub find_PL_files { } return unless -d 'lib'; - return { map {$_, [/^(.*)\.PL$/i ]} @{ $self->rscan_dir('lib', - file_qr('\.PL$')) } }; + return { + map {$_, [/^(.*)\.PL$/i ]} + @{ $self->rscan_dir('lib', $self->file_qr('\.PL$')) } + }; } sub find_pm_files { shift->_find_file_by_type('pm', 'lib') } @@ -2914,7 +3033,7 @@ sub _find_file_by_type { return { map {$_, $_} map $self->localize_file_path($_), grep !/\.\#/, - @{ $self->rscan_dir($dir, file_qr("\\.$type\$")) } }; + @{ $self->rscan_dir($dir, $self->file_qr("\\.$type\$")) } }; } sub localize_file_path { @@ -2987,7 +3106,7 @@ sub ACTION_testpod { my @files = sort keys %{$self->_find_pods($self->libdoc_dirs)}, keys %{$self->_find_pods ($self->bindoc_dirs, - exclude => [ file_qr('\.bat$') ])} + exclude => [ $self->file_qr('\.bat$') ])} or die "Couldn't find any POD files to test\n"; { package # hide from PAUSE @@ -3041,6 +3160,24 @@ sub _is_default_installable { ) ? 1 : 0; } +sub _is_ActivePerl { +# return 0; + my $self = shift; + unless (exists($self->{_is_ActivePerl})) { + $self->{_is_ActivePerl} = (eval { require ActivePerl::DocTools; } || 0); + } + return $self->{_is_ActivePerl}; +} + +sub _is_ActivePPM { +# return 0; + my $self = shift; + unless (exists($self->{_is_ActivePPM})) { + $self->{_is_ActivePPM} = (eval { require ActivePerl::PPM; } || 0); + } + return $self->{_is_ActivePPM}; +} + sub ACTION_manpages { my $self = shift; @@ -3049,27 +3186,21 @@ sub ACTION_manpages { $self->depends_on('code'); foreach my $type ( qw(bin lib) ) { + next unless ( $self->invoked_action eq 'manpages' || $self->_is_default_installable("${type}doc")); my $files = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, - exclude => [ file_qr('\.bat$') ] ); + exclude => [ $self->file_qr('\.bat$') ] ); next unless %$files; my $sub = $self->can("manify_${type}_pods"); - next unless defined( $sub ); - - if ( $self->invoked_action eq 'manpages' ) { - $self->$sub(); - } elsif ( $self->_is_default_installable("${type}doc") ) { - $self->$sub(); - } + $self->$sub() if defined( $sub ); } - } sub manify_bin_pods { my $self = shift; my $files = $self->_find_pods( $self->{properties}{bindoc_dirs}, - exclude => [ file_qr('\.bat$') ] ); + exclude => [ $self->file_qr('\.bat$') ] ); return unless keys %$files; my $mandir = File::Spec->catdir( $self->blib, 'bindoc' ); @@ -3153,21 +3284,11 @@ sub ACTION_html { $self->depends_on('code'); foreach my $type ( qw(bin lib) ) { - my $files = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, - exclude => - [ file_qr('\.(?:bat|com|html)$') ] ); - next unless %$files; - - if ( $self->invoked_action eq 'html' ) { - $self->htmlify_pods( $type ); - } elsif ( $self->_is_default_installable("${type}html") ) { - $self->htmlify_pods( $type ); - } + next unless ( $self->invoked_action eq 'html' || $self->_is_default_installable("${type}html")); + $self->htmlify_pods( $type ); } - } - # 1) If it's an ActiveState perl install, we need to run # ActivePerl::DocTools->UpdateTOC; # 2) Links to other modules are not being generated @@ -3176,13 +3297,10 @@ sub htmlify_pods { my $type = shift; my $htmldir = shift || File::Spec->catdir($self->blib, "${type}html"); - require Module::Build::PodParser; - require Pod::Html; - $self->add_to_cleanup('pod2htm*'); my $pods = $self->_find_pods( $self->{properties}{"${type}doc_dirs"}, - exclude => [ file_qr('\.(?:bat|com|html)$') ] ); + exclude => [ $self->file_qr('\.(?:bat|com|html)$') ] ); return unless %$pods; # nothing to do unless ( -d $htmldir ) { @@ -3192,21 +3310,51 @@ sub htmlify_pods { my @rootdirs = ($type eq 'bin') ? qw(bin) : $self->installdirs eq 'core' ? qw(lib) : qw(site lib); + my $podroot = $self->original_prefix('core'); + + my $htmlroot = $self->install_sets('core')->{libhtml}; + my @podpath = (map { File::Spec->abs2rel($_ ,$podroot) } grep { -d } + ( $self->install_sets('core', 'lib'), # lib + $self->install_sets('core', 'bin'), # bin + $self->install_sets('site', 'lib'), # site/lib + ),File::Spec->rel2abs($self->blib) + ); - my $podpath = join ':', - map $_->[1], - grep -e $_->[0], - map [File::Spec->catdir($self->blib, $_), $_], - qw( script lib ); + my $podpath = join(":", map { tr,:\\,|/,; $_ } @podpath); + my $blibdir = join('/', File::Spec->splitdir( + (File::Spec->splitpath(File::Spec->rel2abs($htmldir),1))[1]),'' + ); + + my ($with_ActiveState, $htmltool); + + if ( $with_ActiveState = $self->_is_ActivePerl + && eval { require ActivePerl::DocTools::Pod; 1 } + ) { + my $tool_v = ActiveState::DocTools::Pod->VERSION; + $htmltool = "ActiveState::DocTools::Pod"; + $htmltool .= " $tool_v" if $tool_v && length $tool_v; + } + else { + require Module::Build::PodParser; + require Pod::Html; + $htmltool = "Pod::Html " . Pod::Html->VERSION; + } + $self->log_verbose("Converting Pod to HTML with $htmltool\n"); + + my $errors = 0; + + POD: foreach my $pod ( keys %$pods ) { my ($name, $path) = File::Basename::fileparse($pods->{$pod}, - file_qr('\.(?:pm|plx?|pod)$')); + $self->file_qr('\.(?:pm|plx?|pod)$') + ); my @dirs = File::Spec->splitdir( File::Spec->canonpath( $path ) ); pop( @dirs ) if scalar(@dirs) && $dirs[-1] eq File::Spec->curdir; - my $fulldir = File::Spec->catfile($htmldir, @rootdirs, @dirs); + my $fulldir = File::Spec->catdir($htmldir, @rootdirs, @dirs); + my $tmpfile = File::Spec->catfile($fulldir, "${name}.tmp"); my $outfile = File::Spec->catfile($fulldir, "${name}.html"); my $infile = File::Spec->abs2rel($pod); @@ -3217,38 +3365,78 @@ sub htmlify_pods { or die "Couldn't mkdir $fulldir: $!"; } - my $path2root = join( '/', ('..') x (@rootdirs+@dirs) ); - my $htmlroot = join( '/', - ($path2root, - $self->installdirs eq 'core' ? () : qw(site) ) ); - - my $fh = IO::File->new($infile) or die "Can't read $infile: $!"; - my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract(); - - my $title = join( '::', (@dirs, $name) ); - $title .= " - $abstract" if $abstract; - - my @opts = ( - '--flush', - "--title=$title", - "--podpath=$podpath", - "--infile=$infile", - "--outfile=$outfile", - '--podroot=' . $self->blib, - "--htmlroot=$htmlroot", - ); - - if ( eval{Pod::Html->VERSION(1.03)} ) { - push( @opts, ('--header', '--backlink=Back to Top') ); - push( @opts, "--css=$path2root/" . $self->html_css) if $self->html_css; + $self->log_verbose("HTMLifying $infile -> $outfile\n"); + if ( $with_ActiveState ) { + my $depth = @rootdirs + @dirs; + my %opts = ( infile => $infile, + outfile => $tmpfile, + podpath => $podpath, + podroot => $podroot, + index => 1, + depth => $depth, + ); + eval { + ActivePerl::DocTools::Pod::pod2html(%opts); + 1; + } or $self->log_warn("[$htmltool] pod2html (" . + join(", ", map { "q{$_} => q{$opts{$_}}" } (keys %opts)) . ") failed: $@"); + } else { + my $path2root = join( '/', ('..') x (@rootdirs+@dirs) ); + my $fh = IO::File->new($infile) or die "Can't read $infile: $!"; + my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract(); + + my $title = join( '::', (@dirs, $name) ); + $title .= " - $abstract" if $abstract; + + my @opts = ( + '--flush', + "--title=$title", + "--podpath=$podpath", + "--infile=$infile", + "--outfile=$tmpfile", + "--podroot=$podroot", + "--htmlroot=$path2root", + ); + + if ( eval{Pod::Html->VERSION(1.03)} ) { + push( @opts, ('--header', '--backlink=Back to Top') ); + } + + $self->log_verbose("P::H::pod2html @opts\n"); + eval { Pod::Html::pod2html(@opts); 1 } + or $self->log_warn("[$htmltool] pod2html( " . + join(", ", map { "q{$_}" } @opts) . ") failed: $@"); + } + # We now have to cleanup the resulting html file + if ( ! -r $tmpfile ) { + $errors++; + next POD; + } + my $fh = IO::File->new($tmpfile) or die "Can't read $tmpfile: $!"; + my $html = join('',<$fh>); + $fh->close; + if (!$self->_is_ActivePerl) { + # These fixups are already done by AP::DT:P:pod2html + # The output from pod2html is NOT XHTML! + # IE6+ will display content that is not valid for DOCTYPE + $html =~ s#^##im; + $html =~ s###i; + + # IE6+ will not display local HTML files with strict + # security without this comment + $html =~ s##\n#i; } + # Fixup links that point to our temp blib + $html =~ s/\Q$blibdir\E//g; - $self->log_verbose("HTMLifying $infile -> $outfile\n"); - $self->log_verbose("pod2html @opts\n"); - eval { Pod::Html::pod2html(@opts); 1 } - or $self->log_warn("pod2html @opts failed: $@"); + $fh = IO::File->new(">$outfile") or die "Can't write $outfile: $!"; + print $fh $html; + $fh->close; + unlink($tmpfile); } + return ! $errors; + } # Adapted from ExtUtils::MM_Unix @@ -3293,7 +3481,7 @@ sub ACTION_diff { delete $installmap->{read}; delete $installmap->{write}; - my $text_suffix = file_qr('\.(pm|pod)$'); + my $text_suffix = $self->file_qr('\.(pm|pod)$'); while (my $localdir = each %$installmap) { my @localparts = File::Spec->splitdir($localdir); @@ -3331,7 +3519,35 @@ sub ACTION_install { my ($self) = @_; require ExtUtils::Install; $self->depends_on('build'); - ExtUtils::Install::install($self->install_map, $self->verbose, 0, $self->{args}{uninst}||0); + # RT#63003 suggest that odd cirmstances that we might wind up + # in a different directory than we started, so wrap with _do_in_dir to + # ensure we get back to where we started; hope this fixes it! + $self->_do_in_dir( ".", sub { + ExtUtils::Install::install( + $self->install_map, $self->verbose, 0, $self->{args}{uninst}||0 + ); + }); + if ($self->_is_ActivePerl && $self->{_completed_actions}{html}) { + $self->log_info("Building ActivePerl Table of Contents\n"); + eval { ActivePerl::DocTools::WriteTOC(verbose => $self->verbose ? 1 : 0); 1; } + or $self->log_warn("AP::DT:: WriteTOC() failed: $@"); + } + if ($self->_is_ActivePPM) { + # We touch 'lib/perllocal.pod'. There is an existing logic in subroutine _init_db() + # of 'ActivePerl/PPM/InstallArea.pm' that says that if 'lib/perllocal.pod' has a 'date-last-touched' + # greater than that of the PPM SQLite databases ('etc/ppm-perl-area.db' and/or + # 'site/etc/ppm-site-area.db') then the PPM SQLite databases are rebuilt from scratch. + + # in the following line, 'perllocal.pod' this is *always* 'lib/perllocal.pod', never 'site/lib/perllocal.pod' + my $F_perllocal = File::Spec->catfile($self->install_sets('core', 'lib'), 'perllocal.pod'); + my $dt_stamp = time; + + $self->log_info("For ActivePerl's PPM: touch '$F_perllocal'\n"); + + open my $perllocal, ">>", $F_perllocal; + close $perllocal; + utime($dt_stamp, $dt_stamp, $F_perllocal); + } } sub ACTION_fakeinstall { @@ -3398,8 +3614,13 @@ sub ACTION_installdeps { # relative command should be relative to our active Perl # so we need to locate that command if ( ! File::Spec->file_name_is_absolute( $command ) ) { + # prefer site to vendor to core + my @loc = ( 'site', 'vendor', '' ); my @bindirs = File::Basename::dirname($self->perl); - push @bindirs, map {$self->config->{"install${_}bin"}} '','site','vendor'; + push @bindirs, + map { + ($self->config->{"install${_}bin"}, $self->config->{"install${_}script"}) + } @loc; for my $d ( @bindirs ) { my $abs_cmd = $self->find_command(File::Spec->catfile( $d, $command )); if ( defined $abs_cmd ) { @@ -3484,7 +3705,6 @@ sub ACTION_ppmdist { } foreach my $type ( qw(bin lib) ) { - local $self->{properties}{html_css} = 'Active.css'; $self->htmlify_pods( $type, File::Spec->catdir($ppm, 'blib', 'html') ); } @@ -3618,7 +3838,7 @@ sub _sign_dir { sub _do_in_dir { my ($self, $dir, $do) = @_; - my $start_dir = $self->cwd; + my $start_dir = File::Spec->rel2abs($self->cwd); chdir $dir or die "Can't chdir() to $dir: $!"; eval {$do->()}; my @err = $@ ? ($@) : (); @@ -3654,7 +3874,11 @@ sub do_create_makefile_pl { my $self = shift; require Module::Build::Compat; $self->log_info("Creating Makefile.PL\n"); - Module::Build::Compat->create_makefile_pl($self->create_makefile_pl, $self, @_); + eval { Module::Build::Compat->create_makefile_pl($self->create_makefile_pl, $self, @_) }; + if ( $@ ) { + 1 while unlink 'Makefile.PL'; + die "$@\n"; + } $self->_add_to_manifest('MANIFEST', 'Makefile.PL'); } @@ -3668,19 +3892,17 @@ sub do_create_license { } my $l = $self->license - or die "No license specified"; - - my $key = $self->valid_licenses->{$l} - or die "'$l' isn't a license key we know about"; - my $class = "Software::License::$key"; + or die "Can't create LICENSE file: No license specified\n"; - eval "use $class; 1" - or die "Can't load Software::License::$key to create LICENSE file: $@"; + my $license = $self->_software_license_object + or die << "HERE"; +Can't create LICENSE file: '$l' is not a valid license key +or Software::License subclass; +HERE $self->delete_filetree('LICENSE'); my $author = join " & ", @{ $self->dist_author }; - my $license = $class->new({holder => $author}); my $fh = IO::File->new('> LICENSE') or die "Can't write LICENSE file: $!"; print $fh $license->fulltext; @@ -3779,9 +4001,6 @@ sub ACTION_distdir { $self->depends_on('distmeta'); - # Must not include MYMETA - $self->_check_mymeta_skip('MANIFEST.SKIP'); - my $dist_files = $self->_read_manifest('MANIFEST') or die "Can't create distdir without a MANIFEST file - run 'manifest' action first.\n"; delete $dist_files->{SIGNATURE}; # Don't copy, create a fresh one @@ -3797,6 +4016,7 @@ sub ACTION_distdir { $self->add_to_cleanup($dist_dir); foreach my $file (keys %$dist_files) { + next if $file =~ m{^MYMETA\.}; # Double check that we skip MYMETA.* my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0); } @@ -3824,6 +4044,22 @@ sub ACTION_disttest { }); } +sub ACTION_distinstall { + my ($self, @args) = @_; + + $self->depends_on('distdir'); + + $self->_do_in_dir ( $self->dist_dir, + sub { + $self->run_perl_script('Build.PL') + or die "Error executing 'Build.PL' in dist directory: $!"; + $self->run_perl_script('Build') + or die "Error executing 'Build' in dist directory: $!"; + $self->run_perl_script('Build', [], ['install']) + or die "Error executing 'Build install' in dist directory"; + } + ); +} =begin private @@ -3882,12 +4118,33 @@ Reads $file and returns the $content. sub _slurp { my $self = shift; my $file = shift; - open my $fh, "<", $file or croak "Can't open $file: $!"; + my $mode = shift || ""; + open my $fh, "<$mode", $file or croak "Can't open $file for reading: $!"; local $/; return <$fh>; } +sub _spew { + my $self = shift; + my $file = shift; + my $content = shift || ""; + my $mode = shift || ""; + open my $fh, ">$mode", $file or croak "Can't open $file for writing: $!"; + print {$fh} $content; + close $fh; +} +sub _case_tolerant { + my $self = shift; + if ( ref $self ) { + $self->{_case_tolerant} = File::Spec->case_tolerant + unless defined($self->{_case_tolerant}); + return $self->{_case_tolerant}; + } + else { + return File::Spec->case_tolerant; + } +} sub _append_maniskip { my $self = shift; @@ -3942,7 +4199,7 @@ sub _check_manifest_skip { if ( ! -e $maniskip ) { $self->log_warn("File '$maniskip' does not exist: Creating a temporary '$maniskip'\n"); $self->_write_default_maniskip($maniskip); - $self->add_to_cleanup($maniskip); + $self->_unlink_on_exit($maniskip); } else { # MYMETA must not be added to MANIFEST, so always confirm the skip @@ -3962,14 +4219,28 @@ sub ACTION_manifest { ExtUtils::Manifest::mkmanifest(); } +sub ACTION_manifest_skip { + my ($self) = @_; + + if ( -e 'MANIFEST.SKIP' ) { + $self->log_warn("MANIFEST.SKIP already exists.\n"); + return 0; + } + $self->log_info("Creating a new MANIFEST.SKIP file\n"); + return $self->_write_default_maniskip; + return -e 'MANIFEST.SKIP' +} + # Case insensitive regex for files sub file_qr { - return File::Spec->case_tolerant ? qr($_[0])i : qr($_[0]); + return shift->{_case_tolerant} ? qr($_[0])i : qr($_[0]); } sub dist_dir { my ($self) = @_; - return join "-", $self->dist_name, $self->dist_version; + my $dir = join "-", $self->dist_name, $self->dist_version; + $dir .= "-" . $self->dist_suffix if $self->dist_suffix; + return $dir; } sub ppm_name { @@ -4067,13 +4338,13 @@ sub script_files { } my %pl_files = map { - File::Spec->canonpath( File::Spec->case_tolerant ? uc $_ : $_ ) => 1 + File::Spec->canonpath( $_ ) => 1 } keys %{ $self->PL_files || {} }; my @bin_files = $self->_files_in('bin'); my %bin_map = map { - $_ => File::Spec->canonpath( File::Spec->case_tolerant ? uc $_ : $_ ) + $_ => File::Spec->canonpath( $_ ) } @bin_files; return $_ = { map {$_ => 1} grep !$pl_files{$bin_map{$_}}, @bin_files }; @@ -4132,6 +4403,31 @@ BEGIN { *scripts = \&script_files; } } } +# use mapping or license name directly +sub _software_license_object { + my ($self) = @_; + return unless defined( my $license = $self->license ); + + my $class; + LICENSE: for my $l ( $self->valid_licenses->{ $license }, $license ) { + next unless defined $l; + my $trial = "Software::License::" . $l; + if ( eval "require Software::License; Software::License->VERSION(0.014); require $trial; 1" ) { + $class = $trial; + last LICENSE; + } + } + return unless defined $class; + + # Software::License requires a 'holder' argument + my $sl = eval { $class->new({holder=>"nobody"}) }; + if ( $@ ) { + $self->log_warn( "Error getting '$class' object: $@" ); + } + + return $sl; +} + sub _hash_merge { my ($self, $h, $k, $v) = @_; if (ref $h->{$k} eq 'ARRAY') { @@ -4145,7 +4441,6 @@ sub _hash_merge { sub ACTION_distmeta { my ($self) = @_; - $self->do_create_makefile_pl if $self->create_makefile_pl; $self->do_create_readme if $self->create_readme; $self->do_create_license if $self->create_license; @@ -4163,9 +4458,6 @@ sub do_create_metafile { $self->log_warn("No license specified, setting license = 'unknown'\n"); $p->{license} = 'unknown'; } - unless (exists $self->valid_licenses->{ $p->{license} }) { - die "Unknown license type '$p->{license}'"; - } # If we're in the distdir, the metafile may exist and be non-writable. $self->delete_filetree($metafile); @@ -4179,7 +4471,11 @@ sub do_create_metafile { push @INC, File::Spec->catdir($self->blib, 'lib'); } - if ($self->write_metafile($self->metafile,$self->get_metadata(fatal=>1))){ + if ( + $self->write_metafile( + $self->metafile,$self->get_metadata(fatal=>1, auto => 1) + ) + ){ $self->{wrote_metadata} = 1; $self->_add_to_manifest('MANIFEST', $metafile); } @@ -4187,37 +4483,30 @@ sub do_create_metafile { return 1; } +# We handle slurping from the metafile to ensure proper utf8 if possible sub read_metafile { my $self = shift; my ($metafile) = @_; - my $yaml; - my $class = $self->_mb_feature('YAML_support') - ? 'YAML::Tiny' : 'Module::Build::YAML' ; + return unless $self->try_require("CPAN::Meta::YAML", "0.002"); - eval "require $class; 1" or die $@; - my $meta = $class->read($metafile) - or $self->log_warn( "Error reading '$metafile': " . $class->errstr . "\n"); + my $string = $self->_slurp($metafile, $] < 5.8 ? "" : ":utf8"); + my $meta = CPAN::Meta::YAML->read_string($string) + or $self->log_warn( "Error parsing '$metafile': " . CPAN::Meta::YAML->errstr . "\n"); return $meta->[0] || {}; } +# We handle spewing to the metafile to ensure proper utf8 if possible sub write_metafile { my $self = shift; my ($metafile, $node) = @_; - my $yaml; - if ($self->_mb_feature('YAML_support')) { - # XXX this is probably redundant, but stick with it - require YAML::Tiny; - $yaml = YAML::Tiny->new($node); - } else { - require Module::Build::YAML; - $yaml = Module::Build::YAML->new($node); - } - my $result = $yaml->write($metafile) - or $self->log_warn( "Error writing '$metafile': " . $yaml->errstr . "\n"); - return $result; + return unless $self->try_require("CPAN::Meta::YAML", "0.002"); + + my $yaml = CPAN::Meta::YAML->new($node); + my $string = $yaml->write_string; + return $self->_spew($metafile, $string, $] < 5.8 ? "" : ":utf8") } sub normalize_version { @@ -4279,6 +4568,8 @@ sub prepare_metadata { my $fatal = $args->{fatal} || 0; my $p = $self->{properties}; + $self->auto_config_requires if $args->{auto}; + # A little helper sub my $add_node = sub { my ($name, $val) = @_; @@ -4286,11 +4577,11 @@ sub prepare_metadata { push @$keys, $name if $keys; }; - foreach (qw(dist_name dist_version dist_author dist_abstract license)) { - (my $name = $_) =~ s/^dist_//; - $add_node->($name, $self->$_()); - unless ( defined($node->{$name}) && length($node->{$name}) ) { - my $err = "ERROR: Missing required field '$_' for metafile\n"; + # validate required fields + foreach my $f (qw(dist_name dist_version dist_author dist_abstract license)) { + my $field = $self->$f(); + unless ( defined $field and length $field ) { + my $err = "ERROR: Missing required field '$f' for metafile\n"; if ( $fatal ) { die $err; } @@ -4299,33 +4590,46 @@ sub prepare_metadata { } } } + + + # add dist_* fields + foreach my $f (qw(dist_name dist_version dist_author dist_abstract)) { + (my $name = $f) =~ s/^dist_//; + $add_node->($name, $self->$f()); + } + + # normalize version $node->{version} = $self->normalize_version($node->{version}); - if (defined( my $l = $self->license )) { - unless ( exists $self->valid_licenses->{ $l } ) { - my $err = "Unknown license string '$l'"; - if ( $fatal ) { - die $err; - } - else { - $self->log_warn($err); - } - } + # validate license information + my $license = $self->license; + my ($meta_license, $meta_license_url); - if (my $key = $self->valid_licenses->{ $l }) { - my $class = "Software::License::$key"; - if (eval "require Software::License; require $class; 1") { - # S::L requires a 'holder' key - $node->{resources}{license} = $class->new({holder=>"nobody"})->url; - } - else { - $node->{resources}{license} = $self->_license_url($l); - } - } - # XXX we are silently omitting the url for any unknown license + # XXX this is still meta spec version 1 stuff + + # if Software::License::* exists, then we can use it to get normalized name + # for META files + + if ( my $sl = $self->_software_license_object ) { + $meta_license = $sl->meta_name; + $meta_license_url = $sl->url; + } + elsif ( exists $self->valid_licenses()->{$license} ) { + $meta_license = $license; + $meta_license_url = $self->_license_url( $license ); + } + else { + # if we didn't find a license from a Software::License class, + # then treat it as unknown + $self->log_warn( "Can not determine license type for '" . $self->license + . "'\nSetting META license field to 'unknown'.\n"); + $meta_license = 'unknown'; } + $node->{license} = $meta_license; + $node->{resources}{license} = $meta_license_url if defined $meta_license_url; + # add prerequisite data my $prereqs = $self->_normalize_prereqs; for my $t ( keys %$prereqs ) { $add_node->($t, $prereqs->{$t}); @@ -4802,6 +5106,13 @@ sub install_map { my $localdir = File::Spec->catdir( $blib, $type ); next unless -e $localdir; + # the line "...next if (($type eq 'bindoc'..." was one of many changes introduced for + # improving HTML generation on ActivePerl, see https://rt.cpan.org/Public/Bug/Display.html?id=53478 + # Most changes were ok, but this particular line caused test failures in t/manifypods.t on windows, + # therefore it is commented out. + + # ********* next if (($type eq 'bindoc' || $type eq 'libdoc') && not $self->is_unixish); + if (my $dest = $self->install_destination($type)) { $map{$localdir} = $dest; } else { @@ -5245,7 +5556,7 @@ sub dir_contains { return 0 if @second_dirs < @first_dirs; - my $is_same = ( File::Spec->case_tolerant + my $is_same = ( $self->_case_tolerant ? sub {lc(shift()) eq lc(shift())} : sub {shift() eq shift()} ); diff --git a/cpan/Module-Build/lib/Module/Build/Compat.pm b/cpan/Module-Build/lib/Module/Build/Compat.pm index d078c37..fa92296 100644 --- a/cpan/Module-Build/lib/Module/Build/Compat.pm +++ b/cpan/Module-Build/lib/Module/Build/Compat.pm @@ -2,7 +2,7 @@ package Module::Build::Compat; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; use File::Basename (); use File::Spec; @@ -65,10 +65,6 @@ my %macro_to_build = %makefile_to_build; # "LIB=foo make" is not the same as "perl Makefile.PL LIB=foo" delete $macro_to_build{LIB}; -sub _simple_prereq { - return $_[0] =~ /^[0-9_]+\.?[0-9_]*$/; # crudly, a decimal literal -} - sub _merge_prereq { my ($req, $breq) = @_; $req ||= {}; @@ -78,8 +74,18 @@ sub _merge_prereq { for my $p ( $req, $breq ) { for my $k (keys %$p) { next if $k eq 'perl'; - die "Prereq '$p->{$k}' for '$k' is not supported by Module::Build::Compat\n" - unless _simple_prereq($p->{$k}); + + my $v_obj = eval { Module::Build::Version->new($p->{$k}) }; + if ( ! defined $v_obj ) { + die "A prereq of the form '$p->{$k}' for '$k' is not supported by Module::Build::Compat ( use a simpler version like '0.05' or 'v1.4.25' )\n"; + } + + # It seems like a lot of people trip over "0.1.2" stuff, so we help them here... + if ( $v_obj->is_qv ) { + my $proper_ver = $v_obj->numify; + warn "Dotted-decimal prereq '$p->{$k}' for '$k' is not portable - converting it to '$proper_ver'\n"; + $p->{$k} = $proper_ver; + } } } # merge @@ -201,7 +207,7 @@ EOF } elsif ($type eq 'traditional') { my (%MM_Args, %prereq); - if (eval "use Tie::IxHash; 1") { + if (eval "use Tie::IxHash 1.2; 1") { tie %MM_Args, 'Tie::IxHash'; # Don't care if it fails here tie %prereq, 'Tie::IxHash'; # Don't care if it fails here } @@ -444,7 +450,6 @@ __END__ Module::Build::Compat - Compatibility with ExtUtils::MakeMaker - =head1 SYNOPSIS # In a Build.PL : diff --git a/cpan/Module-Build/lib/Module/Build/Config.pm b/cpan/Module-Build/lib/Module/Build/Config.pm index 40f2c30..b9e1ceb 100644 --- a/cpan/Module-Build/lib/Module/Build/Config.pm +++ b/cpan/Module-Build/lib/Module/Build/Config.pm @@ -2,7 +2,7 @@ package Module::Build::Config; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Config; diff --git a/cpan/Module-Build/lib/Module/Build/ConfigData.pm b/cpan/Module-Build/lib/Module/Build/ConfigData.pm index 15114ee..85fa28d 100644 --- a/cpan/Module-Build/lib/Module/Build/ConfigData.pm +++ b/cpan/Module-Build/lib/Module/Build/ConfigData.pm @@ -181,12 +181,6 @@ do{ my $x = [ }, 'description' => 'Bundle Module::Build in inc/' }, - 'YAML_support' => { - 'requires' => { - 'YAML::Tiny' => '1.38' - }, - 'description' => 'Use YAML::Tiny to write META.yml files' - }, 'manpage_support' => { 'requires' => { 'Pod::Man' => 0 diff --git a/cpan/Module-Build/lib/Module/Build/Cookbook.pm b/cpan/Module-Build/lib/Module/Build/Cookbook.pm index 56d5a84..4ab5714 100644 --- a/cpan/Module-Build/lib/Module/Build/Cookbook.pm +++ b/cpan/Module-Build/lib/Module/Build/Cookbook.pm @@ -1,7 +1,7 @@ package Module::Build::Cookbook; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; =head1 NAME diff --git a/cpan/Module-Build/lib/Module/Build/Dumper.pm b/cpan/Module-Build/lib/Module/Build/Dumper.pm index 09dd59a..b89f21d 100644 --- a/cpan/Module-Build/lib/Module/Build/Dumper.pm +++ b/cpan/Module-Build/lib/Module/Build/Dumper.pm @@ -1,7 +1,7 @@ package Module::Build::Dumper; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; # This is just a split-out of a wrapper function to do Data::Dumper # stuff "the right way". See: diff --git a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm index 531d13b..2ee9fae 100644 --- a/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm +++ b/cpan/Module-Build/lib/Module/Build/ModuleInfo.pm @@ -2,390 +2,13 @@ # vim:ts=8:sw=2:et:sta:sts=2 package Module::Build::ModuleInfo; -# This module provides routines to gather information about -# perl modules (assuming this may be expanded in the distant -# parrot future to look at other types of modules). - use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; -use File::Spec; -use IO::File; -use Module::Build::Version; - -my $V_NUM_REGEXP = qr{v?[0-9._]+}; # crudely, a v-string or decimal - -my $PKG_REGEXP = qr{ # match a package declaration - ^[\s\{;]* # intro chars on a line - package # the word 'package' - \s+ # whitespace - ([\w:]+) # a package name - \s* # optional whitespace - ($V_NUM_REGEXP)? # optional version number - \s* # optional whitesapce - ; # semicolon line terminator -}x; - -my $VARNAME_REGEXP = qr{ # match fully-qualified VERSION name - ([\$*]) # sigil - $ or * - ( - ( # optional leading package name - (?:::|\')? # possibly starting like just :: (Ì la $::VERSION) - (?:\w+(?:::|\'))* # Foo::Bar:: ... - )? - VERSION - )\b -}x; - -my $VERS_REGEXP = qr{ # match a VERSION definition - (?: - \(\s*$VARNAME_REGEXP\s*\) # with parens - | - $VARNAME_REGEXP # without parens - ) - \s* - =[^=~] # = but not ==, nor =~ -}x; - - -sub new_from_file { - my $class = shift; - my $filename = File::Spec->rel2abs( shift ); - - return undef unless defined( $filename ) && -f $filename; - return $class->_init(undef, $filename, @_); -} - -sub new_from_module { - my $class = shift; - my $module = shift; - my %props = @_; - - $props{inc} ||= \@INC; - my $filename = $class->find_module_by_name( $module, $props{inc} ); - return undef unless defined( $filename ) && -f $filename; - return $class->_init($module, $filename, %props); -} - -sub _init { - my $class = shift; - my $module = shift; - my $filename = shift; - my %props = @_; - - my( %valid_props, @valid_props ); - @valid_props = qw( collect_pod inc ); - @valid_props{@valid_props} = delete( @props{@valid_props} ); - warn "Unknown properties: @{[keys %props]}\n" if scalar( %props ); - - my %data = ( - module => $module, - filename => $filename, - version => undef, - packages => [], - versions => {}, - pod => {}, - pod_headings => [], - collect_pod => 0, - - %valid_props, - ); - - my $self = bless(\%data, $class); - - $self->_parse_file(); - - unless($self->{module} and length($self->{module})) { - my ($v, $d, $f) = File::Spec->splitpath($self->{filename}); - if($f =~ /\.pm$/) { - $f =~ s/\..+$//; - my @candidates = grep /$f$/, @{$self->{packages}}; - $self->{module} = shift(@candidates); # punt - } - else { - if(grep /main/, @{$self->{packages}}) { - $self->{module} = 'main'; - } - else { - $self->{module} = $self->{packages}[0] || ''; - } - } - } - - $self->{version} = $self->{versions}{$self->{module}} - if defined( $self->{module} ); - - return $self; -} - -# class method -sub _do_find_module { - my $class = shift; - my $module = shift || die 'find_module_by_name() requires a package name'; - my $dirs = shift || \@INC; - - my $file = File::Spec->catfile(split( /::/, $module)); - foreach my $dir ( @$dirs ) { - my $testfile = File::Spec->catfile($dir, $file); - return [ File::Spec->rel2abs( $testfile ), $dir ] - if -e $testfile and !-d _; # For stuff like ExtUtils::xsubpp - return [ File::Spec->rel2abs( "$testfile.pm" ), $dir ] - if -e "$testfile.pm"; - } - return; -} - -# class method -sub find_module_by_name { - my $found = shift()->_do_find_module(@_) or return; - return $found->[0]; -} - -# class method -sub find_module_dir_by_name { - my $found = shift()->_do_find_module(@_) or return; - return $found->[1]; -} - - -# given a line of perl code, attempt to parse it if it looks like a -# $VERSION assignment, returning sigil, full name, & package name -sub _parse_version_expression { - my $self = shift; - my $line = shift; - - my( $sig, $var, $pkg ); - if ( $line =~ $VERS_REGEXP ) { - ( $sig, $var, $pkg ) = $2 ? ( $1, $2, $3 ) : ( $4, $5, $6 ); - if ( $pkg ) { - $pkg = ($pkg eq '::') ? 'main' : $pkg; - $pkg =~ s/::$//; - } - } - - return ( $sig, $var, $pkg ); -} - -sub _parse_file { - my $self = shift; - - my $filename = $self->{filename}; - my $fh = IO::File->new( $filename ) - or die( "Can't open '$filename': $!" ); - - $self->_parse_fh($fh); -} - -sub _parse_fh { - my ($self, $fh) = @_; - - my( $in_pod, $seen_end, $need_vers ) = ( 0, 0, 0 ); - my( @pkgs, %vers, %pod, @pod ); - my $pkg = 'main'; - my $pod_sect = ''; - my $pod_data = ''; - - while (defined( my $line = <$fh> )) { - my $line_num = $.; - - chomp( $line ); - next if $line =~ /^\s*#/; - - $in_pod = ($line =~ /^=(?!cut)/) ? 1 : ($line =~ /^=cut/) ? 0 : $in_pod; - - # Would be nice if we could also check $in_string or something too - last if !$in_pod && $line =~ /^__(?:DATA|END)__$/; - - if ( $in_pod || $line =~ /^=cut/ ) { - - if ( $line =~ /^=head\d\s+(.+)\s*$/ ) { - push( @pod, $1 ); - if ( $self->{collect_pod} && length( $pod_data ) ) { - $pod{$pod_sect} = $pod_data; - $pod_data = ''; - } - $pod_sect = $1; - - - } elsif ( $self->{collect_pod} ) { - $pod_data .= "$line\n"; - - } - - } else { - - $pod_sect = ''; - $pod_data = ''; - - # parse $line to see if it's a $VERSION declaration - my( $vers_sig, $vers_fullname, $vers_pkg ) = - $self->_parse_version_expression( $line ); - - if ( $line =~ $PKG_REGEXP ) { - $pkg = $1; - push( @pkgs, $pkg ) unless grep( $pkg eq $_, @pkgs ); - $vers{$pkg} = (defined $2 ? $2 : undef) unless exists( $vers{$pkg} ); - $need_vers = defined $2 ? 0 : 1; - - # VERSION defined with full package spec, i.e. $Module::VERSION - } elsif ( $vers_fullname && $vers_pkg ) { - push( @pkgs, $vers_pkg ) unless grep( $vers_pkg eq $_, @pkgs ); - $need_vers = 0 if $vers_pkg eq $pkg; - - unless ( defined $vers{$vers_pkg} && length $vers{$vers_pkg} ) { - $vers{$vers_pkg} = - $self->_evaluate_version_line( $vers_sig, $vers_fullname, $line ); - } else { - # Warn unless the user is using the "$VERSION = eval - # $VERSION" idiom (though there are probably other idioms - # that we should watch out for...) - warn <<"EOM" unless $line =~ /=\s*eval/; -Package '$vers_pkg' already declared with version '$vers{$vers_pkg}', -ignoring subsequent declaration on line $line_num. -EOM - } - - # first non-comment line in undeclared package main is VERSION - } elsif ( !exists($vers{main}) && $pkg eq 'main' && $vers_fullname ) { - $need_vers = 0; - my $v = - $self->_evaluate_version_line( $vers_sig, $vers_fullname, $line ); - $vers{$pkg} = $v; - push( @pkgs, 'main' ); - - # first non-comment line in undeclared package defines package main - } elsif ( !exists($vers{main}) && $pkg eq 'main' && $line =~ /\w+/ ) { - $need_vers = 1; - $vers{main} = ''; - push( @pkgs, 'main' ); - - # only keep if this is the first $VERSION seen - } elsif ( $vers_fullname && $need_vers ) { - $need_vers = 0; - my $v = - $self->_evaluate_version_line( $vers_sig, $vers_fullname, $line ); - - - unless ( defined $vers{$pkg} && length $vers{$pkg} ) { - $vers{$pkg} = $v; - } else { - warn <<"EOM"; -Package '$pkg' already declared with version '$vers{$pkg}' -ignoring new version '$v' on line $line_num. -EOM - } - - } - - } - - } - - if ( $self->{collect_pod} && length($pod_data) ) { - $pod{$pod_sect} = $pod_data; - } - - $self->{versions} = \%vers; - $self->{packages} = \@pkgs; - $self->{pod} = \%pod; - $self->{pod_headings} = \@pod; -} - -{ -my $pn = 0; -sub _evaluate_version_line { - my $self = shift; - my( $sigil, $var, $line ) = @_; - - # Some of this code came from the ExtUtils:: hierarchy. - - # We compile into $vsub because 'use version' would cause - # compiletime/runtime issues with local() - my $vsub; - $pn++; # everybody gets their own package - my $eval = qq{BEGIN { q# Hide from _packages_inside() - #; package Module::Build::ModuleInfo::_version::p$pn; - use Module::Build::Version; - no strict; - - local $sigil$var; - \$$var=undef; - \$vsub = sub { - $line; - \$$var - }; - }}; - - local $^W; - # Try to get the $VERSION - eval $eval; - # some modules say $VERSION = $Foo::Bar::VERSION, but Foo::Bar isn't - # installed, so we need to hunt in ./lib for it - if ( $@ =~ /Can't locate/ && -d 'lib' ) { - local @INC = ('lib',@INC); - eval $eval; - } - warn "Error evaling version line '$eval' in $self->{filename}: $@\n" - if $@; - (ref($vsub) eq 'CODE') or - die "failed to build version sub for $self->{filename}"; - my $result = eval { $vsub->() }; - die "Could not get version from $self->{filename} by executing:\n$eval\n\nThe fatal error was: $@\n" - if $@; - - # Activestate apparently creates custom versions like '1.23_45_01', which - # cause M::B::Version to think it's an invalid alpha. So check for that - # and strip them - my $num_dots = () = $result =~ m{\.}g; - my $num_unders = () = $result =~ m{_}g; - if ( substr($result,0,1) ne 'v' && $num_dots < 2 && $num_unders > 1 ) { - $result =~ s{_}{}g; - } - - # Bless it into our own version class - eval { $result = Module::Build::Version->new($result) }; - die "Version '$result' from $self->{filename} does not appear to be valid:\n$eval\n\nThe fatal error was: $@\n" - if $@; - - return $result; -} -} - - -############################################################ - -# accessors -sub name { $_[0]->{module} } - -sub filename { $_[0]->{filename} } -sub packages_inside { @{$_[0]->{packages}} } -sub pod_inside { @{$_[0]->{pod_headings}} } -sub contains_pod { $#{$_[0]->{pod_headings}} } - -sub version { - my $self = shift; - my $mod = shift || $self->{module}; - my $vers; - if ( defined( $mod ) && length( $mod ) && - exists( $self->{versions}{$mod} ) ) { - return $self->{versions}{$mod}; - } else { - return undef; - } -} - -sub pod { - my $self = shift; - my $sect = shift; - if ( defined( $sect ) && length( $sect ) && - exists( $self->{pod}{$sect} ) ) { - return $self->{pod}{$sect}; - } else { - return undef; - } -} +require Module::Metadata; +our @ISA = qw/Module::Metadata/; 1; @@ -395,97 +18,17 @@ __END__ =head1 NAME -ModuleInfo - Gather package and POD information from a perl module file - +Module::Build::ModuleInfo - DEPRECATED =head1 DESCRIPTION -=over 4 - -=item new_from_file($filename, collect_pod => 1) - -Construct a C object given the path to a file. Takes an optional -argument C which is a boolean that determines whether -POD data is collected and stored for reference. POD data is not -collected by default. POD headings are always collected. - -=item new_from_module($module, collect_pod => 1, inc => \@dirs) - -Construct a C object given a module or package name. In addition -to accepting the C argument as described above, this -method accepts a C argument which is a reference to an array of -of directories to search for the module. If none are given, the -default is @INC. - -=item name() - -Returns the name of the package represented by this module. If there -are more than one packages, it makes a best guess based on the -filename. If it's a script (i.e. not a *.pm) the package name is -'main'. - -=item version($package) - -Returns the version as defined by the $VERSION variable for the -package as returned by the C method if no arguments are -given. If given the name of a package it will attempt to return the -version of that package if it is specified in the file. - -=item filename() - -Returns the absolute path to the file. - -=item packages_inside() - -Returns a list of packages. - -=item pod_inside() - -Returns a list of POD sections. - -=item contains_pod() - -Returns true if there is any POD in the file. - -=item pod($section) - -Returns the POD data in the given section. - -=item find_module_by_name($module, \@dirs) - -Returns the path to a module given the module or package name. A list -of directories can be passed in as an optional parameter, otherwise -@INC is searched. - -Can be called as either an object or a class method. - -=item find_module_dir_by_name($module, \@dirs) - -Returns the entry in C<@dirs> (or C<@INC> by default) that contains -the module C<$module>. A list of directories can be passed in as an -optional parameter, otherwise @INC is searched. - -Can be called as either an object or a class method. - -=back - - -=head1 AUTHOR - -Ken Williams , Randy W. Sims - - -=head1 COPYRIGHT - -Copyright (c) 2001-2006 Ken Williams. All rights reserved. - -This library is free software; you can redistribute it and/or -modify it under the same terms as Perl itself. - +This module has been extracted into a separate distribution and renamed +L. This module is kept as a subclass wrapper for +compatibility. =head1 SEE ALSO -perl(1), L(3) +perl(1), L, L =cut diff --git a/cpan/Module-Build/lib/Module/Build/Notes.pm b/cpan/Module-Build/lib/Module/Build/Notes.pm index 5b1e95a..3d9e56c 100644 --- a/cpan/Module-Build/lib/Module/Build/Notes.pm +++ b/cpan/Module-Build/lib/Module/Build/Notes.pm @@ -4,7 +4,7 @@ package Module::Build::Notes; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Data::Dumper; use IO::File; diff --git a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm index ed6b4a3..a683b56 100644 --- a/cpan/Module-Build/lib/Module/Build/PPMMaker.pm +++ b/cpan/Module-Build/lib/Module/Build/PPMMaker.pm @@ -5,7 +5,7 @@ use Config; use vars qw($VERSION); use IO::File; -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; # This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a @@ -154,7 +154,6 @@ __END__ Module::Build::PPMMaker - Perl Package Manager file creation - =head1 SYNOPSIS On the command line, builds a .ppd file: diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm b/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm index c825fc8..d4fed10 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Amiga; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm index 79c391b..b19f2ed 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Default.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Default.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Default; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm b/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm index a0ee31e..0bd5a70 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::EBCDIC; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm b/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm index 25a0aa5..cb0a42b 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::MPEiX; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm index 85572f0..9af367a 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::MacOS; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; use vars qw(@ISA); diff --git a/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm index eb434b8..fc746ba 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::RiscOS; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm index 5f51882..2db3adf 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Unix.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Unix; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm index 15394dd..5f6d3e8 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VMS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::VMS; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; use Config; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm index 452f2f3..98f1151 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/VOS.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::VOS; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Base; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm index 18de060..3e13e72 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/Windows.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::Windows; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Config; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm index 212a5ca..03dfb1e 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/aix.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/aix.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::aix; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm index 7d5573d..6e06b7b 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::cygwin; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; @@ -14,7 +14,7 @@ sub manpage_separator { } # Copied from ExtUtils::MM_Cygwin::maybe_command() -# If our path begins with F then we use C +# If our path begins with F then we use the Windows version # to determine if it may be a command. Otherwise we use the tests # from C. @@ -22,8 +22,8 @@ sub _maybe_command { my ($self, $file) = @_; if ($file =~ m{^/cygdrive/}i) { - require Module::Build::Platform::Win32; - return Module::Build::Platform::Win32->_maybe_command($file); + require Module::Build::Platform::Windows; + return Module::Build::Platform::Windows->_maybe_command($file); } return $self->SUPER::_maybe_command($file); diff --git a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm index 9ae176d..3b6b482 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/darwin.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::darwin; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm index af1c290..310900a 100644 --- a/cpan/Module-Build/lib/Module/Build/Platform/os2.pm +++ b/cpan/Module-Build/lib/Module/Build/Platform/os2.pm @@ -2,7 +2,7 @@ package Module::Build::Platform::os2; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Module::Build::Platform::Unix; diff --git a/cpan/Module-Build/lib/Module/Build/PodParser.pm b/cpan/Module-Build/lib/Module/Build/PodParser.pm index 7aa66bd..2684401 100644 --- a/cpan/Module-Build/lib/Module/Build/PodParser.pm +++ b/cpan/Module-Build/lib/Module/Build/PodParser.pm @@ -2,7 +2,7 @@ package Module::Build::PodParser; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use vars qw(@ISA); diff --git a/cpan/Module-Build/lib/Module/Build/Version.pm b/cpan/Module-Build/lib/Module/Build/Version.pm index 21abe00..e659712 100644 --- a/cpan/Module-Build/lib/Module/Build/Version.pm +++ b/cpan/Module-Build/lib/Module/Build/Version.pm @@ -1,684 +1,21 @@ package Module::Build::Version; use strict; - use vars qw($VERSION); -$VERSION = 0.77; - -eval "use version $VERSION"; -if ($@) { # can't locate version files, use our own - - # Avoid redefined warnings if an old version.pm was available - delete $version::{$_} foreach keys %version::; - - # first we get the stub version module - my $version; - while () { - s/(\$VERSION)\s=\s\d+/\$VERSION = 0/; - $version .= $_ if $_; - last if /^1;$/; - } - - # and now get the current version::vpp code - my $vpp; - while () { - s/(\$VERSION)\s=\s\d+/\$VERSION = 0/; - $vpp .= $_ if $_; - last if /^1;$/; - } - - # but we eval them in reverse order since version depends on - # version::vpp to already exist - eval $vpp; die $@ if $@; - $INC{'version/vpp.pm'} = 'inside Module::Build::Version'; - eval $version; die $@ if $@; - $INC{'version.pm'} = 'inside Module::Build::Version'; -} - -# now we can safely subclass version, installed or not -use vars qw(@ISA); -@ISA = qw(version); - -1; -__DATA__ -# stub version module to make everything else happy -package version; - -use 5.005_04; -use strict; - -use vars qw(@ISA $VERSION $CLASS *declare *qv); - -$VERSION = 0.77; - -$CLASS = 'version'; - -push @ISA, "version::vpp"; -local $^W; -*version::qv = \&version::vpp::qv; -*version::declare = \&version::vpp::declare; -*version::_VERSION = \&version::vpp::_VERSION; -if ($] > 5.009001 && $] <= 5.010000) { - no strict 'refs'; - *{'version::stringify'} = \*version::vpp::stringify; - *{'version::(""'} = \*version::vpp::stringify; - *{'version::new'} = \*version::vpp::new; -} - -# Preloaded methods go here. -sub import { - no strict 'refs'; - my ($class) = shift; - - # Set up any derived class - unless ($class eq 'version') { - local $^W; - *{$class.'::declare'} = \&version::declare; - *{$class.'::qv'} = \&version::qv; - } - - my %args; - if (@_) { # any remaining terms are arguments - map { $args{$_} = 1 } @_ - } - else { # no parameters at all on use line - %args = - ( - qv => 1, - 'UNIVERSAL::VERSION' => 1, - ); - } - - my $callpkg = caller(); - - if (exists($args{declare})) { - *{$callpkg."::declare"} = - sub {return $class->declare(shift) } - unless defined(&{$callpkg.'::declare'}); - } - - if (exists($args{qv})) { - *{$callpkg."::qv"} = - sub {return $class->qv(shift) } - unless defined(&{"$callpkg\::qv"}); - } - - if (exists($args{'UNIVERSAL::VERSION'})) { - local $^W; - *UNIVERSAL::VERSION = \&version::_VERSION; - } +$VERSION = '0.87'; ### XXX sync with version of version.pm below - if (exists($args{'VERSION'})) { - *{$callpkg."::VERSION"} = \&version::_VERSION; - } -} +use version 0.87; +our @ISA = qw(version); 1; -# replace everything from here to the end with the current version/vpp.pm -package version::vpp; -use strict; - -use POSIX qw/locale_h/; -use locale; -use vars qw ($VERSION @ISA @REGEXS); -$VERSION = '0.77'; -$VERSION = eval $VERSION; - -push @REGEXS, qr/ - ^v? # optional leading 'v' - (\d*) # major revision not required - \. # requires at least one decimal - (?:(\d+)\.?){1,} - /x; - -use overload ( - '""' => \&stringify, - '0+' => \&numify, - 'cmp' => \&vcmp, - '<=>' => \&vcmp, - 'bool' => \&vbool, - 'nomethod' => \&vnoop, -); - -my $VERSION_MAX = 0x7FFFFFFF; - -eval "use warnings"; -if ($@) { - eval ' - package warnings; - sub enabled {return $^W;} - 1; - '; -} - -sub new -{ - my ($class, $value) = @_; - my $self = bless ({}, ref ($class) || $class); - - if ( ref($value) && eval('$value->isa("version")') ) { - # Can copy the elements directly - $self->{version} = [ @{$value->{version} } ]; - $self->{qv} = 1 if $value->{qv}; - $self->{alpha} = 1 if $value->{alpha}; - $self->{original} = ''.$value->{original}; - return $self; - } - - my $currlocale = setlocale(LC_ALL); - - # if the current locale uses commas for decimal points, we - # just replace commas with decimal places, rather than changing - # locales - if ( localeconv()->{decimal_point} eq ',' ) { - $value =~ tr/,/./; - } - - if ( not defined $value or $value =~ /^undef$/ ) { - # RT #19517 - special case for undef comparison - # or someone forgot to pass a value - push @{$self->{version}}, 0; - $self->{original} = "0"; - return ($self); - } - - if ( $#_ == 2 ) { # must be CVS-style - $value = 'v'.$_[2]; - } - - $value = _un_vstring($value); - - # exponential notation - if ( $value =~ /\d+.?\d*e[-+]?\d+/ ) { - $value = sprintf("%.9f",$value); - $value =~ s/(0+)$//; # trim trailing zeros - } - - # This is not very efficient, but it is morally equivalent - # to the XS code (as that is the reference implementation). - # See vutil/vutil.c for details - my $qv = 0; - my $alpha = 0; - my $width = 3; - my $saw_period = 0; - my $vinf = 0; - my ($start, $last, $pos, $s); - $s = 0; - - while ( substr($value,$s,1) =~ /\s/ ) { # leading whitespace is OK - $s++; - } - - if (substr($value,$s,1) eq 'v') { - $s++; # get past 'v' - $qv = 1; # force quoted version processing - } - - $start = $last = $pos = $s; - - # pre-scan the input string to check for decimals/underbars - while ( substr($value,$pos,1) =~ /[._\d,]/ ) { - if ( substr($value,$pos,1) eq '.' ) { - if ($alpha) { - Carp::croak("Invalid version format ". - "(underscores before decimal)"); - } - $saw_period++; - $last = $pos; - } - elsif ( substr($value,$pos,1) eq '_' ) { - if ($alpha) { - require Carp; - Carp::croak("Invalid version format ". - "(multiple underscores)"); - } - $alpha = 1; - $width = $pos - $last - 1; # natural width of sub-version - } - elsif ( substr($value,$pos,1) eq ',' - and substr($value,$pos+1,1) =~ /[0-9]/ ) { - # looks like an unhandled locale - $saw_period++; - $last = $pos; - } - $pos++; - } - - if ( $alpha && !$saw_period ) { - require Carp; - Carp::croak("Invalid version format ". - "(alpha without decimal)"); - } - - if ( $alpha && $saw_period && $width == 0 ) { - require Carp; - Carp::croak("Invalid version format ". - "(misplaced _ in number)"); - } - - if ( $saw_period > 1 ) { - $qv = 1; # force quoted version processing - } - - $last = $pos; - $pos = $s; - - if ( $qv ) { - $self->{qv} = 1; - } - - if ( $alpha ) { - $self->{alpha} = 1; - } - - if ( !$qv && $width < 3 ) { - $self->{width} = $width; - } - - while ( substr($value,$pos,1) =~ /\d/ ) { - $pos++; - } - - if ( substr($value,$pos,1) !~ /[a-z]/ ) { ### FIX THIS ### - my $rev; - - while (1) { - $rev = 0; - { - - # this is atoi() that delimits on underscores - my $end = $pos; - my $mult = 1; - my $orev; - - # the following if() will only be true after the decimal - # point of a version originally created with a bare - # floating point number, i.e. not quoted in any way - if ( !$qv && $s > $start && $saw_period == 1 ) { - $mult *= 100; - while ( $s < $end ) { - $orev = $rev; - $rev += substr($value,$s,1) * $mult; - $mult /= 10; - if ( abs($orev) > abs($rev) - || abs($rev) > abs($VERSION_MAX) ) { - if ( warnings::enabled("overflow") ) { - require Carp; - Carp::carp("Integer overflow in version"); - } - $s = $end - 1; - $rev = $VERSION_MAX; - } - $s++; - if ( substr($value,$s,1) eq '_' ) { - $s++; - } - } - } - else { - while (--$end >= $s) { - $orev = $rev; - $rev += substr($value,$end,1) * $mult; - $mult *= 10; - if ( abs($orev) > abs($rev) - || abs($rev) > abs($VERSION_MAX) ) { - if ( warnings::enabled("overflow") ) { - require Carp; - Carp::carp("Integer overflow in version"); - } - $end = $s - 1; - $rev = $VERSION_MAX; - } - } - } - } - - # Append revision - push @{$self->{version}}, $rev; - if ( substr($value,$pos,1) eq '.' - && substr($value,$pos+1,1) =~ /\d/ ) { - $s = ++$pos; - } - elsif ( substr($value,$pos,1) eq '_' - && substr($value,$pos+1,1) =~ /\d/ ) { - $s = ++$pos; - } - elsif ( substr($value,$pos,1) eq ',' - && substr($value,$pos+1,1) =~ /\d/ ) { - $s = ++$pos; - } - elsif ( substr($value,$pos,1) =~ /\d/ ) { - $s = $pos; - } - else { - $s = $pos; - last; - } - if ( $qv ) { - while ( substr($value,$pos,1) =~ /\d/ ) { - $pos++; - } - } - else { - my $digits = 0; - while (substr($value,$pos,1) =~ /[\d_]/ && $digits < 3) { - if ( substr($value,$pos,1) ne '_' ) { - $digits++; - } - $pos++; - } - } - } - } - if ( $qv ) { # quoted versions always get at least three terms - my $len = scalar @{$self->{version}}; - $len = 3 - $len; - while ($len-- > 0) { - push @{$self->{version}}, 0; - } - } - - if ( substr($value,$pos) ) { # any remaining text - if ( warnings::enabled("misc") ) { - require Carp; - Carp::carp("Version string '$value' contains invalid data; ". - "ignoring: '".substr($value,$pos)."'"); - } - } - - # cache the original value for use when stringification - if ( $vinf ) { - $self->{vinf} = 1; - $self->{original} = 'v.Inf'; - } - else { - $self->{original} = substr($value,0,$pos); - } - - return ($self); -} - -*parse = \&new; - -sub numify -{ - my ($self) = @_; - unless (_verify($self)) { - require Carp; - Carp::croak("Invalid version object"); - } - my $width = $self->{width} || 3; - my $alpha = $self->{alpha} || ""; - my $len = $#{$self->{version}}; - my $digit = $self->{version}[0]; - my $string = sprintf("%d.", $digit ); - - for ( my $i = 1 ; $i < $len ; $i++ ) { - $digit = $self->{version}[$i]; - if ( $width < 3 ) { - my $denom = 10**(3-$width); - my $quot = int($digit/$denom); - my $rem = $digit - ($quot * $denom); - $string .= sprintf("%0".$width."d_%d", $quot, $rem); - } - else { - $string .= sprintf("%03d", $digit); - } - } - - if ( $len > 0 ) { - $digit = $self->{version}[$len]; - if ( $alpha && $width == 3 ) { - $string .= "_"; - } - $string .= sprintf("%0".$width."d", $digit); - } - else # $len = 0 - { - $string .= sprintf("000"); - } - - return $string; -} - -sub normal -{ - my ($self) = @_; - unless (_verify($self)) { - require Carp; - Carp::croak("Invalid version object"); - } - my $alpha = $self->{alpha} || ""; - my $len = $#{$self->{version}}; - my $digit = $self->{version}[0]; - my $string = sprintf("v%d", $digit ); - - for ( my $i = 1 ; $i < $len ; $i++ ) { - $digit = $self->{version}[$i]; - $string .= sprintf(".%d", $digit); - } - - if ( $len > 0 ) { - $digit = $self->{version}[$len]; - if ( $alpha ) { - $string .= sprintf("_%0d", $digit); - } - else { - $string .= sprintf(".%0d", $digit); - } - } - - if ( $len <= 2 ) { - for ( $len = 2 - $len; $len != 0; $len-- ) { - $string .= sprintf(".%0d", 0); - } - } - - return $string; -} - -sub stringify -{ - my ($self) = @_; - unless (_verify($self)) { - require Carp; - Carp::croak("Invalid version object"); - } - return exists $self->{original} - ? $self->{original} - : exists $self->{qv} - ? $self->normal - : $self->numify; -} - -sub vcmp -{ - require UNIVERSAL; - my ($left,$right,$swap) = @_; - my $class = ref($left); - unless ( UNIVERSAL::isa($right, $class) ) { - $right = $class->new($right); - } - - if ( $swap ) { - ($left, $right) = ($right, $left); - } - unless (_verify($left)) { - require Carp; - Carp::croak("Invalid version object"); - } - unless (_verify($right)) { - require Carp; - Carp::croak("Invalid version object"); - } - my $l = $#{$left->{version}}; - my $r = $#{$right->{version}}; - my $m = $l < $r ? $l : $r; - my $lalpha = $left->is_alpha; - my $ralpha = $right->is_alpha; - my $retval = 0; - my $i = 0; - while ( $i <= $m && $retval == 0 ) { - $retval = $left->{version}[$i] <=> $right->{version}[$i]; - $i++; - } - - # tiebreaker for alpha with identical terms - if ( $retval == 0 - && $l == $r - && $left->{version}[$m] == $right->{version}[$m] - && ( $lalpha || $ralpha ) ) { - - if ( $lalpha && !$ralpha ) { - $retval = -1; - } - elsif ( $ralpha && !$lalpha) { - $retval = +1; - } - } - - # possible match except for trailing 0's - if ( $retval == 0 && $l != $r ) { - if ( $l < $r ) { - while ( $i <= $r && $retval == 0 ) { - if ( $right->{version}[$i] != 0 ) { - $retval = -1; # not a match after all - } - $i++; - } - } - else { - while ( $i <= $l && $retval == 0 ) { - if ( $left->{version}[$i] != 0 ) { - $retval = +1; # not a match after all - } - $i++; - } - } - } - - return $retval; -} - -sub vbool { - my ($self) = @_; - return vcmp($self,$self->new("0"),1); -} - -sub vnoop { - require Carp; - Carp::croak("operation not supported with version object"); -} - -sub is_alpha { - my ($self) = @_; - return (exists $self->{alpha}); -} - -sub qv { - my $value = shift; - my $class = 'version'; - if (@_) { - $class = ref($value) || $value; - $value = shift; - } - - $value = _un_vstring($value); - $value = 'v'.$value unless $value =~ /(^v|\d+\.\d+\.\d)/; - my $version = $class->new($value); - return $version; -} - -*declare = \&qv; - -sub is_qv { - my ($self) = @_; - return (exists $self->{qv}); -} - - -sub _verify { - my ($self) = @_; - if ( ref($self) - && eval { exists $self->{version} } - && ref($self->{version}) eq 'ARRAY' - ) { - return 1; - } - else { - return 0; - } -} - -sub _un_vstring { - my $value = shift; - # may be a v-string - if ( $] >= 5.006_000 && length($value) >= 3 && $value !~ /[._]/ ) { - my $tvalue = sprintf("v%vd",$value); - if ( $tvalue =~ /^v\d+\.\d+\.\d+$/ ) { - # must be a v-string - $value = $tvalue; - } - } - return $value; -} - -sub _VERSION { - my ($obj, $req) = @_; - my $class = ref($obj) || $obj; - - no strict 'refs'; - if ( exists $INC{"$class.pm"} and not %{"$class\::"} and $] >= 5.008) { - # file but no package - require Carp; - Carp::croak( "$class defines neither package nor VERSION" - ."--version check failed"); - } - - my $version = eval "\$$class\::VERSION"; - if ( defined $version ) { - local $^W if $] <= 5.008; - $version = version::vpp->new($version); - } - - if ( defined $req ) { - unless ( defined $version ) { - require Carp; - my $msg = $] < 5.006 - ? "$class version $req required--this is only version " - : "$class does not define \$$class\::VERSION" - ."--version check failed"; +=head1 NAME - if ( $ENV{VERSION_DEBUG} ) { - Carp::confess($msg); - } - else { - Carp::croak($msg); - } - } +Module::Build::Version - DEPRECATED - $req = version::vpp->new($req); +=head1 DESCRIPTION - if ( $req > $version ) { - require Carp; - if ( $req->is_qv ) { - Carp::croak( - sprintf ("%s version %s required--". - "this is only version %s", $class, - $req->normal, $version->normal) - ); - } - else { - Carp::croak( - sprintf ("%s version %s required--". - "this is only version %s", $class, - $req->stringify, $version->stringify) - ); - } - } - } +Module::Build now lists L as a C dependency +and no longer installs a copy. - return defined $version ? $version->stringify : undef; -} +=cut -1; #this line is important and will help the module return a true value diff --git a/cpan/Module-Build/lib/Module/Build/YAML.pm b/cpan/Module-Build/lib/Module/Build/YAML.pm index 2da91f2..133dee5 100644 --- a/cpan/Module-Build/lib/Module/Build/YAML.pm +++ b/cpan/Module-Build/lib/Module/Build/YAML.pm @@ -1,600 +1,19 @@ -# Adapted from YAML::Tiny 1.40 package Module::Build::YAML; - use strict; -use Carp 'croak'; - -# UTF Support? -sub HAVE_UTF8 () { $] >= 5.007003 } -BEGIN { - if ( HAVE_UTF8 ) { - # The string eval helps hide this from Test::MinimumVersion - eval "require utf8;"; - die "Failed to load UTF-8 support" if $@; - } - - # Class structure - require 5.004; - - $Module::Build::YAML::VERSION = '1.40'; - - # Error storage - $Module::Build::YAML::errstr = ''; -} - -# The character class of all characters we need to escape -# NOTE: Inlined, since it's only used once -# my $RE_ESCAPE = '[\\x00-\\x08\\x0b-\\x0d\\x0e-\\x1f\"\n]'; - -# Printed form of the unprintable characters in the lowest range -# of ASCII characters, listed by ASCII ordinal position. -my @UNPRINTABLE = qw( - z x01 x02 x03 x04 x05 x06 a - x08 t n v f r x0e x0f - x10 x11 x12 x13 x14 x15 x16 x17 - x18 x19 x1a e x1c x1d x1e x1f -); - -# Printable characters for escapes -my %UNESCAPES = ( - z => "\x00", a => "\x07", t => "\x09", - n => "\x0a", v => "\x0b", f => "\x0c", - r => "\x0d", e => "\x1b", '\\' => '\\', -); - -# Special magic boolean words -my %QUOTE = map { $_ => 1 } qw{ - null Null NULL - y Y yes Yes YES n N no No NO - true True TRUE false False FALSE - on On ON off Off OFF -}; - -##################################################################### -# Implementation - -# Create an empty Module::Build::YAML object -sub new { - my $class = shift; - bless [ @_ ], $class; -} - -# Create an object from a file -sub read { - my $class = ref $_[0] ? ref shift : shift; - - # Check the file - my $file = shift or return $class->_error( 'You did not specify a file name' ); - return $class->_error( "File '$file' does not exist" ) unless -e $file; - return $class->_error( "'$file' is a directory, not a file" ) unless -f _; - return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _; - - # Slurp in the file - local $/ = undef; - local *CFG; - unless ( open(CFG, $file) ) { - return $class->_error("Failed to open file '$file': $!"); - } - my $contents = ; - unless ( close(CFG) ) { - return $class->_error("Failed to close file '$file': $!"); - } - - $class->read_string( $contents ); -} - -# Create an object from a string -sub read_string { - my $class = ref $_[0] ? ref shift : shift; - my $self = bless [], $class; - my $string = $_[0]; - unless ( defined $string ) { - return $self->_error("Did not provide a string to load"); - } - - # Byte order marks - # NOTE: Keeping this here to educate maintainers - # my %BOM = ( - # "\357\273\277" => 'UTF-8', - # "\376\377" => 'UTF-16BE', - # "\377\376" => 'UTF-16LE', - # "\377\376\0\0" => 'UTF-32LE' - # "\0\0\376\377" => 'UTF-32BE', - # ); - if ( $string =~ /^(?:\376\377|\377\376|\377\376\0\0|\0\0\376\377)/ ) { - return $self->_error("Stream has a non UTF-8 BOM"); - } else { - # Strip UTF-8 bom if found, we'll just ignore it - $string =~ s/^\357\273\277//; - } - - # Try to decode as utf8 - utf8::decode($string) if HAVE_UTF8; - - # Check for some special cases - return $self unless length $string; - unless ( $string =~ /[\012\015]+\z/ ) { - return $self->_error("Stream does not end with newline character"); - } - - # Split the file into lines - my @lines = grep { ! /^\s*(?:\#.*)?\z/ } - split /(?:\015{1,2}\012|\015|\012)/, $string; - - # Strip the initial YAML header - @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/ and shift @lines; - - # A nibbling parser - while ( @lines ) { - # Do we have a document header? - if ( $lines[0] =~ /^---\s*(?:(.+)\s*)?\z/ ) { - # Handle scalar documents - shift @lines; - if ( defined $1 and $1 !~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/ ) { - push @$self, $self->_read_scalar( "$1", [ undef ], \@lines ); - next; - } - } - - if ( ! @lines or $lines[0] =~ /^(?:---|\.\.\.)/ ) { - # A naked document - push @$self, undef; - while ( @lines and $lines[0] !~ /^---/ ) { - shift @lines; - } - - } elsif ( $lines[0] =~ /^\s*\-/ ) { - # An array at the root - my $document = [ ]; - push @$self, $document; - $self->_read_array( $document, [ 0 ], \@lines ); - - } elsif ( $lines[0] =~ /^(\s*)\S/ ) { - # A hash at the root - my $document = { }; - push @$self, $document; - $self->_read_hash( $document, [ length($1) ], \@lines ); - - } else { - croak("Module::Build::YAML failed to classify the line '$lines[0]'"); - } - } - - $self; -} - -# Deparse a scalar string to the actual scalar -sub _read_scalar { - my ($self, $string, $indent, $lines) = @_; - - # Trim trailing whitespace - $string =~ s/\s*\z//; - - # Explitic null/undef - return undef if $string eq '~'; - - # Quotes - if ( $string =~ /^\'(.*?)\'\z/ ) { - return '' unless defined $1; - $string = $1; - $string =~ s/\'\'/\'/g; - return $string; - } - if ( $string =~ /^\"((?:\\.|[^\"])*)\"\z/ ) { - # Reusing the variable is a little ugly, - # but avoids a new variable and a string copy. - $string = $1; - $string =~ s/\\"/"/g; - $string =~ s/\\([never\\fartz]|x([0-9a-fA-F]{2}))/(length($1)>1)?pack("H2",$2):$UNESCAPES{$1}/gex; - return $string; - } - - # Special cases - if ( $string =~ /^[\'\"!&]/ ) { - croak("Module::Build::YAML does not support a feature in line '$lines->[0]'"); - } - return {} if $string eq '{}'; - return [] if $string eq '[]'; - - # Regular unquoted string - return $string unless $string =~ /^[>|]/; - - # Error - croak("Module::Build::YAML failed to find multi-line scalar content") unless @$lines; - - # Check the indent depth - $lines->[0] =~ /^(\s*)/; - $indent->[-1] = length("$1"); - if ( defined $indent->[-2] and $indent->[-1] <= $indent->[-2] ) { - croak("Module::Build::YAML found bad indenting in line '$lines->[0]'"); - } - - # Pull the lines - my @multiline = (); - while ( @$lines ) { - $lines->[0] =~ /^(\s*)/; - last unless length($1) >= $indent->[-1]; - push @multiline, substr(shift(@$lines), length($1)); - } - - my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n"; - my $t = (substr($string, 1, 1) eq '-') ? '' : "\n"; - return join( $j, @multiline ) . $t; -} - -# Parse an array -sub _read_array { - my ($self, $array, $indent, $lines) = @_; - - while ( @$lines ) { - # Check for a new document - if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { - while ( @$lines and $lines->[0] !~ /^---/ ) { - shift @$lines; - } - return 1; - } - - # Check the indent level - $lines->[0] =~ /^(\s*)/; - if ( length($1) < $indent->[-1] ) { - return 1; - } elsif ( length($1) > $indent->[-1] ) { - croak("Module::Build::YAML found bad indenting in line '$lines->[0]'"); - } - - if ( $lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/ ) { - # Inline nested hash - my $indent2 = length("$1"); - $lines->[0] =~ s/-/ /; - push @$array, { }; - $self->_read_hash( $array->[-1], [ @$indent, $indent2 ], $lines ); - - } elsif ( $lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/ ) { - # Array entry with a value - shift @$lines; - push @$array, $self->_read_scalar( "$2", [ @$indent, undef ], $lines ); - - } elsif ( $lines->[0] =~ /^\s*\-\s*\z/ ) { - shift @$lines; - unless ( @$lines ) { - push @$array, undef; - return 1; - } - if ( $lines->[0] =~ /^(\s*)\-/ ) { - my $indent2 = length("$1"); - if ( $indent->[-1] == $indent2 ) { - # Null array entry - push @$array, undef; - } else { - # Naked indenter - push @$array, [ ]; - $self->_read_array( $array->[-1], [ @$indent, $indent2 ], $lines ); - } - - } elsif ( $lines->[0] =~ /^(\s*)\S/ ) { - push @$array, { }; - $self->_read_hash( $array->[-1], [ @$indent, length("$1") ], $lines ); - - } else { - croak("Module::Build::YAML failed to classify line '$lines->[0]'"); - } - - } elsif ( defined $indent->[-2] and $indent->[-1] == $indent->[-2] ) { - # This is probably a structure like the following... - # --- - # foo: - # - list - # bar: value - # - # ... so lets return and let the hash parser handle it - return 1; - - } else { - croak("Module::Build::YAML failed to classify line '$lines->[0]'"); - } - } - - return 1; -} - -# Parse an array -sub _read_hash { - my ($self, $hash, $indent, $lines) = @_; - - while ( @$lines ) { - # Check for a new document - if ( $lines->[0] =~ /^(?:---|\.\.\.)/ ) { - while ( @$lines and $lines->[0] !~ /^---/ ) { - shift @$lines; - } - return 1; - } - - # Check the indent level - $lines->[0] =~ /^(\s*)/; - if ( length($1) < $indent->[-1] ) { - return 1; - } elsif ( length($1) > $indent->[-1] ) { - croak("Module::Build::YAML found bad indenting in line '$lines->[0]'"); - } - - # Get the key - unless ( $lines->[0] =~ s/^\s*([^\'\" ][^\n]*?)\s*:(\s+|$)// ) { - if ( $lines->[0] =~ /^\s*[?\'\"]/ ) { - croak("Module::Build::YAML does not support a feature in line '$lines->[0]'"); - } - croak("Module::Build::YAML failed to classify line '$lines->[0]'"); - } - my $key = $1; - - # Do we have a value? - if ( length $lines->[0] ) { - # Yes - $hash->{$key} = $self->_read_scalar( shift(@$lines), [ @$indent, undef ], $lines ); - } else { - # An indent - shift @$lines; - unless ( @$lines ) { - $hash->{$key} = undef; - return 1; - } - if ( $lines->[0] =~ /^(\s*)-/ ) { - $hash->{$key} = []; - $self->_read_array( $hash->{$key}, [ @$indent, length($1) ], $lines ); - } elsif ( $lines->[0] =~ /^(\s*)./ ) { - my $indent2 = length("$1"); - if ( $indent->[-1] >= $indent2 ) { - # Null hash entry - $hash->{$key} = undef; - } else { - $hash->{$key} = {}; - $self->_read_hash( $hash->{$key}, [ @$indent, length($1) ], $lines ); - } - } - } - } - - return 1; -} - -# Save an object to a file -sub write { - my $self = shift; - my $file = shift or return $self->_error('No file name provided'); - - # Write it to the file - open( CFG, '>' . $file ) or return $self->_error( - "Failed to open file '$file' for writing: $!" - ); - print CFG $self->write_string; - close CFG; - - return 1; -} - -# Save an object to a string -sub write_string { - my $self = shift; - return '' unless @$self; - - # Iterate over the documents - my $indent = 0; - my @lines = (); - foreach my $cursor ( @$self ) { - push @lines, '---'; - - # An empty document - if ( ! defined $cursor ) { - # Do nothing - - # A scalar document - } elsif ( ! ref $cursor ) { - $lines[-1] .= ' ' . $self->_write_scalar( $cursor, $indent ); - - # A list at the root - } elsif ( ref $cursor eq 'ARRAY' ) { - unless ( @$cursor ) { - $lines[-1] .= ' []'; - next; - } - push @lines, $self->_write_array( $cursor, $indent, {} ); - - # A hash at the root - } elsif ( ref $cursor eq 'HASH' ) { - unless ( %$cursor ) { - $lines[-1] .= ' {}'; - next; - } - push @lines, $self->_write_hash( $cursor, $indent, {} ); - - } else { - croak("Cannot serialize " . ref($cursor)); - } - } - - join '', map { "$_\n" } @lines; -} - -sub _write_scalar { - my $string = $_[1]; - return '~' unless defined $string; - return "''" unless length $string; - if ( $string =~ /[\x00-\x08\x0b-\x0d\x0e-\x1f\"\'\n]/ ) { - $string =~ s/\\/\\\\/g; - $string =~ s/"/\\"/g; - $string =~ s/\n/\\n/g; - $string =~ s/([\x00-\x1f])/\\$UNPRINTABLE[ord($1)]/g; - return qq|"$string"|; - } - if ( $string =~ /(?:^\W|\s)/ or $QUOTE{$string} ) { - return "'$string'"; - } - return $string; -} - -sub _write_array { - my ($self, $array, $indent, $seen) = @_; - if ( $seen->{refaddr($array)}++ ) { - die "Module::Build::YAML does not support circular references"; - } - my @lines = (); - foreach my $el ( @$array ) { - my $line = (' ' x $indent) . '-'; - my $type = ref $el; - if ( ! $type ) { - $line .= ' ' . $self->_write_scalar( $el, $indent + 1 ); - push @lines, $line; - - } elsif ( $type eq 'ARRAY' ) { - if ( @$el ) { - push @lines, $line; - push @lines, $self->_write_array( $el, $indent + 1, $seen ); - } else { - $line .= ' []'; - push @lines, $line; - } - - } elsif ( $type eq 'HASH' ) { - if ( keys %$el ) { - push @lines, $line; - push @lines, $self->_write_hash( $el, $indent + 1, $seen ); - } else { - $line .= ' {}'; - push @lines, $line; - } - - } else { - die "Module::Build::YAML does not support $type references"; - } - } - - @lines; -} - -sub _write_hash { - my ($self, $hash, $indent, $seen) = @_; - if ( $seen->{refaddr($hash)}++ ) { - die "Module::Build::YAML does not support circular references"; - } - my @lines = (); - foreach my $name ( sort keys %$hash ) { - my $el = $hash->{$name}; - my $line = (' ' x $indent) . "$name:"; - my $type = ref $el; - if ( ! $type ) { - $line .= ' ' . $self->_write_scalar( $el, $indent + 1 ); - push @lines, $line; - - } elsif ( $type eq 'ARRAY' ) { - if ( @$el ) { - push @lines, $line; - push @lines, $self->_write_array( $el, $indent + 1, $seen ); - } else { - $line .= ' []'; - push @lines, $line; - } - - } elsif ( $type eq 'HASH' ) { - if ( keys %$el ) { - push @lines, $line; - push @lines, $self->_write_hash( $el, $indent + 1, $seen ); - } else { - $line .= ' {}'; - push @lines, $line; - } - - } else { - die "Module::Build::YAML does not support $type references"; - } - } - - @lines; -} - -# Set error -sub _error { - $Module::Build::YAML::errstr = $_[1]; - undef; -} - -# Retrieve error -sub errstr { - $Module::Build::YAML::errstr; -} - -##################################################################### -# YAML Compatibility - -sub Dump { - Module::Build::YAML->new(@_)->write_string; -} - -sub Load { - my $self = Module::Build::YAML->read_string(@_); - unless ( $self ) { - croak("Failed to load YAML document from string"); - } - if ( wantarray ) { - return @$self; - } else { - # To match YAML.pm, return the last document - return $self->[-1]; - } -} - -BEGIN { - *freeze = *Dump; - *thaw = *Load; -} - -sub DumpFile { - my $file = shift; - Module::Build::YAML->new(@_)->write($file); -} +use CPAN::Meta::YAML 0.002 (); +our @ISA = qw(CPAN::Meta::YAML); +our $VERSION = '1.41'; +1; -sub LoadFile { - my $self = Module::Build::YAML->read($_[0]); - unless ( $self ) { - croak("Failed to load YAML document from '" . ($_[0] || '') . "'"); - } - if ( wantarray ) { - return @$self; - } else { - # Return only the last document to match YAML.pm, - return $self->[-1]; - } -} +=head1 NAME -##################################################################### -# Use Scalar::Util if possible, otherwise emulate it +Module::Build::YAML - DEPRECATED -BEGIN { - eval { - require Scalar::Util; - }; - if ( $@ ) { - # Failed to load Scalar::Util - eval <<'END_PERL'; -sub refaddr { - my $pkg = ref($_[0]) or return undef; - if (!!UNIVERSAL::can($_[0], 'can')) { - bless $_[0], 'Scalar::Util::Fake'; - } else { - $pkg = undef; - } - "$_[0]" =~ /0x(\w+)/; - my $i = do { local $^W; hex $1 }; - bless $_[0], $pkg if defined $pkg; - $i; -} -END_PERL - } else { - Scalar::Util->import('refaddr'); - } -} +=head1 DESCRIPTION -1; +This module was originally an inline copy of L. It has been +deprecated in favor of using L directly. This module is kept +as a subclass wrapper for compatibility. -__END__ +=cut diff --git a/cpan/Module-Build/lib/inc/latest.pm b/cpan/Module-Build/lib/inc/latest.pm index 70c0f0b..16c21d3 100644 --- a/cpan/Module-Build/lib/inc/latest.pm +++ b/cpan/Module-Build/lib/inc/latest.pm @@ -1,7 +1,7 @@ package inc::latest; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use Carp; diff --git a/cpan/Module-Build/lib/inc/latest/private.pm b/cpan/Module-Build/lib/inc/latest/private.pm index 928ad70..44c8833 100644 --- a/cpan/Module-Build/lib/inc/latest/private.pm +++ b/cpan/Module-Build/lib/inc/latest/private.pm @@ -1,7 +1,7 @@ package inc::latest::private; use strict; use vars qw($VERSION); -$VERSION = '0.3607'; +$VERSION = '0.3622'; $VERSION = eval $VERSION; use File::Spec; diff --git a/cpan/Module-Build/scripts/config_data b/cpan/Module-Build/scripts/config_data index d08a5f3..40c8ea4 100644 --- a/cpan/Module-Build/scripts/config_data +++ b/cpan/Module-Build/scripts/config_data @@ -1,7 +1,4 @@ -#!/usr/bin/perl - -eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' - if 0; # not running under some shell +#!/usr/bin/perl use strict; use Module::Build 0.25; diff --git a/cpan/Module-Build/t/actions/manifest_skip.t b/cpan/Module-Build/t/actions/manifest_skip.t new file mode 100644 index 0000000..a3677dd --- /dev/null +++ b/cpan/Module-Build/t/actions/manifest_skip.t @@ -0,0 +1,54 @@ +use strict; +use lib 't/lib'; +use MBTest; +use DistGen; + +plan tests => 7; + +# Ensure any Module::Build modules are loaded from correct directory +blib_load('Module::Build'); + +# create dist object in a temp directory +# enter the directory and generate the skeleton files +my $dist = DistGen->new->chdir_in; +$dist->change_build_pl( + module_name => $dist->name, + requires => { + 'File::Spec' => 9999, + }, + build_requires => { + 'Getopt::Long' => 9998, + }, + cpan_client => $^X . ' -le print($_)for($^X,@ARGV)', +)->regen; + +ok( ! -e 'MANIFEST.SKIP', "MANIFEST.SKIP doesn't exist at start" ); + +# get a Module::Build object and test with it +my $mb; +stdout_stderr_of( sub { $mb = $dist->new_from_context('verbose' => 1) } ); +isa_ok( $mb, "Module::Build" ); + +my ($out, $err) = stdout_stderr_of( sub { + $dist->run_build('manifest_skip') +}); +ok( -e 'MANIFEST.SKIP', "'Build manifest_skip' creates MANIFEST.SKIP" ); +like( $out, qr/Creating a new MANIFEST.SKIP file/, "Saw creation message"); + +# shouldn't overwrite +my $old_mtime = -M 'MANIFEST.SKIP'; +($out, $err) = stdout_stderr_of( sub { + $dist->run_build('manifest_skip') +}); +like( $err, qr/MANIFEST.SKIP already exists/, + "Running it again warns about pre-existing MANIFEST.SKIP" +); +is( -M 'MANIFEST.SKIP', $old_mtime, "File does not appear modified" ); + +# cleanup +($out, $err) = stdout_stderr_of( sub { + $dist->run_build('distclean') +}); +ok( -e 'MANIFEST.SKIP', "MANIFEST.SKIP still exists after distclean" ); + +# vim:ts=2:sw=2:et:sta:sts=2 diff --git a/cpan/Module-Build/t/basic.t b/cpan/Module-Build/t/basic.t index 5d76ffa..e26847e 100644 --- a/cpan/Module-Build/t/basic.t +++ b/cpan/Module-Build/t/basic.t @@ -60,8 +60,8 @@ $dist->chdir_in; ok $flagged; ok $mb->prereq_failures; ok $mb->prereq_failures->{requires}{$dist->name}; - is $mb->prereq_failures->{requires}{$dist->name}{have}, 0.01; - is $mb->prereq_failures->{requires}{$dist->name}{need}, 3.14159265; + is $mb->prereq_failures->{requires}{$dist->name}{have}, "0.01"; + is $mb->prereq_failures->{requires}{$dist->name}{need}, "3.14159265"; $mb->dispatch('realclean'); $dist->clean; diff --git a/cpan/Module-Build/t/bundled/Software/License.pm b/cpan/Module-Build/t/bundled/Software/License.pm new file mode 100644 index 0000000..6457ab6 --- /dev/null +++ b/cpan/Module-Build/t/bundled/Software/License.pm @@ -0,0 +1,56 @@ +# Modified from the original as a "mock" version for testing +use strict; +use warnings; +use 5.006; # warnings +package Software::License; +our $VERSION = 9999; + +sub new { + my ($class, $arg) = @_; + + # XXX changed from Carp::croak to die + die "no copyright holder specified" unless $arg->{holder}; + + bless $arg => $class; +} + + +sub year { defined $_[0]->{year} ? $_[0]->{year} : (localtime)[5]+1900 } +sub holder { $_[0]->{holder} } + +sub version { + my ($self) = @_; + my $pkg = ref $self ? ref $self : $self; + $pkg =~ s/.+:://; + my (undef, @vparts) = split /_/, $pkg; + + return unless @vparts; + return join '.', @vparts; +} + + +# sub meta1_name { return undef; } # sort this out later, should be easy +sub meta_name { return undef; } +sub meta_yml_name { $_[0]->meta_name } + +sub meta2_name { + my ($self) = @_; + my $meta1 = $self->meta_name; + + return undef unless defined $meta1; + + return $meta1 + if $meta1 =~ /\A(?:open_source|restricted|unrestricted|unknown)\z/; + + return undef; +} + +# XXX these are trivial mocks of the real thing +sub notice { 'NOTICE' } +sub license { 'LICENSE' } +sub fulltext { 'FULLTEXT' } + +1; + + + diff --git a/cpan/Module-Build/t/compat.t b/cpan/Module-Build/t/compat.t index bb2cc73..1546d2b 100644 --- a/cpan/Module-Build/t/compat.t +++ b/cpan/Module-Build/t/compat.t @@ -313,6 +313,63 @@ ok $mb, "Module::Build->new_from_context"; ok( ! exists $args->{TESTS}, 'Not using incorrect recursive tests key' ); } + 1 while unlink 'Makefile.PL'; + ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; +} + +{ + # make sure using prereq with '0.1.2' complains + $dist->change_build_pl({ + module_name => $distname, + license => 'perl', + requires => { + 'Foo::Frobnicate' => '0.1.2', + }, + create_makefile_pl => 'traditional', + }); + $dist->regen; + + my $mb; + stdout_stderr_of( sub { + $mb = Module::Build->new_from_context; + }); + + my $output = stdout_stderr_of( sub { $mb->do_create_makefile_pl } ); + ok -e 'Makefile.PL', "Makefile.PL created"; + like $output, qr/is not portable/, "Correctly complains and converts dotted-decimal"; + + my $file_contents = slurp 'Makefile.PL'; + like $file_contents, qr/Foo::Frobnicate.+0\.001002/, "Properly converted dotted-decimal"; + + 1 while unlink 'Makefile.PL'; + ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; +} + +{ + # make sure using invalid prereq blows up + $dist->change_build_pl({ + module_name => $distname, + license => 'perl', + requires => { + 'Foo::Frobnicate' => '3.5_2_7', + }, + create_makefile_pl => 'traditional', + }); + $dist->regen; + + ok ! -e 'Makefile.PL', "Makefile.PL doesn't exist before we start"; + + my $mb; + stdout_stderr_of( sub { + $mb = $dist->run_build_pl; + }); + + my ($output, $error) = stdout_stderr_of( sub { $dist->run_build('distmeta') } ); + like $error, qr/is not supported/ms, "Correctly dies when it encounters invalid prereq"; + ok ! -e 'Makefile.PL', "Makefile.PL NOT created"; + + 1 while unlink 'Makefile.PL'; + ok ! -e 'Makefile.PL', "Makefile.PL cleaned up"; } ######################################################### diff --git a/cpan/Module-Build/t/lib/DistGen.pm b/cpan/Module-Build/t/lib/DistGen.pm index 9fbd6d0..ae8ed34 100644 --- a/cpan/Module-Build/t/lib/DistGen.pm +++ b/cpan/Module-Build/t/lib/DistGen.pm @@ -84,6 +84,8 @@ sub reset { my %options = @_; $options{name} ||= 'Simple'; + $options{version} ||= q{'0.01'}; + $options{license} ||= 'perl'; $options{dir} = File::Spec->rel2abs( defined $options{dir} ? $options{dir} : MBTest->tmpdir ); @@ -151,7 +153,7 @@ sub _gen_default_filedata { my \$builder = Module::Build->new( module_name => '$self->{name}', - license => 'perl', + license => '$self->{license}', ); \$builder->create_build_script(); @@ -164,7 +166,7 @@ sub _gen_default_filedata { my \$builder = Module::Build->new( module_name => '$self->{name}', - license => 'perl', + license => '$self->{license}', ); \$builder->create_build_script(); @@ -179,7 +181,7 @@ sub _gen_default_filedata { package $self->{name}; use vars qw( \$VERSION ); - \$VERSION = '0.01'; + \$VERSION = $self->{version}; use strict; @@ -214,7 +216,7 @@ sub _gen_default_filedata { $self->$add_unless($module_filename, undent(<<" ---")); package $self->{name}; - \$VERSION = '0.01'; + \$VERSION = $self->{version}; require Exporter; require DynaLoader; @@ -627,6 +629,8 @@ The C method does not write any files -- see L below. my $dist = DistGen->new( name => 'Foo::Bar', + version => '0.01', + license => 'perl', dir => MBTest->tmpdir, xs => 1, no_manifest => 0, @@ -642,6 +646,17 @@ The name of the module this distribution represents. The default is 'Simple'. This should be a "Foo::Bar" (module) name, not a "Foo-Bar" dist name. +=item version + +The version string that will be set. (E.g. C) +Note -- to put this value in quotes, add those to the string. + + version => q{'0.01_01'} + +=item license + +The license string that will be set in Build.PL. Defaults to 'perl'. + =item dir The (parent) directory in which to create the distribution directory. The diff --git a/cpan/Module-Build/t/lib/MBTest.pm b/cpan/Module-Build/t/lib/MBTest.pm index bf3cebd..0df382f 100644 --- a/cpan/Module-Build/t/lib/MBTest.pm +++ b/cpan/Module-Build/t/lib/MBTest.pm @@ -55,12 +55,10 @@ BEGIN { my $t_lib = File::Spec->catdir('t', 'bundled'); push @INC, $t_lib; # Let user's installed version override - if ($ENV{PERL_CORE}) { - # We change directories, so expand @INC and $^X to absolute paths - # Also add . - @INC = (map(File::Spec->rel2abs($_), @INC), "."); - $^X = File::Spec->rel2abs($^X); - } + # We change directories, so expand @INC and $^X to absolute paths + # Also add . + @INC = (map(File::Spec->rel2abs($_), @INC), "."); + $^X = File::Spec->rel2abs($^X); } use Exporter; @@ -98,11 +96,11 @@ __PACKAGE__->export(scalar caller, @extra_exports); # always return to the current directory { my $cwd; - BEGIN { + # must be done in BEGIN because tmpdir uses it in BEGIN for $ENV{HOME} + BEGIN { $cwd = File::Spec->rel2abs(Cwd::cwd); } - # This is called at BEGIN time below, so anything it uses must be initialised sub original_cwd { return $cwd } END { @@ -210,6 +208,9 @@ sub check_compiler { my $have_c_compiler; stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} ); + # XXX link_executable() is not yet implemented for Windows + # and noexec tmpdir is irrelevant on Windows + return ($have_c_compiler, 1) if $^O eq "MSWin32"; # check noexec tmpdir my $tmp_exec; diff --git a/cpan/Module-Build/t/lib/Software/License/VaporWare.pm b/cpan/Module-Build/t/lib/Software/License/VaporWare.pm new file mode 100644 index 0000000..80d9fa5 --- /dev/null +++ b/cpan/Module-Build/t/lib/Software/License/VaporWare.pm @@ -0,0 +1,17 @@ +use strict; +use warnings; + +package Software::License::VaporWare; +our $VERSION = '0.001'; + +use Software::License; +our @ISA = qw/Software::License/; + +sub name { 'VaporWare License' } +sub url { 'http://example.com/vaporware/' } +sub meta_name { 'unrestricted' } +sub meta2_name { 'unrestricted' } + +1; + + diff --git a/cpan/Module-Build/t/metadata.t b/cpan/Module-Build/t/metadata.t index 1ac35b2..a495f15 100644 --- a/cpan/Module-Build/t/metadata.t +++ b/cpan/Module-Build/t/metadata.t @@ -2,7 +2,7 @@ use strict; use lib 't/lib'; -use MBTest tests => 51; +use MBTest tests => 52; blib_load('Module::Build'); blib_load('Module::Build::ConfigData'); @@ -65,7 +65,13 @@ my $mb = Module::Build->new_from_context; my $mb_config_req = { 'Module::Build' => int($Module::Build::VERSION * 100)/100 }; - my $node = $mb->get_metadata( ); + my $node; + my $output = stdout_stderr_of( sub { + $node = $mb->get_metadata( auto => 1 ); + }); + like( $output, qr/Module::Build was not found in configure_requires/, + "saw warning about M::B not in configure_requires" + ); # exists() doesn't seem to work here is $node->{name}, $metadata{module_name}; @@ -86,7 +92,7 @@ my $mb = Module::Build->new_from_context; { my $mb_prereq = { 'Module::Build' => 0 }; $mb->configure_requires( $mb_prereq ); - my $node = $mb->get_metadata( ); + my $node = $mb->get_metadata( auto => 1 ); # exists() doesn't seem to work here diff --git a/cpan/Module-Build/t/metadata2.t b/cpan/Module-Build/t/metadata2.t index a0fdd60..347a9a4 100644 --- a/cpan/Module-Build/t/metadata2.t +++ b/cpan/Module-Build/t/metadata2.t @@ -12,10 +12,7 @@ use DistGen; ############################## ACTION distmeta works without a MANIFEST file -SKIP: { - skip( 'YAML_support feature is not enabled', 4 ) - unless Module::Build::ConfigData->feature('YAML_support'); - +{ my $dist = DistGen->new( no_manifest => 1 )->chdir_in->regen; ok ! -e 'MANIFEST'; diff --git a/cpan/Module-Build/t/moduleinfo.t b/cpan/Module-Build/t/moduleinfo.t deleted file mode 100644 index e28726d..0000000 --- a/cpan/Module-Build/t/moduleinfo.t +++ /dev/null @@ -1,440 +0,0 @@ -#!/usr/bin/perl -w -# -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*- -# vim:ts=8:sw=2:et:sta:sts=2 - -use strict; -use lib 't/lib'; -use MBTest; - -# parse various module $VERSION lines -# these will be reversed later to create %modules -my @modules = ( - '1.23' => <<'---', # declared & defined on same line with 'our' -package Simple; -our $VERSION = '1.23'; ---- - '1.23' => <<'---', # declared & defined on separate lines with 'our' -package Simple; -our $VERSION; -$VERSION = '1.23'; ---- - '1.23' => <<'---', # use vars -package Simple; -use vars qw( $VERSION ); -$VERSION = '1.23'; ---- - '1.23' => <<'---', # choose the right default package based on package/file name -package Simple::_private; -$VERSION = '0'; -package Simple; -$VERSION = '1.23'; # this should be chosen for version ---- - '1.23' => <<'---', # just read the first $VERSION line -package Simple; -$VERSION = '1.23'; # we should see this line -$VERSION = eval $VERSION; # and ignore this one ---- - '1.23' => <<'---', # just read the first $VERSION line in reopened package (1) -package Simple; -$VERSION = '1.23'; -package Error::Simple; -$VERSION = '2.34'; -package Simple; ---- - '1.23' => <<'---', # just read the first $VERSION line in reopened package (2) -package Simple; -package Error::Simple; -$VERSION = '2.34'; -package Simple; -$VERSION = '1.23'; ---- - '1.23' => <<'---', # mentions another module's $VERSION -package Simple; -$VERSION = '1.23'; -if ( $Other::VERSION ) { - # whatever -} ---- - '1.23' => <<'---', # mentions another module's $VERSION in a different package -package Simple; -$VERSION = '1.23'; -package Simple2; -if ( $Simple::VERSION ) { - # whatever -} ---- - '1.23' => <<'---', # $VERSION checked only in assignments, not regexp ops -package Simple; -$VERSION = '1.23'; -if ( $VERSION =~ /1\.23/ ) { - # whatever -} ---- - '1.23' => <<'---', # $VERSION checked only in assignments, not relational ops -package Simple; -$VERSION = '1.23'; -if ( $VERSION == 3.45 ) { - # whatever -} ---- - '1.23' => <<'---', # $VERSION checked only in assignments, not relational ops -package Simple; -$VERSION = '1.23'; -package Simple2; -if ( $Simple::VERSION == 3.45 ) { - # whatever -} ---- - '1.23' => <<'---', # Fully qualified $VERSION declared in package -package Simple; -$Simple::VERSION = 1.23; ---- - '1.23' => <<'---', # Differentiate fully qualified $VERSION in a package -package Simple; -$Simple2::VERSION = '999'; -$Simple::VERSION = 1.23; ---- - '1.23' => <<'---', # Differentiate fully qualified $VERSION and unqualified -package Simple; -$Simple2::VERSION = '999'; -$VERSION = 1.23; ---- - '1.23' => <<'---', # $VERSION declared as package variable from within 'main' package -$Simple::VERSION = '1.23'; -{ - package Simple; - $x = $y, $cats = $dogs; -} ---- - '1.23' => <<'---', # $VERSION wrapped in parens - space inside -package Simple; -( $VERSION ) = '1.23'; ---- - '1.23' => <<'---', # $VERSION wrapped in parens - no space inside -package Simple; -($VERSION) = '1.23'; ---- - '1.23' => <<'---', # $VERSION follows a spurious 'package' in a quoted construct -package Simple; -__PACKAGE__->mk_accessors(qw( - program socket proc - package filename line codeline subroutine finished)); - -our $VERSION = "1.23"; ---- - '1.23' => <<'---', # $VERSION using version.pm - package Simple; - use version; our $VERSION = version->new('1.23'); ---- - '1.23' => <<'---', # $VERSION using version.pm and qv() - package Simple; - use version; our $VERSION = qv('1.230'); ---- - '1.23' => <<'---', # Two version assignments, should ignore second one - $Simple::VERSION = '1.230'; - $Simple::VERSION = eval $Simple::VERSION; ---- - '1.23' => <<'---', # declared & defined on same line with 'our' -package Simple; -our $VERSION = '1.23_00_00'; ---- - '1.23' => <<'---', # package NAME VERSION - package Simple 1.23; ---- - '1.23_01' => <<'---', # package NAME VERSION - package Simple 1.23_01; ---- - 'v1.2.3' => <<'---', # package NAME VERSION - package Simple v1.2.3; ---- - 'v1.2_3' => <<'---', # package NAME VERSION - package Simple v1.2_3; ---- -); -my %modules = reverse @modules; - -plan tests => 36 + 2 * keys( %modules ); - -blib_load('Module::Build::ModuleInfo'); - -my $tmp = MBTest->tmpdir; - -use DistGen; -my $dist = DistGen->new( dir => $tmp ); -$dist->regen; - -$dist->chdir_in; - -######################### - -# class method C -my $module = Module::Build::ModuleInfo->find_module_by_name( - 'Module::Build::ModuleInfo' ); -ok( -e $module, 'find_module_by_name() succeeds' ); - - -# fail on invalid module name -my $pm_info = Module::Build::ModuleInfo->new_from_module( - 'Foo::Bar', inc => [] ); -ok( !defined( $pm_info ), 'fail if can\'t find module by module name' ); - - -# fail on invalid filename -my $file = File::Spec->catfile( 'Foo', 'Bar.pm' ); -$pm_info = Module::Build::ModuleInfo->new_from_file( $file, inc => [] ); -ok( !defined( $pm_info ), 'fail if can\'t find module by file name' ); - - -# construct from module filename -$file = File::Spec->catfile( 'lib', split( /::/, $dist->name ) ) . '.pm'; -$pm_info = Module::Build::ModuleInfo->new_from_file( $file ); -ok( defined( $pm_info ), 'new_from_file() succeeds' ); - -# construct from module name, using custom include path -$pm_info = Module::Build::ModuleInfo->new_from_module( - $dist->name, inc => [ 'lib', @INC ] ); -ok( defined( $pm_info ), 'new_from_module() succeeds' ); - - -foreach my $module ( sort keys %modules ) { - my $expected = $modules{$module}; - SKIP: { - skip( "No our() support until perl 5.6", 2 ) - if $] < 5.006 && $module =~ /\bour\b/; - skip( "No package NAME VERSION support until perl 5.11.1", 2 ) - if $] < 5.011001 && $module =~ /package\s+[\w\:\']+\s+v?[0-9._]+/; - - $dist->change_file( 'lib/Simple.pm', $module ); - $dist->regen; - - my $warnings = ''; - local $SIG{__WARN__} = sub { $warnings .= $_ for @_ }; - my $pm_info = Module::Build::ModuleInfo->new_from_file( $file ); - - # Test::Builder will prematurely numify objects, so use this form - my $errs; - ok( $pm_info->version eq $expected, - "correct module version (expected '$expected')" ) - or $errs++; - is( $warnings, '', 'no warnings from parsing' ) or $errs++; - diag "Got: '@{[$pm_info->version]}'\nModule contents:\n$module" if $errs; - } -} - -# revert to pristine state -$dist->regen( clean => 1 ); - -# Find each package only once -$dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple; -$VERSION = '1.23'; -package Error::Simple; -$VERSION = '2.34'; -package Simple; ---- - -$dist->regen; - -$pm_info = Module::Build::ModuleInfo->new_from_file( $file ); - -my @packages = $pm_info->packages_inside; -is( @packages, 2, 'record only one occurence of each package' ); - - -# Module 'Simple.pm' does not contain package 'Simple'; -# constructor should not complain, no default module name or version -$dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple::Not; -$VERSION = '1.23'; ---- - -$dist->regen; -$pm_info = Module::Build::ModuleInfo->new_from_file( $file ); - -is( $pm_info->name, undef, 'no default package' ); -is( $pm_info->version, undef, 'no version w/o default package' ); - -# Module 'Simple.pm' contains an alpha version -# constructor should report first $VERSION found -$dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple; -$VERSION = '1.23_01'; -$VERSION = eval $VERSION; ---- - -$dist->regen; -$pm_info = Module::Build::ModuleInfo->new_from_file( $file ); - -is( $pm_info->version, '1.23_01', 'alpha version reported'); - -# NOTE the following test has be done this way because Test::Builder is -# too smart for our own good and tries to see if the version object is a -# dual-var, which breaks with alpha versions: -# Argument "1.23_0100" isn't numeric in addition (+) at -# /usr/lib/perl5/5.8.7/Test/Builder.pm line 505. - -ok( $pm_info->version > 1.23, 'alpha version greater than non'); - -# revert to pristine state -$dist->regen( clean => 1 ); - -# parse $VERSION lines scripts for package main -my @scripts = ( - <<'---', # package main declared -#!perl -w -package main; -$VERSION = '0.01'; ---- - <<'---', # on first non-comment line, non declared package main -#!perl -w -$VERSION = '0.01'; ---- - <<'---', # after non-comment line -#!perl -w -use strict; -$VERSION = '0.01'; ---- - <<'---', # 1st declared package -#!perl -w -package main; -$VERSION = '0.01'; -package _private; -$VERSION = '999'; ---- - <<'---', # 2nd declared package -#!perl -w -package _private; -$VERSION = '999'; -package main; -$VERSION = '0.01'; ---- - <<'---', # split package -#!perl -w -package main; -package _private; -$VERSION = '999'; -package main; -$VERSION = '0.01'; ---- - <<'---', # define 'main' version from other package -package _private; -$::VERSION = 0.01; -$VERSION = '999'; ---- - <<'---', # define 'main' version from other package -package _private; -$VERSION = '999'; -$::VERSION = 0.01; ---- -); - -my ( $i, $n ) = ( 1, scalar( @scripts ) ); -foreach my $script ( @scripts ) { - $dist->change_file( 'bin/simple.plx', $script ); - $dist->regen; - $pm_info = Module::Build::ModuleInfo->new_from_file( - File::Spec->catfile( 'bin', 'simple.plx' ) ); - - is( $pm_info->version, '0.01', "correct script version ($i of $n)" ); - $i++; -} - - -# examine properties of a module: name, pod, etc -$dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple; -$VERSION = '0.01'; -package Simple::Ex; -$VERSION = '0.02'; -=head1 NAME - -Simple - It's easy. - -=head1 AUTHOR - -Simple Simon - -=cut ---- -$dist->regen; - -$pm_info = Module::Build::ModuleInfo->new_from_module( - $dist->name, inc => [ 'lib', @INC ] ); - -is( $pm_info->name, 'Simple', 'found default package' ); -is( $pm_info->version, '0.01', 'version for default package' ); - -# got correct version for secondary package -is( $pm_info->version( 'Simple::Ex' ), '0.02', - 'version for secondary package' ); - -my $filename = $pm_info->filename; -ok( defined( $filename ) && -e $filename, - 'filename() returns valid path to module file' ); - -@packages = $pm_info->packages_inside; -is( @packages, 2, 'found correct number of packages' ); -is( $packages[0], 'Simple', 'packages stored in order found' ); - -# we can detect presence of pod regardless of whether we are collecting it -ok( $pm_info->contains_pod, 'contains_pod() succeeds' ); - -my @pod = $pm_info->pod_inside; -is_deeply( \@pod, [qw(NAME AUTHOR)], 'found all pod sections' ); - -is( $pm_info->pod('NONE') , undef, - 'return undef() if pod section not present' ); - -is( $pm_info->pod('NAME'), undef, - 'return undef() if pod section not collected' ); - - -# collect_pod -$pm_info = Module::Build::ModuleInfo->new_from_module( - $dist->name, inc => [ 'lib', @INC ], collect_pod => 1 ); - -my $name = $pm_info->pod('NAME'); -if ( $name ) { - $name =~ s/^\s+//; - $name =~ s/\s+$//; -} -is( $name, q|Simple - It's easy.|, 'collected pod section' ); - - -{ - # Make sure processing stops after __DATA__ - $dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple; -$VERSION = '0.01'; -__DATA__ -*UNIVERSAL::VERSION = sub { - foo(); -}; ---- - $dist->regen; - - $pm_info = Module::Build::ModuleInfo->new_from_file('lib/Simple.pm'); - is( $pm_info->name, 'Simple', 'found default package' ); - is( $pm_info->version, '0.01', 'version for default package' ); - my @packages = $pm_info->packages_inside; - is_deeply(\@packages, ['Simple'], 'packages inside'); -} - -{ - # Make sure we handle version.pm $VERSIONs well - $dist->change_file( 'lib/Simple.pm', <<'---' ); -package Simple; -$VERSION = version->new('0.60.' . (qw$Revision: 128 $)[1]); -package Simple::Simon; -$VERSION = version->new('0.61.' . (qw$Revision: 129 $)[1]); ---- - $dist->regen; - - $pm_info = Module::Build::ModuleInfo->new_from_file('lib/Simple.pm'); - is( $pm_info->name, 'Simple', 'found default package' ); - is( $pm_info->version, '0.60.128', 'version for default package' ); - my @packages = $pm_info->packages_inside; - is_deeply([sort @packages], ['Simple', 'Simple::Simon'], 'packages inside'); - is( $pm_info->version('Simple::Simon'), '0.61.129', 'version for embedded package' ); -} - diff --git a/cpan/Module-Build/t/mymeta.t b/cpan/Module-Build/t/mymeta.t index 91a2690..78c4f6d 100644 --- a/cpan/Module-Build/t/mymeta.t +++ b/cpan/Module-Build/t/mymeta.t @@ -3,10 +3,10 @@ use strict; use lib 't/lib'; use MBTest; -plan tests => 24; +use CPAN::Meta::YAML; +plan tests => 25; blib_load('Module::Build'); -blib_load('Module::Build::YAML'); my $tmp = MBTest->tmpdir; @@ -47,15 +47,21 @@ $dist->chdir_in; # Test interactions between META/MYMETA { - my $output = stdout_of sub { $dist->run_build('distmeta') }; + my $output = stdout_stderr_of sub { $dist->run_build('distmeta') }; like($output, qr/Creating META.yml/, "Ran Build distmeta to create META.yml"); - my $meta = Module::Build::YAML->read('META.yml')->[0]; - my $mymeta = Module::Build::YAML->read('MYMETA.yml')->[0]; + # regenerate MYMETA to pick up from META instead of creating from scratch + $output = stdout_of sub { $dist->run_build_pl }; + like($output, qr/Creating new 'MYMETA.yml' with configuration results/, + "Re-ran Build.PL and regenerated MYMETA.yml based on META.yml" + ); + + my $meta = CPAN::Meta::YAML->read('META.yml')->[0]; + my $mymeta = CPAN::Meta::YAML->read('MYMETA.yml')->[0]; is( delete $mymeta->{dynamic_config}, 0, "MYMETA 'dynamic_config' is 0" ); - is_deeply( $meta, $mymeta, "Other generated MYMETA matches generated META" ); + is_deeply( $mymeta, $meta, "Other generated MYMETA matches generated META" ); $output = stdout_stderr_of sub { $dist->run_build('realclean') }; like( $output, qr/Cleaning up/, "Ran realclean"); ok( ! -e 'Build', "Build file removed" ); @@ -68,7 +74,7 @@ $dist->chdir_in; "Ran Build.PL with dynamic config" ); ok( -e "MYMETA.yml", "MYMETA.yml exists" ); - $mymeta = Module::Build::YAML->read('MYMETA.yml')->[0]; + $mymeta = CPAN::Meta::YAML->read('MYMETA.yml')->[0]; isnt( $meta->{requires}{'File::Spec'}, $mymeta->{requires}{'File::Spec'}, "MYMETA requires differs from META" @@ -80,14 +86,14 @@ $dist->chdir_in; # manually change META and check that changes are preserved $meta->{author} = ['John Gault']; - ok( Module::Build::YAML->new($meta)->write('META.yml'), + ok( CPAN::Meta::YAML->new($meta)->write('META.yml'), "Wrote manually modified META.yml" ); $output = stdout_of sub { $dist->run_build_pl }; like($output, qr/Creating new 'MYMETA.yml' with configuration results/, "Ran Build.PL" ); - my $mymeta2 = Module::Build::YAML->read('MYMETA.yml')->[0]; + my $mymeta2 = CPAN::Meta::YAML->read('MYMETA.yml')->[0]; is_deeply( $mymeta2->{author}, [ 'John Gault' ], "MYMETA preserved META modifications" ); diff --git a/cpan/Module-Build/t/properties/dist_suffix.t b/cpan/Module-Build/t/properties/dist_suffix.t new file mode 100644 index 0000000..aaee112 --- /dev/null +++ b/cpan/Module-Build/t/properties/dist_suffix.t @@ -0,0 +1,33 @@ +# sample.t -- a sample test file for Module::Build + +use strict; +use lib 't/lib'; +use MBTest; +use DistGen; + +plan tests => 2; + +# Ensure any Module::Build modules are loaded from correct directory +blib_load('Module::Build'); + +#--------------------------------------------------------------------------# +# Create test distribution +#--------------------------------------------------------------------------# + +use DistGen; +my $dist = DistGen->new( name => 'Simple::Name' ); + +$dist->change_build_pl( + module_name => 'Simple::Name', + dist_suffix => 'SUFFIX', +)->regen; + +$dist->chdir_in; + +my $mb = $dist->new_from_context(); +isa_ok( $mb, "Module::Build" ); +is( $mb->dist_dir, "Simple-Name-0.01-SUFFIX", + "dist_suffix set correctly" +); + +# vim:ts=2:sw=2:et:sta:sts=2 diff --git a/cpan/Module-Build/t/properties/license.t b/cpan/Module-Build/t/properties/license.t new file mode 100644 index 0000000..db63b39 --- /dev/null +++ b/cpan/Module-Build/t/properties/license.t @@ -0,0 +1,66 @@ +use strict; +use lib 't/lib'; +use MBTest; +use DistGen; + +plan 'no_plan'; + +# Ensure any Module::Build modules are loaded from correct directory +blib_load('Module::Build'); + +#--------------------------------------------------------------------------# +# Create test distribution +#--------------------------------------------------------------------------# + +{ + my $dist = DistGen->new( + name => 'Simple::Name', + version => '0.01', + license => 'perl' + ); + + $dist->regen; + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->license, 'perl', + "license 'perl' is valid" + ); + + my $meta = $mb->get_metadata( fatal => 0 ); + + is( $meta->{license} => 'perl', "META license will be 'perl'" ); + is( $meta->{resources}{license}, "http://dev.perl.org/licenses/", + "META license URL is correct" + ); + +} + +{ + my $dist = DistGen->new( + name => 'Simple::Name', + version => '0.01', + license => 'VaporWare' + ); + + $dist->regen; + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->license, 'VaporWare', + "license 'VaporWare' is valid" + ); + + my $meta = $mb->get_metadata( fatal => 0 ); + + is( $meta->{license} => 'unrestricted', "META license will be 'unrestricted'" ); + is( $meta->{resources}{license}, "http://example.com/vaporware/", + "META license URL is correct" + ); + +} + +# Test with alpha number +# vim:ts=2:sw=2:et:sta:sts=2 diff --git a/cpan/Module-Build/t/properties/release_status.t b/cpan/Module-Build/t/properties/release_status.t new file mode 100644 index 0000000..45c7f33 --- /dev/null +++ b/cpan/Module-Build/t/properties/release_status.t @@ -0,0 +1,204 @@ +use strict; +use lib 't/lib'; +use MBTest; +use DistGen; + +if ( $] lt 5.008001 ) { + plan skip_all => "dotted-version numbers are buggy before 5.8.1"; +} else { + plan 'no_plan'; +} + +# Ensure any Module::Build modules are loaded from correct directory +blib_load('Module::Build'); + +#--------------------------------------------------------------------------# +# Create test distribution +#--------------------------------------------------------------------------# + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->release_status, "stable", + "regular version has release_status 'stable'" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->release_status, "stable", + "dotted-decimal version has release_status 'stable'" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->release_status, "testing", + "alpha version has release_status 'testing'" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3_1' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->release_status, "testing", + "dotted alpha version has release_status 'testing'" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'unstable', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->release_status, "unstable", + "explicit 'unstable' keeps release_status 'unstable'" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'testing', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->dist_suffix, "TRIAL", + "regular version marked 'testing' gets 'TRIAL' suffix" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => 'v1.2.3' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'testing', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->dist_suffix, "TRIAL", + "dotted version marked 'testing' gets 'TRIAL' suffix" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'unstable', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->dist_suffix, "TRIAL", + "regular version marked 'unstable' gets 'TRIAL' suffix" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => '0.01' ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'beta', + )->regen; + + $dist->chdir_in; + + my $output = stdout_stderr_of sub { $dist->run_build_pl() }; + like( $output, qr/Illegal value 'beta' for release_status/i, + "Got error message for illegal release_status" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + release_status => 'stable', + )->regen; + + $dist->chdir_in; + + my $output = stdout_stderr_of sub { $dist->run_build_pl() }; + like( $output, qr/Illegal value 'stable' with version '0.01_01'/i, + "Got error message for illegal 'stable' with alpha version" + ); +} + +{ + my $dist = DistGen->new( name => 'Simple::Name', version => q{'0.01_01'} ); + + $dist->change_build_pl( + module_name => 'Simple::Name', + dist_version => '1.23beta1', + )->regen; + + $dist->chdir_in; + + my $mb = $dist->new_from_context(); + isa_ok( $mb, "Module::Build" ); + is( $mb->dist_suffix, "", + "non-standard dist_version does not get a suffix" + ); + is( $mb->release_status, "stable", + "non-standard dist_version defaults to stable release_status" + ); +} + +# Test with alpha number +# vim:ts=2:sw=2:et:sta:sts=2 diff --git a/cpan/Module-Build/t/runthrough.t b/cpan/Module-Build/t/runthrough.t index 9e8d52e..1c0edf4 100644 --- a/cpan/Module-Build/t/runthrough.t +++ b/cpan/Module-Build/t/runthrough.t @@ -6,7 +6,6 @@ use MBTest tests => 29; blib_load('Module::Build'); blib_load('Module::Build::ConfigData'); -my $have_yaml = Module::Build::ConfigData->feature('YAML_support'); ######################### @@ -106,18 +105,16 @@ ok grep {$_ eq 'save_out' } $mb->cleanup; } } -SKIP: { - skip( 'YAML_support feature is not enabled', 7 ) unless $have_yaml; - +{ my $output = eval { - stdout_of( sub { $mb->dispatch('disttest') } ) + stdout_stderr_of( sub { $mb->dispatch('disttest') } ) }; is $@, ''; # After a test, the distdir should contain a blib/ directory ok -e File::Spec->catdir('Simple-0.01', 'blib'); - eval {$mb->dispatch('distdir')}; + stdout_stderr_of ( sub { eval {$mb->dispatch('distdir')} } ); is $@, ''; # The 'distdir' should contain a lib/ directory diff --git a/cpan/Module-Build/t/script_dist.t b/cpan/Module-Build/t/script_dist.t index 7fd82d9..26720b2 100644 --- a/cpan/Module-Build/t/script_dist.t +++ b/cpan/Module-Build/t/script_dist.t @@ -7,6 +7,7 @@ use lib 't/lib'; use MBTest 'no_plan'; use DistGen qw(undent); +use CPAN::Meta::YAML; blib_load('Module::Build'); blib_load('Module::Build::ConfigData'); @@ -68,13 +69,11 @@ is($mb->dist_name, 'bin-foo'); is($mb->dist_version, '0.01'); is_deeply($mb->dist_author, ['A. U. Thor, a.u.thor@a.galaxy.far.far.away']); -ok $mb->dispatch('distmeta'); - -SKIP: { - skip( 'YAML_support feature is not enabled', 1 ) - unless Module::Build::ConfigData->feature('YAML_support'); - require YAML::Tiny; - my $yml = YAML::Tiny::LoadFile('META.yml'); - is_deeply($yml->{provides}, \%meta_provides); -} +my $result; +stdout_stderr_of( sub { $result = $mb->dispatch('distmeta') } ); +ok $result; + +my $yml = CPAN::Meta::YAML->read_string(slurp('META.yml'))->[0]; +is_deeply($yml->{provides}, \%meta_provides); + $dist->chdir_original if $dist->did_chdir; diff --git a/cpan/Module-Build/t/tilde.t b/cpan/Module-Build/t/tilde.t index a5ed790..fac821b 100644 --- a/cpan/Module-Build/t/tilde.t +++ b/cpan/Module-Build/t/tilde.t @@ -52,13 +52,13 @@ SKIP: { is( run_sample( $p => '~' )->$p(), $home ); - is( run_sample( $p => '~/foo' )->$p(), "$home/foo" ); + is( run_sample( $p => '~/fooxzy' )->$p(), "$home/fooxzy" ); - is( run_sample( $p => '~/ foo')->$p(), "$home/ foo" ); + is( run_sample( $p => '~/ fooxzy')->$p(), "$home/ fooxzy" ); is( run_sample( $p => '~/fo o')->$p(), "$home/fo o" ); - is( run_sample( $p => 'foo~' )->$p(), 'foo~' ); + is( run_sample( $p => 'fooxzy~' )->$p(), 'fooxzy~' ); is( run_sample( prefix => '~' )->prefix, $home ); @@ -89,7 +89,7 @@ SKIP: { skip "On OS/2 EMX all users are equal", 2 if $^O eq 'os2'; is( run_sample( $p => '~~' )->$p(), '~~' ); - is( run_sample( $p => '~ foo' )->$p(), '~ foo' ); + is( run_sample( $p => '~ fooxzy' )->$p(), '~ fooxzy' ); } # Again, with named users @@ -98,15 +98,15 @@ SKIP: { skip "No home directory for tilde-expansion tests", 1 if $@; my ($me, $home) = @info[0,7]; - my $expected = "$home/foo"; + my $expected = "$home/fooxzy"; if ($^O eq 'VMS') { # Convert the path to UNIX format and trim off the trailing slash $home = VMS::Filespec::unixify($home); $home =~ s#/$##; - $expected = $home . '/../[^/]+' . '/foo'; + $expected = $home . '/../[^/]+' . '/fooxzy'; } - like( run_sample( $p => "~$me/foo")->$p(), qr($expected)i ); + like( run_sample( $p => "~$me/fooxzy")->$p(), qr(\Q$expected\E)i ); } diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 2035921..61957d6 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -96,6 +96,16 @@ XXX =item * +C has been upgraded from version 0.3607 to 0.3622. + +A notable change is the deprecation of several modules. +Module::Build::Version has been deprecated and Module::Build now relies +directly upon L. Module::Build::ModuleInfo has been deprecated in +favor of a standalone copy of it called L. +Module::Build::YAML has been deprecated in favor of L. + +=item * + C has been upgraded from version 0.68 to 0.72 This also sees the switch from using the pure-perl version of this