Module-Install-1.16/000700 000766 000024 00000000000 12521021366 014531 5ustar00etherstaff000000 000000 Module-Install-1.16/.travis.yml000644 000766 000024 00000000252 12516751575 016673 0ustar00etherstaff000000 000000 language: perl perl: - '5.20' - '5.18' - '5.16' - '5.14' - '5.12' - '5.10' - '5.8' install: - perl Makefile.PL - cpanm --quiet --installdeps --notest . Module-Install-1.16/Changes000644 000766 000024 00000113772 12521020260 016041 0ustar00etherstaff000000 000000 Changes for Perl programming language extension Module-Install 1.16 Sat 2 May 2015 - add missing test prereq on autodie 1.15 Thu 16 Apr 2015 - respect the 'urllist' option when using the CPAN backend (Dan Brook) - fixes for newlines on MSWin32 (Christian Walde) 1.14 Sat 25 Oct 2014 - Newlines should be consistently UNIX-stylee now in generated files (MITHALDU) - Mark two tests as TODO if EUMM > 6.98 until utf8 gets fixed (BINGOS) 1.12 Fri 29 Aug 2014 - Revert license behaviour (TSIBLEY) - Documentation also mentioning metacpan.org (LLAP) 1.10 Fri 11 Jul 2014 - Minimum perl version is now v5.6.0 (BOWTIE) - Update license tables (BOWTIE) - Prereqs and recommends adjusted (BOWTIE) - Typo fixes (BOWTIE) - Pod fixes (GREGOA) - Fix make upgradedeps work with bundles (JNWHITLEY) - Fix name_from regex to work with recent package syntax (BOWTIE) - Performance enhancements when running Makefile.PL (GFUJI) - Removed use of sub prototypes (BOWTIE) 1.08 Thu 6 Mar 2014 - Remove LWP::UserAgent from the prereqs (TOKUHIROM) - Require a more recent version of Module::ScanDeps (CHORNY) - Fix failing test case with recent Parse::CPAN::Meta (BINGOS) 1.06 Thu 1 Mar 2012 - Adding can_xs command, imported from Params::Util (ADAMK) - Adding requires_xs command, wrapping around can_xs (ADAMK) 1.05 Thu 28 Feb 2012 - Use Module::Metadata instead of require to check versions for modules that we don't need to subsequently use (MSTROUT/MIYAGAWA) Use EU:MM instead of Module::Metadata to check versions for modules that we don't need to subsequently use (ADAMK) - Removed automatic EU:MM version detection as it was using versions in the future, change to a fixed version, unf (ADAMK) 1.04 Thu 20 Oct 2011 - Fixed _cmp to compare properly (MIYAGAWA) - Fixed the automated MakeMaker dependency addition (MIYAGAWA) - Last Perl 5.5 compatible MakeMaker was actually 6.36 (ADAMK) 1.03 Wed 19 Oct 2011 - META.yml flag dynamic_config is now always generated (ADAMK) - Added the convenience command static_config, as the default is to be dynamic (ADAMK) - Module::Install::DSL will automatically set static_config unless it can see an 'if' or 'unless' suffix (ADAMK) 1.02 Thu 29 Sep 2011 - Support for installdeps_target in Module::Install::AutoInstall and Module::AutoInstall (Caelum) - Support for installdeps_notest, upgradedeps and upgradedeps_notest, listdeps and listalldeps targets in Module::AutoInstall (Caelum) 1.01 Wed 27 Apr 2011 - Better error message in install_share (CHORNY) - Compatibility with MYMETA.yml support in EUMM (CHORNY) - Support for extraction of Artistic 2.0 license (CHORNY) - Support https links when searching for bug trackers (CHORNY) 1.00 Tue 22 Jun 2010 - Remove obsolete text warning about nonexistent auto_install() woes - auto_install() wrongly merged build_requires entries into requires; note that it's correct build_requires entries are merged into requires if you use older versions of EUMM, which didn't support build_requires. (ISHIGAKI) 0.99 Tue 1 Jun 2010 - FindBin->again only works on 5.8.3 0.98 Mon 21 May 2010 - Resolved #57326: Tests fail when being run in parallel (by Florian Ragwitz) (ISHIGAKI) - Resolved #57335: Re: Problem with Module::Install + Fix (by Paul Makepeace) (ISHIGAKI) - Added "add_metadata" to add extra (experimental) metadata to META.yml (requested by Florian Ragwitz) (ISHIGAKI) - Fixed a test to check EU::MM version as only newer EUMM has MIN_PERL_VERSION (ISHIGAKI) - Made fixup_makefile a bit robust, not to be interfered by antivirus etc (ISHIGAKI) 0.97 Mon 10 May 2010 - Added missing LWP dependency, starting with 2 year old version (ADAMK) 0.96 Tue 10 May 2010 - Stop Bundle.pm pointlessly calling import() of bundled modules (MSTROUT) - Resolved #55464: Wrong license detection (by Jens Rehsack) (ISHIGAKI) - Resolved #55594: Missing license (by Salve J. Nilsen) (ISHIGAKI) - Resolved #5849 (load_extensions() causes "Subroutine %s redefined" warnings) (by Steve Hay) (ISHIGAKI) - Resolved #19445: unknown functions in Makefile.PL should fail. and #19449: license is not found if unknown function is present (both are the same issue) (ISHIGAKI) - Resolved #54890: MYMETA.yml creation doesn't work (by miyagawa) (ISHIGAKI) - Resolved #55974: FakeAdmin does not define (by Francesc Guasch) (ISHIGAKI) - Resolved #40230: test_requires and include (by Alexandr Ciornii) (ISHIGAKI) - Resolved #56460: Bundle documentation error? (by Florent Angly) (ISHIGAKI) - Resolved #56459: Cannot find bundle source for modules that contain sub-modules (patch by Florent Angly) (ISHIGAKI) - Resolved #56474: Dependency check error fails to be triggered (by Florent Angly) (ISHIGAKI) - Resolved #5528: Sub-directory builds don't work (by Steve Hay) (ISHIGAKI) - Resolved #56531: New patches for M::I::Bundle (patch by Florent Angly) (ISHIGAKI) - Resolved #56589 for Module-Install: Bundle's refactor (patch by Florent Angly) (ISHIGAKI) - Pass VERSION_FROM to EU::MM in the background to let it check version integrity (ISHIGAKI) - Improved tests and removed unnecessary directories/files (ISHIGAKI) - Added API.pod and FAQ.pod (ISHIGAKI) 0.95 Wed 10 Mar 2010 - Resolved #51614: POD nits (by Frank Wiegand) (ISHIGAKI) - Resolved #51077: auto_include_deps would mention the (test|build)_requires version. (by Tokuhiro Matsuno) (ISHIGAKI) - Resolved #51267: Consider moving load checks to import so require M::I will succeed (by David Golden) (ISHIGAKI) - Resolved #55050: Module::Install::AuthorTests is broken with M::I 0.93 and 0.94 (by AEvar Arnfjord Bjarmason) (ISHIGAKI) - Resolved #16569: author should take array to match META.yml spec and Module::Build (by MARKSTOS) (ISHIGAKI) - Resolved #53984: Don't use ExtUtils::Install to copy into blib (by Michael G Schwern) (ISHIGAKI) - Resolved #17893: Module::Install::Share ignores MANIFEST (ISHIGAKI) - Resolved #24194: Error msg: Your installer Makefile.PL has a modification time in the future (by RSAVAGE) (ISHIGAKI) - Resolved #33976: cc_inc_paths replaces INC provided on command line (by David Golden) (ISHIGAKI) - Resolved #25972: makemaker_args INSTALLDIRS => 'perl'; doesn't work (by TELS) (ISHIGAKI) - Resolved #45978: .pm.PL runs in wrong order for WriteMakefile (by Hilary Holz) (ISHIGAKI) - Resolved #19783: Query CPAN for new versions of Module::Install during "make dist" (by Steffen Mueller) (ISHIGAKI) - Resolved #27242: Bug(s) in license_from() (by Steve Hay) (ISHIGAKI) - Now license is properly passed to the EU::MM in the background (ISHIGAKI) - Added non-interactive session support, part of which was there some time before (ISHIGAKI) 0.94 Tue 23 Feb 2010 - Fixed critical author/xt bug (ADAMK) 0.93 Sun 7 Feb 2010 - Better search for 'Perl' license (CHORNY) - Added automatic executing of xt tests during either author() mode or when RELEASE_TESTING is enabled (ADAMK) 0.92 Thu 21 Jan 2010 - Support github.com bugtracker (CHORNY) - Made the matching phrase for the perl license a bit shorter to allow "the same terms as Perl 5.10" etc (ISHIGAKI) - Refactor part of license_from to separate sub, tests for a new sub (CHORNY) - Refactor part of perl_version_from to separate sub, tests for a new sub (CHORNY) - Allow spaces at the start of string when using perl_version_from (CHORNY) - The all_from command now stores the filename in the 'all_from' key for later reuse (MARCEL) - Support code.google.com bugtracker (CHORNY) - If the DSL code fails, say why (ADAMK) - Now autoinstall doesn't die on CPAN-1.81 (JJORE) - Check 'copyrights' section for license also (CHORNY) - Test passing correct params to EU::MM (CHORNY) - Use BUILD_REQUIRES EU::MM param for better OS packages (CHORNY) - Bundled prereqs will be removed from build prereqs only (CHORNY) - Use MIN_PERL_VERSION EU::MM param (CHORNY) - Better search for 'Perl' license (CHORNY) - Adding 'makemaker' command to make EU:MM version conditionals easier (ADAMK) - Removed a variety of Perl::MinimumVersion complaints (ADAMK) 0.91 Thu 28 May 2009 - Add missing dependency on Parse::CPAN::Meta 0.90 Fri 22 May 2009 - Adding a first implementation of MYMETA 0.89 Wed 20 May 2009 - _load_cpan now also checks for $CPAN::Config before assuming that CPAN and its config are properly loaded (HDP) - Changes file is now TIOBE compatible (ADAMK) - license_from now support a TIOBE-compatible declaration (ADAMK) (...under the same terms as the Perl programming language itself) 0.88 Thu 14 May 2009 - Show what version is currently installed when deps are not new enough (patch by RIBASUSHI, applied by MSTROUT) - Tweak _check_lock to not load CPAN when new enough -and- no env vars present - otherwise we still accidentally configure the thing for no good reason (MSTROUT, feeling particularly dumb) - Module::Install::Admin::Include now had a '=head1 NAME', which should avoid problems when generating man pages. Many thanks to Simon Bertrang for the patch. (PJF, RT #45811) 0.87 Thu 7 May 2009 - The other half of MSTROUT's changes - A note mentioning to bug MSTROUT if you run into problems 0.86 Sat 2 May 2009 - Add --alldeps option to say yes to optional dependencies (MSTROUT) - Alter _check_lock to test the CPAN version and use PERL5_CPAN_IS_RUNNING if new enough so we don't accidentally configure CPAN unless it's so old we have no choice (MSTROUT) - Tweak the SkipInstall logic so --skipdeps bypasses everything again including any loading of CPAN, no matter how old (MSTROUT) - Adding ./example, ./test and ./xt to the no_index list (ADAMK) - Removed $VERSION from the tests (ADAMK) - Various POD fixes (ADAMK) 0.85 Sun 19 Apr 2009 - Adam Kennedy - All files no use strict to satisfy Kwalitee (ADAMK) 0.84 Tue 14 Apr 2009 - Adam Kennedy - Fix incorrect if => unless conversion (CHORNY) 0.83 Tue 14 Apr 2009 - Adam Kennedy - Module::Install::DSL wasn't correctly loading the main Module::Install package when trying to install on a host that didn't have M:I installed locally (CSJEWELL) - Module::Install no longer supports Perl versions less than 5.005, so we can now safely just "require" File::Spec (ADAMK) 0.82 Wed 9 Apr 2009 - Adam Kennedy - If configure_requires has ExtUtils::MakeMaker and it's version requires perl 5.6, require perl 5.6 for dist in META.yml (CHORNY) - Fixes to Module/AutoInstall.pm: (MSTROUT) - don't prompt for required dependencies under CPAN/CPANPLUS - allow PERL_AUTOINSTALL_PREFER_CPAN env var to disable cpanp use - Module::Install::DSL now correctly installs itself into the generated tarball (ADAMK) - Preferentially dispatch leading-underscore methods used in plugins to the main Module::Install object (ADAMK) 0.81 Tue 24 Mar 2009 - Adam Kennedy - Use 3-argument open when Perl >= 5.006 (ADAMK) - Support for 'keywords' key in META.yml (CHORNY) - More URLs for licenses, test for this (CHORNY) - tests for extracting link to bugtracker, will more correctly extract them (CHORNY) - Adding version-normalising Module::Install::_cmp (for <=> equivalent on versions) (ADAMK) - If the Makefile.PL time is in the future by only a few seconds (probably due to 2-second filesystem time rounding on Win32) sleep for 5 seconds to avoid the problem. (ADAMK) - Moving from Module::Install::DSL to inc::Module::Install::DSL (to reduce the Makefile.PL header for DSL mode to one line) (ADAMK) - Adding convenience pod reading Module::Install::_readpod (ADAMK) - Adding convenience pod stripping Module::Install::_readperl (ADAMK) - Adding experimental requires_from command to auto-detect requires (ADAMK) - Add a "Writing MYMETA.yml" status message (ADAMK) - Generalising boolean commands (ADAMK) - Cleaner removal of files during realclean (ADAMK) - Write META.yml and MYMETA.yml after Makefile to pick up a couple of extra implicit dependencies. (ADAMK) - Set a high configure_requires on ExtUtils::MakeMaker for any client that supports configure_requires. (ADAMK) - Add a full resolution test for Module::Install::DSL (ADAMK) - If we write MYMETA.yml, remove it at realclean time (ADAMK) - Removed the 'Removing META.yml' warning 0.80 Tue 17 Mar 2009 - Adam Kennedy - Don't generate MYMETA.yml if we don't have YAML::Tiny, even if we've said we need it. This was breaking Catalyst. (ADAMK) - Will not ask about auto-installing mandatory dependencies, if $ENV{PERL5_CPANPLUS_IS_RUNNING} is set (CHORNY) 0.79 Wed 4 Feb 2009 - Adam Kennedy - Upgrading (and testing) Perl version normalisation - Adding an experimental-grade implementation of MYMETA.yml 0.78 Sun 25 Jan 2009 - Adam Kennedy - Much more aggressive dependencies, except PAR::Dist (ADAMK) - Adding inc::Module::Install::DSL for simple installs (ADAMK) - We now avoid poking references in @INC in case they have strange overload behaviours. (PJF, RT #39929) - installdirs and install_as_* are now documented in Module/Install.pod (PJF, RT #25111) - Applied patch RT #38443 from Oleg Kostyuk for two-part version numbers being passed to perl_version. Calling 'perl_version 5.8' should now work the same as 'perl_version 5.008'. Additional tests added to t/07_perl_version.t to check this. (PJF, RT #38443) - Module::Install no longer complains about the phrase "All rights reserved" in association with open source licenses. (PJF, RT #41268) 0.77 Fri 8 Aug 2008 - Adam Kennedy - Don't break directories starting with inc(oming) (ADAMK, RT #30637) - Adding more phrases to recognise GPL variants (ADAMK, RT #35195) - Skip 03_autoinstall.t except at release, as it can hang in some situations (ADAMK, #29448) - Add a file check to the all_from param (ADAMK, #24586) - Fixed bug in can_run when PATH starts with a sep (ADAMK, #29866) - Don't overwrite dist args if there is a preop (ADAMK, #36831) - Bug fix in the command dispatcher (ADAMK, #27327) - perl_version now understands three-part Perl versions like 5.8.1 (PJF, RT #38317) - Numify version.pm objects when generating YAML (ADAMK) 0.76 Thu 17 Jul 2008 - Adam Kennedy - ExtUtils::MakeMaker no longer complains when its version contains an underscore. (PJF, RT #35800) - Documentation patches to Module::Install::Admin and Module::Install::Base. (Adriano Ferreira, RT #27696) - Corrected broken internal link in Module/Install.pod. (PJF) - The 'examples' directory will no longer be included twice in META.yml/no_index/directory. (PJF) - Move to the new 1.4 version of the META.yml specification (ADAMK) - Automatically provide resources:license for license('perl') (ADAMK) - Implemented the bugtracker_from command (ADAMK) - Added bugtracker_from to the all_from command (Although we don't warn if not provided) (ADAMK) - Shifting minimum perl version for Module::Install to 5.005 (Anything older should use ExtUtils::MakeMaker) (ADAMK) - perl_version errors if it gets a value less that 5.005 (ADAMK) - Created the new install_share implementation (ADAMK) - Added the ppport function for adding ppport.h (ADAMK) - Bumped File::Remove from test_requires to requires (ADAMK) - Added dependency on Devel::PPPort for ppport (ADAMK) 0.75 Mon 2 Jun 2008 - Adam Kennedy - Documenting the smaller post Module::Build core package Module::Install::With and removed experimental warning (ADAMK) - Disabled the broken install_share error check (CLACO) - Disabled "pointless version 0" warning, as it encourages less metadata (ADAMK) - Adding an experimental undocumented implementation of a "resources" and "repository" command (ADAMK) - Don't dump "tests" and "installdirs" to META.yml (ADAMK) 0.74 Mon 26 May 2008 - Adam Kennedy - Fix incorrect comparison of module and distribution names (RJBS) - Allow "require" instead of "use" when finding required perl version (RJBS) - Remove the -f Build.PL check, as it was breaking for people trying to convert from M:B to M:I or vice versa (MSTROUT) 0.73 Wed 14 May 2008 - Adam Kennedy - Aggressively increase dependencies for authors to make sure all the latest release-time tricks will work properly. (ADAMK) - When generating META.yml where there is an overall Perl version dependency, add a test for unversioned core dependencies that MUST already be satified by the Perl dependency. (ADAMK) - Merged Module::Install MANIFEST.SKIP into the repository default MANIFEST.SKIP file, and deleted the M:I one (ADAMK) 0.72 Tue 15 Apr 2008 - Adam Kennedy - exit(0) on requires_external_bin to make it a real NA (ADAMK) - Change docs to recommend the use of test_requires instead of build_requires. They do the same thing now, but this may change in the future and in that case better people use test_requires now as it is a more accurate description of intent. Also, it reads clearer. (ADAMK) - Removed the command prompt_script, it did some unusual magic and it easy enough to replace with 2 lines of code in the Makefile.PL of anyone using it anyway (ADAMK) - Merged the remaining install_script into Metadata.pm (ADAMK) - Adding documentation about the configure_requires command (ADAMK) - Automatically add any install_share directory to no_index (ADAMK) - Check scripts passed to install_script actually exist (ADAMK) - Allow install_script('foo') to be shorthand for install_script('script/foo') if no root 'foo' file exists. This should allow for yet more typing reduction (ADAMK) - For even more typing reduction, "use inc::Module::Install" now acts as an implicit "use strict", so you don't need to use strict in Makefile.PL (ADAMK) - Fixed a regex bug in name_from (and thus all_from) (ADAMK) 0.71 Mon 24 Mar 2008 - Adam Kennedy - YAML::Tiny is now good enough to use exclusively (ADAMK) - Converted Changes file to my normal format, so that my release automation can deal with it properly (ADAMK) - Added name_from to auto-detect name, and include name_from in all_from, so now no name line is needed at all in the Makefile.PL (ADAMK) - Removed the redundant Module::Install::Makefile::Name and Module::Install::Makefile::Version, they were almost never used and were a bit too magic. (ADAMK) - Adding a "wrote" flag to the M:I object in preparation for making WriteAll implicit by default (ADAMK) - Correcting 01_compile.t to check for 5.004 instead of 5.005 (ADAMK) - Added Module::Install::_version to numify CPAN-like versions properly (ADAMK) - Split TestHelper out as it's own t/lib/Test module (ADAMK) - Upgrade from File::Path::rmtree to File::Remove::remove in the test scripts. (ADAMK) - Various documentation clean ups (ADAMK) - If building in author mode, make sure that auto-generated META.yml files are deleted properly during 'make clean' (ADAMK) 0.70 Tue 18 Mar 2008 - Adam Kennedy - Temporarily restoring auto_install until Matt Trout can craft a replacement for their installdeps needs, and for feature support (ADAMK) 0.69 Sat 15 Mar 2008 - Adam Kennedy - Removing auto_install support (ADAMK) - Removing Build.PL support (ADAMK) - Enabling configure_requires support (ADAMK) - Automatically set a configure_requires for the version of ExtUtils::MakeMaker that the author is running (ADAMK) - Refactoring a number of modules for reduced size (ADAMK) - Add 'share' to the list of directories automatically no_index'ed (ADAMK) - license_from correctly marks "GNU lesser public license" as lgpl, not gpl [rt.cpan.org 24635] (AVAR) - set author mode ($Module::Install::AUTHOR) when first creating ./inc (RJBS) - Don't write perl into PREREQ_PM when using perl_version (ADAMK) 0.68 - Ricardo Signes - The author entry in META.yml is now a sequence, as required 0.67 - Adam Kennedy - Tweaked the license detection code a bit - Previous changes working well, going production 0.66_02 - Adam Kennedy - Adding detection of 'proprietary' license. - "All rights reserved" clashes with or can invalidate most Open Source licenses. Adding a warning to this effect. 0.66_01 Thu 15 Mar 2007 - Adam Kennedy - Adding tests_recursive to have M:I search for and explicitly list all test scripts recursively. - Adding configure_requires, test_requires and install_requires. These are currently aliases for build_requires but will later result in alternative consequences internally (ADAMK) - Reorganising Module::Install::With on the assumption that CPAN.pm will be implementing PERL5_CPAN_IS_EXECUTING. 0.65 Tue 6 Mar 2007 - Adam Kennedy - Add install_as_core, install_as_cpan, install_as_vendor commands to control the "installdirs" metadata field. Requested by: Tels (renamed by ADAMK and AUDREYT) - Add the preop command for users to customize the PREOP rule. (BINGOS) - Implement support for $ENV{PERL5_CPANPLUS_IS_EXECUTING} in the experimental Module::Install::With. (ADAMK) - Remove the use of features in the Module::Install Makefile.PL. Developers should be quite capable of installing them all. (ADAMK) - Remove the use of auto_provides in Module::Install Makefile.PL until we fix it to not break without a pre-existing MANIFEST. (ADAMK) - YAML::Tiny is now used as a fallback for generating META.yml. The order of precedence is now YAML::Syck, YAML::Tiny, then YAML. - META.yml output is now conformant to spec 1.3. - Add MIT license to those detectable by license_from() (GAAL) 0.64 Thu 24 Aug 2006 - Adam Kennedy - auto_install() will no longer invoke CPAN.pm or CPANPLUS recursively when running under CPANPLUS (i.e., when $ENV{PERL5_CPANPLUS_IS_RUNNING} is set to a true value.) - auto_install() would not follow prerequisites of requires() when the module is installed from the command line and only CPAN.pm is installed. [rt.cpan.org 21139] (MSCHWERN) 0.63 Mon 5 Jun 2006 - Adam Kennedy - "make" gets confused if the Makefile.PL time is in the future, but there is no universal fix for this. As an initial solution, catch the error situation and die with an error to the user. (ADAMK) - Adding additional notes on no_index package (ADAMK) - Removing hashbang from Makefile.PL and using a $^W = 1 instead (ADAMK) 0.62 Wed 3 May 2006 - Adam Kennedy - Various small back-compatibility bugs squashed, since we advertise that a M:I installer should run back to 5.004 (AUDREYT) - Allow non-admin installs to do so without the need for YAML.pm (AUDREYT) - Adding an initial implementation of Module::Install::With, containing code to detect the existance of other members of the Perl toolchain, and how we are related to them in any given install run. Initial experimental implementation of CPAN.pm and CPANPLUS detection, based on code extracted from Module::AutoInstall, and other code recommended by the relevant authors. Leaving the new commands undocumented for now, and recommend NOT making general use of them until tested. (ADAMK) - In order to implement any form of version locking, which need to know which extensions are in the core (and thus version-locked) and which are custom extensions with legally out-of-sync versions. Added $ISCORE = 1 global to every potentially-bundled core extention, for when we start to do version locking. (ADAMK) - The install_share Makefile fragment fails on older ExtUtils::Install versions. When we install_share, add an explicit EU::MakeMaker dependency. Would have done on just ExtUtils::Install, but it isn't PREFIX/PERL5LIB-safe. (ADAMK) - Some/many versions of MakeMaker incorrectly set PERL_LIB and PERL_ARCHLIB, which is only supposed to be used for building the core Perl. Since we'll never be doing that, make the Makefile munger blank them if they exist. This lets PREFIX + PERL5LIB for installing private modules work again. (except not PERL_ARCHLIB for now, it's not getting in the way, and for some reason it's used for something else) (ADAMK) 0.61 Sat 15 Mar 2006 - Adam Kennedy - ActivePerl::Config on case-insensitive filesystems interacts erroneously with Module::Install's (outdated) @INC hack, so remove it. (Patch from Gisle Aas) - Improve compatibility with ExtUtils::MakeMaker 5.x by not relying on FIRST_MAKEFILE being set in the MM instance. - Remove optional dependency on CPANPLUS. (INGY) - Add "realclean_files" command to add files to be cleaned on "make realclean", instead of "make clean". (INGY) - Add $VERSION back to inc::Module::Install so we can implement workarounds and back-compatibility code later on. (ADAMK) 0.60 Tue 11 Mar 2006 - Adam Kennedy - Cleaned up the 0.59 fix a bit and added a bunch of comments explaining the bootup mechanism. A misunderstanding of this on my part led to the 0.58 bug. Sorry folks (ADAMK) - Resolved #18040: bundled Module::Install leaks private information Debugging information in Module::Install::Admin was leaking potentially sensitive information. Removed just the files, left the lines (TELS) - Fixed a smaller part of the problem with 0.58 that still hurts people if that are an installer AND an author as well. (Reported by dha) 0.59 Fri 7 Mar 2006 - Adam Kennedy - Resolved #18020: 0.58 was broken; inc::Module::Install's @ISA and $VERSION needs to be set by Module::Install on its behalf. (TELS) 0.58 Tue 4 Mar 2006 - Adam Kennedy - Made Module::AutoInstall generally aware of AUTOMATED_TESTING - Added compatibility with 5.9.3 proxy constants - Resolved #11169: problems on VMS. This doesn't mean there won't be problems on VMS though, as this path is oldish and their may be more problems. - Added AUTOMATED_TESTING support to prompt() to force the selection of the default (via PERL_MM_USE_DEFAULT) when it is enabled. - Added infinite loop protection to prompt() just in case automated and/or shortcutted responses to prompts go badly and leave us looping over the same question. - Fixed #17961 Use of uninitialized value in array dereference at Module/Install/Metadata.pm line 163. (TELS) 0.57 Thu 23 Feb 2006 - Adam Kennedy - Fixed a bug where a misnamed hash key was making the extensions fruitlessly reload (or at least try to reload) every command call. - Fixed a pod bug for the requires_external_bin head2 - Because external deps will need versioning eventually, we can never provide a hash to requires_external, and so it's really just supurfluous and invites more bugs. Removed. - Experimentally added support for the META.yaml dynamic_config flag. We don't set ANY default value, because of a lack of clarity. It is undocumented in the META.yaml spec, but false in Module::Build, which is really really bad, as it leads to falsely assuming dynamic Makefile.PLs are static when no dynamic_config is provided. Personally, I think it should be static_config anyway, and we may well change it to be that anyway. - Added support for requires_external_cc (requires a C compiler) that will integrate with whatever central method we use later to signal to whatever is calling Makefile.PL that there is a missing external dependency. This will also be called by other methods if there is an implicit dependency. - Synchronised all the module versions to all be 0.57. This will be used a few versions down the line to add integrity testing of Module::Install's own extension loading process. - Added a $VERSION and C to the extensions that didn't have one or both of the two already. - Fixed a number of minor bugs discovered after turning on C. - Very carefully beginning to clean up some of the code so it's much more boring (i.e. maintainable). - Changed recursion to always preference the installer we are currently running under. So use CPAN.pm in CPAN.pm, and CPANPLUS in CPANPLUS. This simplifies anti-dupe recursion algorithms, and dramatically reduces memory use under CPAN.pm. - Documented the install_script command - Caught _install_cpanplus happily passing completely illegal CPAN.pm config params to CPANPLUS, and worse, eval-wrapping the set_conf so it could happily ignore errors. Added _cpanplus_config to try and auto-convert CPAN config params to CPANPLUS, and die if we can't. Add more translators as needed. - Moved the deprecated commands into their own module Module::Install::Deprecated to stop them being included and reduce package bloat. 0.56 Sun 12 Feb 2006 - Adam Kennedy - Added experimental support for requires_external_bin to forcefully require the installation of a script or command. - Removed a warning in Module::Install::Admin::MetaData when perl_version doesn't have a third part. 0.55 Fri 27 Jan 2006 - Adam Kennedy - This release only not signed (Released by ADAMK who has no keys) - Another pass over the POD to clean up and remove mistaked (ADAMK) - Module::Install::Share installs to blib/lib rather than blib/arch. Most files will be non-arch-specific, and it was causing problems down the road with File::ShareDir. All existing working install_share/File::ShareDir continues to work. - New command auto_include_dependent_dists() to recursively include dependent CPAN distributions for modules declared with build_requires(). This differs from auto_include_deps() because it works with whole distribution source trees, not just single modules. - Fix POD syntax so t/2-pod.t passes. Contributed by: Ishigaki Kenichi - Disable 5.00503-specific qr// construct in t/3-autoinstall.t so Perl 5.004 can build this module again. - YAML::Syck 0.27+ is now a preferred dependency over YAML 0.35+ for platforms with a C compiler and without either one available. 0.54 Wed 11 Jan 2006 - Fix can_run() on Cygwin for real. Contributed by: Mark Grimes 0.53 Wed 11 Jan 2006 - Fix can_run() on Cygwin for paths beginning with /cygdrive/. Reported by: Mark Staggs - If YAML::Syck is present on the system, use it instead of YAML.pm to write out META.yml. 0.52 Tue 3 Jan 2006 - Module::AutoInstall - disable "sudo" prompting for CPANPLUS 0.050 and CPAN.pm 1.80+ which already has "sudo" support. Reported by: Andreas Koenig 0.51 - 2005-12-31 - An additional 100+ lines of documentations in the Module::Install POD file. - all_from() with no args now attempts to decude the "from" file from the "name" property. - On Cygwin, sometimes AUTOLOAD is called with a gensym'ed package that does not define _top. Try to accomodate for this. - Do not ever attempt "sudo" without interactive consent from the user; make the _prompt() in Module::AutoInstall default to 'n' if we are not running in an interactive terminal. - Add lib_paths and lib_links commands to Module::Install::Compiler for setting LIBS flags. 0.50 Mon 26 Dec 2005 - Fixed the bug where cpan signing was set forcibly to true instead of defaulting to false. Reported by: Martin Thurn and Randal Schwartz - Module::Install::Admin's copy() subroutine was using a lot of CPU on inefficient regex matches, where a simple passthrough while() line-processing loop would do. - The t/ directory is now listed in META.yml's no_index entries by default, along with inc/. - YAML.pm is now listed as an explicit dependency. 0.48 Mon 26 Dec 2005 - New Module::Install::Compiler extension with commands: c_files(), inc_paths(), optimize_flags(). 0.47 Sun 25 Dec 2005 - Slight documentation cleanup and update Module::Install::Admin version to 0.47; no functional changes. 0.46 Thu 22 Dec 2005 - tests() should always take effect even if auto_install() or makemaker_args() had set it before. Reported by: Jesse Vincent. 0.45 Fri 16 Dec 2005 - Improved detection for author_from() based on the copyright line in addition to =head1 AUTHORS. - Bump version of Module::Install::Admin to match Module::Install. Reported by: Sebastian Riedel 0.44 Tue 13 Dec 2005 - Module::Install::Bundle now extract files correctly again; this was a regression since 0.40. Reported by: Randal Schwartz - Add support to Module::Includes::Bundle so each subdirectory can use Module::Install for bundling. - The "bundles:" key in META.yml is now populated even if the bundled modules already exist on the system. 0.43 Mon 12 Dec 2005 - Better documentation to install_share(). - New author_from() command to guess the author name from POD. - all_from() no longer probes for metadata that has been set before. 0.42 Sun 11 Dec 2005 - auto_provides() was broken due to a typo. - New command install_share() to put a directory's content into the per-distribution auto/ directory. 0.41 Sun 11 Dec 2005 - Only query '$self->tests' if we haven't been given an explicit list (From Paul Fenwick) - New command auto_provides() to calculate "provides:" information using Module::Build. Requested by Chia-Liang Kao. 0.40 Wed 7 Dec 2005 - Massively updated documentation (more to come later). - Parentheses are now optional in Makefile.PL. - Includes Module::AutoInstall, a cleaned-up version of ExtUtils::AutoInstall. - New command all_from() to combine all *_from() tests into one. - New command test() to Support specifying test files. - New command feature() to list individual features easily. 0.37 Thu 4 Aug 2005 - Always include ExtUtils::AutoInstall in inc/ if auto_install() is called. - Fixed a bug where modules having shared libraries would sometimes be included in inc/. - The needs shared library message will now only be printed if the module version indicates that it would otherwise be included. The module name has also been corrected so that "::" is used everywhere instead of "/". 0.36 Thu 9 Sep 2004 - First version under SVK management. - install_scripts() now takes multiple scripts to install. 0.35 Tue 13 Jul 2004 - Jos Boumans reported that "use inc::Module::Install 0.34" was failing because Module::Install does not assign VERSION to inc::Module::Install. - Implemented auto_include_deps() for real. 0.34 Thu 1 Jul 2004 - auto_include() will not include recursive dependencies now; that functionality is refactored into auto_include_deps(). 0.33 Thu 11 Mar 2004 - abstract_from() was broken; it works now thanks to SHAY. - WriteAll() now takes (inline => 1) to support Inline-based modules. 0.31 Wed 31 Dec 2003 - Allow auto_install() to take -core-specific options like (-default => 0). - No longer use inc/SCRIPT but simply modify the scripts to install. - Make can_cc() to probe the program part of $Config{cc} - Bundled M::I-using modules (or subdirs) used to break up spectacularly by overriding ::AUTOLOAD and reusing their parents' inc/*. Now the namespaces are keyed by cwd and more readily unregistered. 0.29 Sun 14 Dec 2003 - Introducing &WriteAll, a combination of &Meta->write, &check_nmake, &Makefile->write, and if a Build.PL is present (which should read "require 'Makefile.PL'"), also supports transparent &Build->write. - Real Module::Build support in WriteAll and in this module. - Transparent Build.PL, as promised in README, is back. - WriteAll now takes three non-metadata flags: check_nmake (default 1), meta (default 1) and sign (default 0). - The "private" key in META.yml is officially obsoleted by "no_index". - Now warns if the user did not specify a license. - "requires( perl => $version )" is now supported. - include_deps() now no longer takes its second argument; it must be separately supplied with the syntax above. - "&WriteAll" now officially replaces "&Build->write", "&Makefile->write", "&Meta->write" and "check_nmake()". - Implemented auto_include() and bundle_deps(). - Add "#defaults" to MANIFEST.SKIP. 0.28 Thu 11 Dec 2003 - Module::Install::Bundle now works, thanks to Adam Foxson! - Unbreak against newer EU::MM. - Let "inc" work with "make test" on 5.6.x too. - mcdavis pointed out that Microsoft now wants "Nmake15.exe", not "nmake15.exe". 0.27 Mon 27 Oct 2003 - Make the include'd modules actually work during "make" and "make test", by adding "inc" to the Makefile targets. - Graham's patch for 5.004 backcompat. - Graham Barr points out that readdir() can return 0. - Do not sign the distribution if we are not the admin. 0.26 Fri 17 Oct 2003 - sign(1) support for automatic digital signing. - no_index(directory => 'example') support, for telling PAUSE and search to skip indexing modules. 0.25 Mon 13 Oct 2003 - Add no_index as an alias to private in META.yml. - Support for YAML::Parser::Syck. - No point in supporting Build.PL now. 0.24 Mon 1 Sep 2003 - 0.17 is simply too old as it scans in POD sections. - Kingpin notes that we are using "next" outside a loop block in ScanDeps. - threads.pm and warnings.pm should be exempted too. 0.23 Mon 18 Aug 2003 - Implemented $self->is_admin to properly test if it's running on the admin side. - Andreas Koenig reports that we are writing META.yml even on the user side, because of this bug. - Switch to PAR::Dist to do make_par(). 0.22 Wed 16 Jul 2003 - Turns out that MakeMaker's NAME corresponds to META.yml's module_name, and DISTNAME corresponds to name. Reflect this in the relevant files. - Introduce a new module_name metadata key that may be automatically generated from name. - /\.pm/i should be /\.pm$/i. - Iain Truskett wants us to not overwrite alien META.yml files. - PREREQ_PM wasn't being filled out. - Should be including YAML dependencies too. - POD cleanups. 0.21 Sun 15 Jun 2003 - Lindsay Morris pointed out that include_deps() does not work with non-core modules; fixed. 0.20 Thu 5 Jun 2003 - Add pointer to ingy's TPJ article. - Eliminated warnings on 5.005. - Added the "package inc::Module::Install;" line at request by Graham Barr, for search.cpan.org. - Close META.yml before zipping; otherwise trips on win32. - requires(), build_requires(), recommends() etc can now take multiple pairs in addition to a single pair. - Add standard MANIFEST and META.yml to generated PAR file. - Implemented the &Meta->read mentioned in the main docs. - Our version of WriteMakefile was failing to fine Meta object; fixed. - 'make reset' now just an author side alias for 'make purge'. - The whole #! business is unneeded since MakeMaker does that. - Don't skip other non-pm inc/ stuff when checking MANIFEST. - The hashbang line should be the first, not last, in scripts. - Also people may not always like -w. - We reall want to rmtree() the distdir so that 'make manifest' won't include clobbered files after an aborted 'make dist'. - Fix consistency: ->prompt() should only take one line of prompt and expects y/n. Module-Install-1.16/MANIFEST000644 000766 000024 00000003752 12521021360 015675 0ustar00etherstaff000000 000000 .travis.yml Changes lib/inc/Module/Install.pm lib/inc/Module/Install/DSL.pm lib/Module/AutoInstall.pm lib/Module/Install.pm lib/Module/Install.pod lib/Module/Install/Admin.pm lib/Module/Install/Admin/Bundle.pm lib/Module/Install/Admin/Compiler.pm lib/Module/Install/Admin/Find.pm lib/Module/Install/Admin/Include.pm lib/Module/Install/Admin/Makefile.pm lib/Module/Install/Admin/Manifest.pm lib/Module/Install/Admin/Metadata.pm lib/Module/Install/Admin/ScanDeps.pm lib/Module/Install/Admin/WriteAll.pm lib/Module/Install/API.pod lib/Module/Install/AutoInstall.pm lib/Module/Install/Base.pm lib/Module/Install/Bundle.pm lib/Module/Install/Can.pm lib/Module/Install/Compiler.pm lib/Module/Install/Deprecated.pm lib/Module/Install/DSL.pm lib/Module/Install/External.pm lib/Module/Install/FAQ.pod lib/Module/Install/Fetch.pm lib/Module/Install/Include.pm lib/Module/Install/Inline.pm lib/Module/Install/Makefile.pm lib/Module/Install/MakeMaker.pm lib/Module/Install/Metadata.pm lib/Module/Install/PAR.pm lib/Module/Install/Philosophy.pod lib/Module/Install/Run.pm lib/Module/Install/Scripts.pm lib/Module/Install/Share.pm lib/Module/Install/Win32.pm lib/Module/Install/With.pm lib/Module/Install/WriteAll.pm Makefile.PL MANIFEST This list of files MANIFEST.SKIP META.yml README t/01_compile.t t/02_mymeta.t t/03_autoinstall.t t/04_version.t t/05_share.t t/06_ppport.t t/07_perl_version.t t/08_dsl.t t/09_read.t t/10_test.t t/11_extraction.t t/12_eumm_params.t t/13_author_tests.t t/13_author_tests_ext.t t/13_author_tests_ext2.t t/14_auto_include_deps_with_version.t t/15_wrong_usage.t t/16_require.t t/17_sign.t t/18_all_from.t t/19_authors.t t/20_authors_with_special_characters.t t/21_makemaker_args.t t/22_installdirs.t t/23_pl_files.t t/24_multiple_license_blocks.t t/25_perl_version_from.t t/26_unknown_func.t t/27_build_requires_and_include.t t/28_makemaker_args.t t/29_requires_from.t t/30_build_subdirs.t t/31_add_metadata.t t/32_module_name.t t/33_copy.t t/34_readwrite.t t/lib/Test.pm t/recursive/test.t xt/licenses.t Module-Install-1.16/MANIFEST.SKIP000644 000766 000024 00000002320 12521021157 016434 0ustar00etherstaff000000 000000 #!start included /Volumes/amaretto/Users/ether/perl5/perlbrew/perls/21.11/lib/5.21.11/ExtUtils/MANIFEST.SKIP # Avoid version control files. \bRCS\b \bCVS\b \bSCCS\b ,v$ \B\.svn\b \B\.git\b \B\.gitignore\b \b_darcs\b \B\.cvsignore$ # Avoid VMS specific MakeMaker generated files \bDescrip.MMS$ \bDESCRIP.MMS$ \bdescrip.mms$ # Avoid Makemaker generated and utility files. \bMANIFEST\.bak \bMakefile$ \bblib/ \bMakeMaker-\d \bpm_to_blib\.ts$ \bpm_to_blib$ \bblibdirs\.ts$ # 6.18 through 6.25 generated this \b_eumm/ # 7.05_05 and above # Avoid Module::Build generated and utility files. \bBuild$ \b_build/ \bBuild.bat$ \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # and Module::Build::Tiny generated files \b_build_params$ # Avoid temp and backup files. ~$ \.old$ \#$ \b\.# \.bak$ \.tmp$ \.# \.rej$ \..*\.sw.?$ # Avoid OS-specific files/dirs # Mac OSX metadata \B\.DS_Store # Mac OSX SMB mount metadata files \B\._ # Avoid Devel::Cover and Devel::CoverX::Covered files. \bcover_db\b \bcovered\b # Avoid prove files \B\.prove$ # Avoid MYMETA files ^MYMETA\. #!end included /Volumes/amaretto/Users/ether/perl5/perlbrew/perls/21.11/lib/5.21.11/ExtUtils/MANIFEST.SKIP \.tar\.gz$ ^Module-Install-\d ^t/Foo ^inc Module-Install-1.16/META.yml000644 000766 000024 00000004564 12521021357 016025 0ustar00etherstaff000000 000000 --- abstract: 'Standalone, extensible Perl module installer' author: - 'Adam Kennedy ' build_requires: ExtUtils::MakeMaker: 6.59 Test::Harness: '3.13' Test::More: '0.86' autodie: 0 configure_requires: ExtUtils::MakeMaker: 6.59 YAML::Tiny: '1.33' distribution_type: module dynamic_config: 0 generated_by: 'Module::Install version 1.16' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Module-Install no_index: directory: - inc - t - xt recommends: Archive::Zip: '1.37' File::HomeDir: '1' JSON: '2.9' LWP::Simple: '6.00' LWP::UserAgent: '6.05' PAR::Dist: '0.29' requires: Devel::PPPort: '3.16' ExtUtils::Install: '1.52' ExtUtils::MakeMaker: '6.59' ExtUtils::ParseXS: '2.19' File::Path: 0 File::Remove: '1.42' File::Spec: '3.28' Module::Build: '0.29' Module::CoreList: '2.17' Module::ScanDeps: '1.09' Parse::CPAN::Meta: '1.4413' YAML::Tiny: '1.38' perl: 5.6.0 resources: license: http://dev.perl.org/licenses/ repository: https://github.com/Perl-Toolchain-Gang/Module-Install.git version: '1.16' x_contributors: - 'Adam Kennedy ' - 'Kenichi Ishigaki ' - 'Alexandr Ciornii ' - 'Chris Williams ' - 'Paul Fenwick ' - 'bowtie ' - 'Matt S Trout ' - 'Karen Etheridge ' - "Chris \\BinGOs' Williams " - 'Christian Walde ' - 'Ricardo Signes ' - 'Ingy ' - 'Hans Dieter Pearcey ' - 'Olivier Mengue ' - 'Curtis Jewell ' - 'Rafael Kitover ' - 'Avar Arnfjord Bjarmason ' - 'Dan Brook ' - 'Leo Lapworth ' - 'Marcel Grunauer ' - 'Alex Vandiver ' - 'Joshua ben Jore ' - 'Ash Berlin ' - 'gregor herrmann ' - 'Gabor Szabo ' - 'Thomas Sibley ' - 'Tokuhiro Matsuno ' - 'Tom Wyant ' - 'Kang-min Liu ' - 'David Golden ' - 'Kent Fredric ' Module-Install-1.16/Makefile.PL000644 000766 000024 00000007274 12521020332 016517 0ustar00etherstaff000000 000000 use strict; use warnings; # NOTE: Module::Install's Makefile.PL needs this "use lib 'lib'" to # bootstrap itself. Other module distributions using Module::Install # do not need it. It causes inc::Module::Install to load from the # (unique to this distribution) file ./lib/inc/Module/Install.pm instead # of the system inc::Module::Install or the bundled ./inc/Module/Install.pm use lib 'lib'; use inc::Module::Install; name 'Module-Install'; author 'Adam Kennedy '; perl_version '5.006'; all_from 'lib/Module/Install.pm'; requires 'Devel::PPPort' => '3.16'; requires 'ExtUtils::Install' => '1.52'; requires 'ExtUtils::MakeMaker' => '6.59'; requires 'ExtUtils::ParseXS' => '2.19'; requires 'File::Path' => 0; #needs version requires 'File::Remove' => '1.42'; requires 'File::Spec' => '3.28'; requires 'Module::Build' => '0.29'; requires 'Module::CoreList' => '2.17'; requires 'Module::ScanDeps' => '1.09'; #detects prereqs better requires 'Parse::CPAN::Meta' => '1.4413'; requires 'Win32::UTCFileTime' => '1.56' if win32; requires 'YAML::Tiny' => '1.38'; test_requires 'Test::Harness' => '3.13'; test_requires 'Test::More' => '0.86'; test_requires 'autodie' => '0'; recommends 'Archive::Zip' => '1.37'; recommends 'File::HomeDir' => '1'; recommends 'JSON' => '2.9'; recommends 'LWP::Simple' => '6.00'; recommends 'LWP::UserAgent' => '6.05'; recommends 'PAR::Dist' => '0.29'; # Remove some extra test files clean_files( qw{ t/Foo } ); # Test configure_requires support (also needed by WriteMyMeta) configure_requires 'YAML::Tiny' => '1.33'; # Makes the recursive test script run # (to test recursive test support) tests_recursive; # This is a normal CPAN module install_as_cpan; # Normally this shouldn't be done in here, it should be done # by release automation. This is mostly for testing reasons. repository 'https://github.com/Perl-Toolchain-Gang/Module-Install.git'; # All of our dependencies are the same on all platforms dynamic_config 0; add_metadata x_contributors => [ # manually added, from git shortlog -e -s -n 'Adam Kennedy ', 'Kenichi Ishigaki ', 'Alexandr Ciornii ', 'Chris Williams ', 'Paul Fenwick ', 'bowtie ', 'Matt S Trout ', 'Karen Etheridge ', 'Chris \BinGOs\' Williams ', 'Christian Walde ', 'Ricardo Signes ', 'Ingy ', # 'Ingy döt Net ', 'Hans Dieter Pearcey ', 'Olivier Mengue ', # 'Olivier Mengué ', 'Curtis Jewell ', 'Rafael Kitover ', 'Avar Arnfjord Bjarmason ', # 'Ævar Arnfjörð Bjarmason ', 'Dan Brook ', 'Leo Lapworth ', 'Marcel Grunauer ', # 'Marcel Grünauer ', 'Alex Vandiver ', 'Joshua ben Jore ', 'Ash Berlin ', 'gregor herrmann ', 'Gabor Szabo ', 'Thomas Sibley ', 'Tokuhiro Matsuno ', 'Tom Wyant ', 'Kang-min Liu ', 'David Golden ', 'Kent Fredric ', ]; WriteAll; Module-Install-1.16/README000644 000766 000024 00000063325 12514015554 015440 0ustar00etherstaff000000 000000 NAME Module::Install - Standalone, extensible Perl module installer SYNOPSIS In your Makefile.PL: (Recommended Usage) use inc::Module::Install; # Define metadata name 'Your-Module'; all_from 'lib/Your/Module.pm'; # Specific dependencies requires 'File::Spec' => '0.80'; test_requires 'Test::More' => '0.42'; recommends 'Text::CSV_XS'=> '0.50'; no_index 'directory' => 'demos'; install_script 'myscript'; WriteAll; Quickly upgrade a legacy ExtUtil::MakeMaker installer: use inc::Module::Install; WriteMakefile( ... ); DESCRIPTION Module::Install is a package for writing installers for CPAN (or CPAN-like) distributions that are clean, simple, minimalist, act in a strictly correct manner with ExtUtils::MakeMaker, and will run on any Perl installation version 5.005 or newer. The intent is to make it as easy as possible for CPAN authors (and especially for first-time CPAN authors) to have installers that follow all the best practices for distribution installation, but involve as much DWIM (Do What I Mean) as possible when writing them. Writing Module::Install Installers The quickest way to get started with Module::Install is to copy the "SYNOPSIS" from above and save it as your own Makefile.PL. Then modify the file to suit your own particular case, using the list of commands documented in "COMMON COMMANDS" below. If all you want to do is write an installer, go and do that now. You don't really need the rest of this description unless you are interested in the details. How it Works The motivation behind Module::Install is that distributions need to interact with a large number of different versions of perl and module installers infrastructure, primarily CPAN.pm, CPANPLUS.pm, ExtUtils::MakeMaker and Module::Build. These have accumulated greatly varying feature and bug profiles over the years, and it is now very difficult to write an installer that will work properly using only the installed versions of these modules, For example, the CPAN.pm version shipped with Perl 5.005 is now 5+ years old and considered highly buggy, yet it still exists on quite a number of legacy machines. Rather than try to target one specific installer and/or make you add twisty workaround expressions to every piece of install code you write, Module::Install will copy part of itself into each module distribution it creates. This allows new improvements to be used in your installers regardless of the age of the system a distribution is being installed on, at the cost of a small increase in the size of your distribution. History This module was originally written by Brian Ingerson as a smart drop-in replacement for ExtUtils::MakeMaker. For more information, see Brian's *Creating Module Distributions with Module::Install* in June 2003 issue of The Perl Journal (). For a lot more information, and some personal opinions on the module and its creation, see Module::Install::Philosophy. COMMON COMMANDS The following are the most common commands generally used in installers. It is far from an exhaustive list, as many of the plugins provide commands to work in more details that you would normally need. name name 'My-Module'; The name command is compulsory command, generally the first. It provides the name of your distribution, which for a module like Your::Module would normally be "Your-Module". This naming scheme is not hard and fast and you should note that distributions are actually a separate naming scheme from modules. For example the LWP modules come in a distribution called "libwww-perl". all_from all_from 'lib/My/Module.pm'; For most simple Perl distributions that feature one dominant module or class as the base, you can get the most Do What I Mean functionality by using the all_from command, which will try to extract as much metadata as possible from the Perl code and POD in that primary module. Functionally, "all_from" is equivalent to "abstract_from" + "author_from" + "version_from" + "license_from" + "perl_version_from". See below for details. If any of these values are set already before "all_from" is used, they will kept and not be overwritten. abstract abstract 'This distribution does something'; All distributions have an abstract, a short description of the distribution as a whole. It is usually around 30-70 characters long. The "abstract" command is used to explicitly set the abstract for the distribution, at least as far as the metadata file for the distribution is concerned. abstract_from abstract_from 'lib/My/Module.pm'; The "abstract_from" command retrieves the abstract from a particular file contained in the distribution package. Most often this is done from the main module, where "Module::Install" will read the POD and use whatever is in the "=head1 NAME" section (with module name stripped if needed) "abstract_from" is set as part of "all_from". author author 'Adam Kennedy '; The distribution metadata contains information on the primary author or the distribution, or the primary maintainer if the original author is no longer involved. It should generally be specified in the form of an email address. It you don't want to give away a real email address, you should use the "CPANID@cpan.org" address you receive automatically when you got your PAUSE account. The "author" command is used to explicitly set this value. author_from author_from 'lib/My/Module.pm'; The "author_from" command retrieves the author from a particular file contained in the distribution package. Most often this is done using the main module, where Module::Install will read the POD and use whatever it can find in the "=head1 AUTHOR" section. version version '0.01'; The "version" command is used to specify the version of the distribution, as distinct from the version of any single module within the distribution. Of course, in almost all cases you want it to match the version of the primary module within the distribution, which you can do using "version_from". version_from version_from 'lib/My/Module.pm'; The "version_from" command retrieves the distribution version from a particular file contained in the distribution package. Most often this is done from the main module. "version_from" will look for the first time you set $VERSION and use the same value, using a technique consistent with various other module version scanning tools. license license 'perl'; The "license" command specifies the license for the distribution. Most often this value will be 'perl', meaning *"the same as for Perl itself"*. Other allowed values include 'gpl', 'lgpl', 'bsd', 'MIT', and 'artistic'. This value is always considered a summary, and it is normal for authors to include a LICENSE file in the distribution, containing the full license for the distribution. You are also reminded that if the distribution is intended to be uploaded to the CPAN, it must be an OSI-approved open source license. Commercial software is not permitted on the CPAN. license_from license_from 'lib/My/Module.pm'; The "license_from" command retrieves the distribution license from a particular file contained in the distribution package. Most often this is done from the main module. "license_from" will look inside the POD within the indicated file for a licensing or copyright-related section and scan for a variety of strings that identify the general class of license. At this time it supports only the 6 values mentioned above in the "license" command summary. perl_version perl_version '5.006'; The "perl_version" command is used to specify the minimum version of the perl interpreter your distribution requires. When specifying the version, you should try to use the normalized version string. Perl version segments are 3 digits long, so a dependency on Perl 5.6 will become '5.006' and Perl 5.10.2 will become '5.010002'. perl_version_from perl_version_from 'lib/My/Module.pm' The "perl_version_from" command retrieves the minimum perl interpreter version from a particular file contained in the distribution package. Most often this is done from the main module. The minimum version is detected by scanning the file for "use 5.xxx" pragma calls in the module file. recommends recommends 'Text::CSV_XS' => '0.50' The "recommends" command indicates an optional run-time module that provides extra functionality. Recommended dependencies are not needed to build or test your distribution, but are considered "nice to have". As with "requires", the dependency is on a module and not a distribution. A version of zero indicates that any version of the module is recommended. requires requires 'List::Util' => 0; requires 'LWP' => '5.69'; The "requires" command indicates a normal run-time dependency of your distribution on another module. Most distributions will have one or more of these commands, indicating which CPAN (or otherwise) modules your distribution needs. A "requires" dependency can be verbalised as *"If you wish to install and use this distribution, you must first install these modules first"*. Note that the dependency is on a module and not a distribution. This is to ensure that your dependency stays correct, even if the module is moved or merged into a different distribtion, as is occasionally the case. A dependency on version zero indicates any version of module is sufficient. Versions should generally be quoted for clarity. test_requires test_requires 'Test::More' => '0.47'; The "test_requires" command indicates a test script dependency for the distribution. The specification format is identical to that of the "requires" command. The "test_requires" command is distinct from the "requires" command in that it indicates a module that is needed only during the testing of the distribution (often a period of only a few seconds) but will not be needed after the distribution is installed. The "testrequires" command is used to allow the installer some flexibility in how it provides the module, and to allow downstream packagers (Debian, FreeBSD, ActivePerl etc) to retain only the dependencies needed for run-time operation. The "include" command is sometimes used by some authors along with "test_requires" to bundle a small well-tested module into the distribution package itself rather than inflict yet another module installation on users installing from CPAN directly. configure_requires configure_requires 'File::Spec' => '0.80'; The "configure_requires" command indicates a configure-time dependency for the distribution. The specification format is identical to that of the "requires" command. The "configure_requires" command is used to get around the conundrum of how to use a CPAN module in your Makefile.PL, when you have to load Makefile.PL (and thus the CPAN module) in order to know that you need it. Traditionally, this circular logic could not be broken and so Makefile.PL scripts needed to rely on lowest-common-denominator approaches, or to bundle those dependencies using something like the "include" command. The "configure_requires" command creates an entry in the special configure_requires: key in the distribution's META.yml file. Although most of META.yml is considered advisory only, a CPAN client will treat the contents of configure_requires: as authorative, and install the listed modules before it executes the Makefile.PL (from which it then determines the other dependencies). Please note that support for configure_requires: in CPAN clients is not 100% complete at time of writing, and still cannot be relied upon. Because Module::Install itself only supports 5.005, it will silently add the equivalent of a "configure_requires( perl => '5.005' );" command to your distribution. requires_external_bin requires_external_bin 'cvs'; As part of its role as the dominant "glue" language, a lot of Perl modules run commands or programs on the host system. The "requires_external_bin" command is used to verify that a particular command is available on the host system. Unlike a missing Perl module, a missing external binary is unresolvable at make-time, and so the Makefile.PL run will abort with a "NA" (Not Applicable) result. In future, this command will also add additional information to the metadata for the dist, so that auto-packagers for particular operating system are more-easily able to auto-discover the appropriate non-Perl packages needed as a dependency. install_script # The following are equivalent install_script 'script/scriptname' The "install_script" command provides support for the installation of scripts that will become available at the console on both Unix and Windows (in the later case by wrapping it up as a .bat file). Note that is it normal practice to not put a .pl on the end of such scripts, so that they feel more natural when being used. In the example above, the script/scriptname program could be run after the installation just by doing the following. > scriptname Running scriptname 0.01... > By convention, scripts should be placed in a /script directory within your distribution. To support less typing, if a script is located in the script directory, you need refer to it by name only. # The following are equivalent install_script 'foo'; install_script 'script/foo'; no_index no_index directory => 'examples'; no_index package => 'DB'; Quite often a distrubition will provide example scripts or testing modules (.pm files) as well as the actual library modules. In almost all situations, you do not want these indexed in the CPAN index, the master Perl packages list, or displayed on the website, you just want them along for the ride. The "no_index" command is used to indicate directories or files where there might be non-library .pm files or other files that the CPAN indexer and websites such as should explicitly ignore. The most common situation is to ignore example or demo directories, but a variety of different situations may require a "no_index" entry. Another common use for "no_index" is to prevent the PAUSE indexer complaining when your module makes changes inside a "package DB" block. This is used to interact with the debugger in some specific ways. See the META.yml documentation for more details on what "no_index" values are allowed. The inc, t and share (if "install_share" is used) directories are automatically "no_index"'ed for you if found and do not require an explicit command. To summarize, if you can see it on and you shouldn't be able to, you need a "no_index" entry to remove it. installdirs, install_as_* installdirs 'site'; # the default install_as_core; # alias for installdirs 'perl' install_as_cpan; # alias for installdirs 'site' install_as_site; # alias for installdirs 'site' install_as_vendor; # alias for installdirs 'vendor' The "installdirs" and "install_as" commands specify the location where the module should be installed; this is the equivalent to ExtUtils::MakeMaker's "INSTALLDIRS" option. For almost all regular modules, the default is recommended, and need not be changed. Dual-life (core and CPAN) modules, as well as vendor-specific modules, may need to use the other options. If unsure, do not use this option. WriteAll The "WriteAll" command is generally the last command in the file; it writes out META.yml and Makefile so the user can run the "make", "make test", "make install" install sequence. EXTENSIONS All extensions belong to the Module::Install::* namespace, and inherit from Module::Install::Base. There are three categories of extensions: Standard Extensions Methods defined by a standard extension may be called as plain functions inside Makefile.PL; a corresponding singleton object will be spawned automatically. Other extensions may also invoke its methods just like their own methods: # delegates to $other_extension_obj->method_name(@args) $self->method_name(@args); At the first time an extension's method is invoked, a POD-stripped version of it will be included under the inc/Module/Install/ directory, and becomes *fixed* -- i.e., even if the user had installed a different version of the same extension, the included one will still be used instead. If the author wish to upgrade extensions in inc/ with installed ones, simply run "perl Makefile.PL" again; Module::Install determines whether you are an author by the existence of the inc/.author/ directory. End-users can reinitialize everything and become the author by typing "make realclean" and "perl Makefile.PL". Private Extensions Those extensions take the form of Module::Install::PRIVATE and Module::Install::PRIVATE::*. Authors are encouraged to put all existing Makefile.PL magics into such extensions (e.g. Module::Install::PRIVATE for common bits; Module::Install::PRIVATE::DISTNAME for functions specific to a distribution). Private extensions should not to be released on CPAN; simply put them somewhere in your @INC, under the "Module/Install/" directory, and start using their functions in Makefile.PL. Like standard extensions, they will never be installed on the end-user's machine, and therefore never conflict with other people's private extensions. Administrative Extensions Extensions under the Module::Install::Admin::* namespace are never included with the distribution. Their methods are not directly accessible from Makefile.PL or other extensions; they are invoked like this: # delegates to $other_admin_extension_obj->method_name(@args) $self->admin->method_name(@args); These methods only take effect during the *initialization* run, when inc/ is being populated; they are ignored for end-users. Again, to re-initialize everything, just run "perl Makefile.PL" as the author. Scripts (usually one-liners in Makefile) that wish to dispatch AUTOLOAD functions into administrative extensions (instead of standard extensions) should use the Module::Install::Admin module directly. See Module::Install::Admin for details. EXTENSIONS Detailed information is provided for all (some) of the relevant modules via their own POD documentation. Module::Install::AutoInstall Provides "auto_install()" to automatically fetch and install prerequisites. Module::Install::Base The base class for all extensions Module::Install::Bundle Provides the "bundle" family of commands, allowing you to bundle another CPAN distribution within your distribution. Module::Install::Fetch Handles install-time fetching of files from remote servers via FTP and HTTP. Module::Install::Include Provides the "include" family of commands for embedding modules that are only need at build-time in your distribution and won't be installed. Module::Install::Inline Provides "&Inline->write" to replace Inline::MakeMaker's functionality for making Inline-based modules (and cleaning up). However, you should invoke this with "WriteAll( inline => 1 )". Module::Install::Makefile Provides "&Makefile->write" to generate a Makefile for you distribution. Module::Install::Metadata Provides "&Meta->write" to generate a META.yml file for your distribution. Module::Install::PAR Makes pre-compiled module binary packages from the built blib directory, and download existing ones to save recompiling. Module::Install::Run Determines if commands are available on the user's machine, and runs them via IPC::Run3. Module::Install::Scripts Handles packaging and installation of scripts to various bin dirs. Module::Install::Win32 Functions for installing modules on Win32 and finding/installing nmake.exe for users that need it. Module::Install::WriteAll Provides the "WriteAll", which writes all the requires files, such as META.yml and Makefile. "WriteAll" takes four optional named parameters: "check_nmake" (defaults to true) If true, invokes functions with the same name. *The use of this param is no longer recommended.* "inline" (defaults to false) If true, invokes "&Inline->write" Inline modules. "meta" (defaults to true) If true, writes a "META.yml" file. "sign" (defaults to false) If true, invokes "sign" command to digitally sign erm... something. Module::Install::Admin::Find Package-time functions for finding extensions, installed packages and files in subdirectories. Module::Install::Admin::Manifest Package-time functions for manipulating and updating the MANIFEST file. Module::Install::Admin::Metadata Package-time functions for manipulating and updating the META.yml file. Module::Install::Admin::ScanDeps Package-time scanning for non-core dependencies via Module::ScanDeps and Module::CoreList. FAQ What are the benefits of using Module::Install? Here is a brief overview of the reasons: * Extremely easy for beginners to learn * Does everything ExtUtils::MakeMaker does. * Does it with a dramatically simpler syntax. * Automatically scans for metadata for you. * Requires no installation for end-users. * Guaranteed forward-compatibility. * Automatically updates your MANIFEST. * Distributing scripts is easy. * Include prerequisite modules (less dependencies to install) * Auto-installation of prerequisites. * Support for Inline-based modules. * Support for File::ShareDir shared data files * Support for precompiled PAR binaries. * Deals with Win32 install issues for you. By greatly shrinking and simplifying the syntax, Module::Install keeps the amount of work required to maintain your Makefile.PL files to an absolute minimum. And if you maintain more than one module than needs to do unusual installation tricks, you can create a specific module to abstract away this complexity. Module::Install isn't at 1.00 yet, is it safe to use yet? As long as you are going to periodically do incremental releases to get any bug fixes and new functionality, yes. If you don't plan to do incremental releases, it might be a good idea to continue to wait for a while. COOKBOOK / EXAMPLES The following are some real-life examples of Makefile.PL files using Module::Install. Method::Alias Method::Alias is a trivially-small utility module, with almost the smallest possible Makefile.PL. use inc::Module::Install; name 'Method-Alias'; all_from 'lib/Method/Alias.pm'; test_requires 'Test::More' => '0.42'; File::HomeDir File::HomeDir locates your home directory on any platform. It needs an installer that can handle different dependencies on different platforms. use inc::Module::Install; name 'File-HomeDir'; all_from 'lib/File/HomeDir.pm'; requires 'File::Spec' => '0.80'; test_requires 'Test::More' => '0.47'; if ( $MacPerl::Version ) { # Needed on legacy Mac OS 9 requires 'Mac::Files' => 0; } if ( $^O eq 'MXWin32' ) { # Needed on Windows platforms requires 'Win32::TieRegistry' => 0; } WriteAll; TO DO Implement Module::Install::Compiled and Module::Install::Admin::Compiled to integrate the Module::Compiled "perl 6 to perl 5" functionality with Module::Install. Because this would add SIGNIFICANT dependencies (i.e. pugs!) this should almost certainly be distributed as a separate distribution. Go over POD docs in detail. Test recursive Makefile directories The test suite needs a great deal more test scripts. Dependencies on shared libraries (libxml/libxml.dll etc) and binary files so that debian/Win32/etc autopackaging applications can create the appropriate package-level dependencies there. EU::MM 6.06_03+ supports META.yml natively. Maybe probe for that? SEE ALSO Module::Install::Philosophy inc::Module::Install Module::Install::AutoInstall Module::Install::Base Module::Install::Bundle Module::Install::MakeMaker Module::Install::Share Module::Install::Admin Module::Install::Admin::Include Module::Install::Admin::Manifest CPAN::MakeMaker, Inline::MakeMaker ExtUtils::MakeMaker SUPPORT Bugs should be reported via the CPAN bug tracker at For other issues, contact the (topmost) author. AUTHORS Adam Kennedy Audrey Tang Brian Ingerson COPYRIGHT Copyright 2002 - 2011 Brian Ingerson, Audrey Tang and Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Module-Install-1.16/lib/000700 000766 000024 00000000000 12521021366 015277 5ustar00etherstaff000000 000000 Module-Install-1.16/t/000700 000766 000024 00000000000 12521021366 014774 5ustar00etherstaff000000 000000 Module-Install-1.16/xt/000700 000766 000024 00000000000 12521021366 015164 5ustar00etherstaff000000 000000 Module-Install-1.16/xt/licenses.t000644 000766 000024 00000001440 12514015554 017173 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use Module::Install::Metadata; eval { require Software::License; require Module::Find; }; plan skip_all => "requires Software::License and Module::Find" if $@; my @licenses = Module::Find::findsubmod('Software::License'); plan tests => 1 * @licenses; foreach my $license (@licenses) { SKIP: { local $@; eval "require $license"; if ($@) { skip "Can't load $license: $@", 1; next; } my $name = $license->name; my $meta = $license->meta_name; unless ($meta) { skip "$license has no meta_name", 1; next; } $meta =~ s/_\d+$//; my $got = Module::Install::Metadata::__extract_license($name); ok $got =~ /^$meta/, $name; # should also test license urls? my $url = $license->url; } } Module-Install-1.16/t/01_compile.t000644 000766 000024 00000002606 12514015554 017133 0ustar00etherstaff000000 000000 #!/usr/bin/perl # Compile testing for Module::Install use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 68; # Check their perl version ok( $] >= 5.005, "Your perl is new enough" ); # Load the test class use_ok( 't::lib::Test' ); my @classes = qw{ Module::Install::Base Module::Install::Admin Module::Install::AutoInstall Module::Install::Bundle Module::Install::Can Module::Install::Compiler Module::Install::Deprecated Module::Install::DSL Module::Install::External Module::Install::Fetch Module::Install::Include Module::Install::Inline Module::Install::Makefile Module::Install::MakeMaker Module::Install::Metadata Module::Install::PAR Module::Install::Run Module::Install::Scripts Module::Install::Share Module::Install::Win32 Module::Install::With Module::Install::WriteAll Module::Install::Admin::Bundle Module::Install::Admin::Compiler Module::Install::Admin::Find Module::Install::Admin::Include Module::Install::Admin::Makefile Module::Install::Admin::Manifest Module::Install::Admin::Metadata Module::Install::Admin::ScanDeps Module::Install::Admin::WriteAll Module::Install inc::Module::Install }; # Load each class and check VERSIONs foreach my $class ( @classes ) { eval "require $class;"; ok( ! $@, "$class loads ok" ); no strict 'refs'; is( ${"${class}::VERSION"}, $t::lib::Test::VERSION, "$class \$VERSION matches" ); } Module-Install-1.16/t/02_mymeta.t000644 000766 000024 00000002317 12514015554 016777 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } require ExtUtils::MakeMaker; my $eumm = eval $ExtUtils::MakeMaker::VERSION; use Test::More; if ( $eumm < 6.5702 ) { plan( tests => 24 ); } else { plan( skip_all => 'New EU::MM has own MYMETA support' ); } use File::Spec; use t::lib::Test; # Regular build SCOPE: { ok( create_dist('Foo'), 'create_dist' ); ok( build_dist(), 'build_dist' ); ok( -f makefile() ); ok( -f file('META.yml') ); ok( ! -f file('MYMETA.yml') ); ok( ! -f file('MYMETA.json') ); ok( -f file(qw(inc Module Install.pm)) ); ok( kill_dist(), 'kill_dist' ); } # MYMETA.yml build SCOPE: { ok( create_dist('Foo'), 'create_dist' ); ok( build_dist( MYMETA => 'YAML' ), 'build_dist' ); ok( -f makefile() ); ok( -f file('META.yml') ); ok( -f file('MYMETA.yml') ); ok( ! -f file('MYMETA.json') ); ok( -f file(qw(inc Module Install.pm)) ); ok( kill_dist(), 'kill_dist' ); } # MYMETA.json build SCOPE: { ok( create_dist('Foo'), 'create_dist' ); ok( build_dist( MYMETA => 'JSON' ), 'build_dist' ); ok( -f makefile() ); ok( -f file('META.yml') ); ok( ! -f file('MYMETA.yml') ); ok( -f file('MYMETA.json') ); ok( -f file(qw(inc Module Install.pm)) ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/03_autoinstall.t000644 000766 000024 00000003333 12514015554 020042 0ustar00etherstaff000000 000000 #!perl use strict; BEGIN { $| = 1; $^W = 0; } use Test::More; BEGIN { if ( $ENV{RELEASE_TESTING} ) { plan( tests => 6 ); } else { plan( skip_all => 'Skipping dangerous test' ); exit(0); } } # Intercepts calls to WriteMakefile and prompt. my $mm_args; my @prompts = qw/y n n y y/; use ExtUtils::MakeMaker; sub ExtUtils::MakeMaker::WriteMakefile { $mm_args = {@_} } sub ExtUtils::MakeMaker::prompt { return 'n' } # tiehandle trick to intercept STDOUT. sub PRINT { my $self = shift; $$self .= join '', @_; } sub PRINTF { my $self = shift; $$self .= sprintf(shift, @_); } sub TIEHANDLE { my $self = ''; return bless \$self, shift; } sub READ {} sub READLINE {} sub GETC {} sub FILENO {} require Symbol; my $fh = Symbol::gensym; my $out = tie *$fh, __PACKAGE__; select(*$fh); # test from a clean state $ENV{PERL_AUTOINSTALL} = ''; require Module::AutoInstall; Module::AutoInstall::_accept_default(0); *Module::AutoInstall::_prompt = sub { ok($_[1], shift(@prompts)); return 'n'; }; # calls the module. my $rv = eval <<'.'; use Module::AutoInstall ( -version => '0.21', # Module::AutoInstall version -config => { make_args => '--hello' # option(s) for CPAN::Config }, -core => [ # core modules Package0 => '', # any version would do ], 'Feature1' => [ # do we want to install this feature by default? -default => 0, Package1 => '0.01', ], 'Feature2' => [ # associate tests to be disabled along with this -tests => [ $0 ], Package2 => '0.02', ], 'Feature3' => { # hash reference works, too Package3 => '0.03', }, ); ''; . is($rv, ''); Module-Install-1.16/t/04_version.t000644 000766 000024 00000001513 12514015554 017167 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 24; require_ok( 'inc::Module::Install' ); my @version = qw{ 0 0 1 1 1.1 1.1 1234 1234 1.2_01 1.20001 1.2.3 1.002003 1.2.3_1 1.0020031 5.8.1 5.008001 5.8.10 5.00801 5.10.0 5.01 }; while ( @version ) { my $in = shift @version; my $out = shift @version; my $ver = Module::Install::_version($in); my $two = Module::Install::_version($ver); is( $ver, $out, "$in => $out pass 1 ok" ); is( $two, $out, "$in => $out pass 2 ok" ); } my @cmp = qw{ 0 1.2.3 1.002003 -1 1.2.3 1.002004 1 1.2.3 1.002002 }; while ( @cmp ) { my $want = shift @cmp; my $left = shift @cmp; my $right = shift @cmp; my $have = Module::Install::_cmp(undef, $left, $right); is( $have, $want, "_cmp($left, $right) ok" ); } Module-Install-1.16/t/05_share.t000644 000766 000024 00000005144 12514015554 016611 0ustar00etherstaff000000 000000 #!/usr/bin/perl # Check that install_share use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use t::lib::Test; plan tests => 22; SCOPE: { # normal share dir/file ok( create_dist('Foo', { 'Makefile.PL' => <<'END_DSL' }), 'create_dist' ); use inc::Module::Install 0.82; name 'Foo'; all_from 'lib/Foo.pm'; install_share; WriteAll; END_DSL ok( mkdir(dir('share')), 'mkdir share' ); add_file('share/dist_file.txt', 'sample file'); add_file('MANIFEST', <<'END_MANIFEST'); MANIFEST Makefile.PL lib/Foo.pm share/dist_file.txt END_MANIFEST ok( build_dist(), 'build_dist' ); make(); ok( !$?, 'make' ); my $dir = dir(qw{ blib lib auto share dist Foo }); ok( -d $dir, 'Found install_share in correct dist_dir location' ); my $file = file(qw{ blib lib auto share dist Foo dist_file.txt }); ok( -f $file, 'Found expected file in dist_dir location' ); my $content = _read($file); ok( $content eq 'sample file', 'correct content' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { # normal share dir, but a file not listed in MANIFEST ok( create_dist('Foo', { 'Makefile.PL' => <<'END_DSL' }), 'create_dist' ); use inc::Module::Install 0.82; name 'Foo'; all_from 'lib/Foo.pm'; install_share; WriteAll; END_DSL ok( mkdir(dir('share')), 'mkdir share' ); add_file('share/dist_file.txt', 'sample file'); add_file('MANIFEST', <<'END_MANIFEST'); MANIFEST Makefile.PL lib/Foo.pm #share/dist_file.txt END_MANIFEST ok( build_dist(), 'build_dist' ); make(); ok( !$?, 'make' ); my $dir = dir(qw{ blib lib auto share dist Foo }); ok( -d $dir, 'Found install_share in correct dist_dir location' ); my $file = file(qw{ blib lib auto share dist Foo dist_file.txt }); ok( !-f $file, 'Found expected file in dist_dir location' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { # file is listed in MANIFEST, but also in MANIFEST.SKIP ok( create_dist('Foo', { 'Makefile.PL' => <<'END_DSL' }), 'create_dist' ); use inc::Module::Install 0.82; name 'Foo'; all_from 'lib/Foo.pm'; install_share; WriteAll; END_DSL ok( mkdir(dir('share')), 'mkdir share' ); add_file('share/dist_file.txt', 'sample file'); add_file('MANIFEST', <<'END_MANIFEST'); MANIFEST Makefile.PL lib/Foo.pm share/dist_file.txt END_MANIFEST add_file('MANIFEST.SKIP', <<'END_MANIFEST_SKIP'); share/dist_file.txt END_MANIFEST_SKIP ok( build_dist(), 'build_dist' ); make(); ok( !$?, 'make' ); my $dir = dir(qw{ blib lib auto share dist Foo }); ok( -d $dir, 'Found install_share in correct dist_dir location' ); my $file = file(qw{ blib lib auto share dist Foo dist_file.txt }); ok( !-f $file, 'Found expected file in dist_dir location' ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/06_ppport.t000644 000766 000024 00000001647 12514015554 017040 0ustar00etherstaff000000 000000 #!/usr/bin/perl # Check that ppport works use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; eval "require Devel::PPPort"; plan skip_all => 'requires Devel::PPPort' if $@; plan tests => 8; SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = file('ppport.h'); ok( !-f $file, 'Not found ppport.h'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; ppport; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = file('ppport.h'); ok( -f $file, 'Found ppport.h'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/07_perl_version.t000644 000766 000024 00000002047 12514015554 020217 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 14; require_ok( 'Module::Install::Metadata' ); my $metadata = Module::Install::Metadata->new; ##################################################################### # Simple Checks my @tests = qw{ 5.1 5.001 5.6 5.006 5.8 5.008 5.10 5.010 5.11 5.011 5.8.8 5.008008 5.10.0 5.010 5.008005 5.008005 }; while ( @tests ) { my $in = shift @tests; my $out = shift @tests; is( $metadata->_perl_version($in), $out, "->_perl_version($in)", ); } ##################################################################### # Practical Approach $metadata->perl_version('5.008'); is($metadata->perl_version, 5.008); $metadata->perl_version('5.8.1'); is($metadata->perl_version, 5.008001); $metadata->perl_version('5.008001'); is($metadata->perl_version, 5.008001); $metadata->perl_version('5.10.1'); is($metadata->perl_version, 5.010001); $metadata->perl_version('5.8'); is($metadata->perl_version, 5.008); Module-Install-1.16/t/08_dsl.t000644 000766 000024 00000003241 12514015554 016270 0ustar00etherstaff000000 000000 #!/usr/bin/perl # Tests for Module::Install::DSL use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 8; use t::lib::Test; # Load the DSL module require_ok( 'inc::Module::Install::DSL' ); # Generate code from a simple dsl block my $code = Module::Install::DSL::dsl2code(<<'END_DSL'); all_from lib/My/Module.pm requires perl 5.008 requires Carp 0 requires Win32 if win32 test_requires Test::More install_share END_DSL is( $code, <<'END_PERL', 'dsl2code generates the expected code' ); all_from 'lib/My/Module.pm'; requires 'perl', '5.008'; requires 'Carp', '0'; requires 'Win32' if win32; test_requires 'Test::More'; install_share; END_PERL ###################################################################### # Automatic dynamic vs static detection # Automatically set static_config if there are no conditionals my $static = Module::Install::DSL::dsl2code(<<'END_DSL'); all_from lib/My/Module.pm requires perl 5.008 requires Carp 0 requires Win32 test_requires Test::More install_share END_DSL is( $static, <<'END_PERL', 'dsl2code generates the expected code' ); all_from 'lib/My/Module.pm'; requires 'perl', '5.008'; requires 'Carp', '0'; requires 'Win32'; test_requires 'Test::More'; install_share; static_config; END_PERL ##################################################################### # Full scan dist run ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install::DSL 0.81; name Foo version 0.01 license perl requires_from lib/Foo.pm requires File::Spec 0.79 END_DSL ok( build_dist(), 'build_dist' ); ok( -f makefile() ); ok( -f file('META.yml') ); ok( kill_dist(), 'kill_dist' ); Module-Install-1.16/t/09_read.t000644 000766 000024 00000001515 12514015554 016424 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 7; SCOPE: { ok( create_dist('Foo'), 'create_dist' ); ok( build_dist(), 'built dist' ); require_ok( file('inc/Module/Install.pm') ); my $file = file('lib/Foo.pm'); ok( -f $file, "Found test file '$file'" ); my $pod = Module::Install::_readpod($file); is($pod, <<'END_POD', "_readpod($file)" ); =head1 NAME Foo - A test module =head1 AUTHORS Foo Bar =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. END_POD my $perl = Module::Install::_readperl($file); is($perl, <<'END_PERL', "_readperl($file)" ); package Foo; use 5.005; use strict; $VERSION = '3.21'; use File::Spec 0.80; 1; END_PERL ok( kill_dist(), 'kill dist' ); } Module-Install-1.16/t/10_test.t000644 000766 000024 00000003454 12514015554 016464 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use t::lib::Test; use YAML::Tiny (); plan tests => 14; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<'END_DSL' }), 'create_dist' ); use inc::Module::Install 0.82; name 'Foo'; license 'perl'; author 'Foo Bar '; all_from 'lib/Foo.pm'; requires 'perl' => '5.008000'; test_requires 'Test::More' => '0.47'; no_index 'directory' => qw{ t xt share inc }; install_share 'eg'; keywords 'kw1','kw 2'; keywords 'kw3'; license 'apache'; WriteAll; END_DSL unlink file('META.yml'); unlink file('MYMETA.yml'); ok( mkdir(dir('eg')), 'created eg/' ); ok( add_file('eg/sample', 'This is a sample'), 'added sample' ); ok( mkdir(dir('t')), 'created t/' ); ok( add_file('t/01_comile.t', <<'END_TEST'), 'added test' ); #!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use Test::More tests => 2; ok( $] >= 5.005, 'Perl version is new enough' ); use_ok( 'Foo', 'Loaded Foo.pm' ); END_TEST ok( build_dist(), 'build dist' ); my $metafile = file('META.yml'); ok( -f $metafile, 'META.yml created' ); my $meta = YAML::Tiny::LoadFile($metafile); is_deeply( [ sort @{ $meta->{no_index}->{directory} } ], [ qw{ eg inc t } ], 'no_index is ok', ) or diag( "no_index: @{ $meta->{no_index}->{directory} }" ); is_deeply( $meta->{keywords}, [ 'kw1','kw 2','kw3'], 'no_index is ok', ) or diag( "no_index: @{ $meta->{no_index}->{directory} }" ); is($meta->{license},'apache','license'); is($meta->{resources}->{license},'http://apache.org/licenses/LICENSE-2.0','license URL'); my $makefile = makefile(); ok( -f $makefile, 'Makefile created' ); my $content = _read($makefile); ok( $content =~ /^#\s+PREREQ_PM/m, 'PREREQ_PM found' ); ok( kill_dist(), 'kill dist' ); } Module-Install-1.16/t/11_extraction.t000644 000766 000024 00000007576 12514015554 017677 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 16; require_ok( 'Module::Install::Metadata' ); SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L'); is_deeply( \@links, [ 'http://rt.cpan.org/test' ], '1 bugtracker extracted', ) or diag( "bugtrackers: @links" ); } SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L L'); is_deeply( \@links, [ 'http://rt.cpan.org/test1' ], '1 bugtracker extracted (2 links)', ) or diag( "bugtrackers: @links" ); } SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L L'); is_deeply( [ sort @links ], [ 'http://rt.cpan.org/test1', 'http://rt.cpan.org/test2' ], '2 bugtrackers extracted', ) or diag( "bugtrackers: @links" ); } SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L'); is_deeply( \@links, [ ], '0 bugtrackers extracted', ) or diag( "bugtrackers: @links" ); } SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L'); is_deeply( \@links, [ 'http://github.com/marcusramberg/mojomojo/issues' ], '1 bugtracker (github.com) extracted', ) or diag( "bugtrackers: @links" ); } SCOPE: { my @links=Module::Install::Metadata::_extract_bugtracker('L'); is_deeply( \@links, [ 'http://code.google.com/p/www-mechanize/issues/list' ], '1 bugtracker (code.google.com) extracted', ) or diag( "bugtrackers: @links" ); } SCOPE: { my $l=Module::Install::Metadata::_extract_license("=head1 Copyright\nunder the same terms as the perl programming language\n=cut\n"); is($l, 'perl', 'Perl license detected', ); } SCOPE: { my $text="=head1 LICENSE This is free software, you may use it and distribute it under the same terms as Perl itself. =head1 SEE ALSO test =cut "; my $l=Module::Install::Metadata::_extract_license($text); is($l, 'perl', 'Perl license detected', ); } SCOPE: { my $text="=head1 COPYRIGHTS This module is distributed under the same terms as Perl itself. =cut "; my $l=Module::Install::Metadata::_extract_license($text); is($l, 'perl', 'Perl license detected', ); } SCOPE: { my $l=Module::Install::Metadata::_extract_license("=head1 COPYRIGHT\nAs LGPL license\n=cut\n"); is($l, 'lgpl', 'LGPL detected', ); } SCOPE: { my $text=<<'EOT'; =head1 COPYRIGHT AND LICENCE ... is free software; you can redistribute it and/or modify it under the terms of Perl itself, that is to say, under the terms of either: =over 4 =item * The GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or =item * The "Artistic License" which comes with Perl. =back =cut EOT my $l=Module::Install::Metadata::_extract_license($text); is($l, 'perl', 'Perl license detected', ); } SCOPE: { my $text=<<'EOT'; =head1 COPYRIGHT AND LICENCE Copyright (C) 2010 This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://opensource.org/licenses/artistic-license-2.0.php. =cut EOT my $l=Module::Install::Metadata::_extract_license($text); is($l, 'artistic_2', 'Artistic 2.0 license detected', ); } SCOPE: { my $version=Module::Install::Metadata::_extract_perl_version("use 5.10.0;"); is($version, '5.10.0', 'perl 5.10.0 detected', ); } SCOPE: { my $version=Module::Install::Metadata::_extract_perl_version(" use 5.010;"); is($version, '5.010', 'perl 5.10.0 detected', ); } SCOPE: { my $version=Module::Install::Metadata::_extract_perl_version("use strict;"); is($version, undef, 'no perl prereq', ); } Module-Install-1.16/t/12_eumm_params.t000644 000766 000024 00000002437 12514015554 020015 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 11; use File::Spec; use t::lib::Test; require ExtUtils::MakeMaker; use vars qw{ $PREREQ_PM $MIN_PERL_VERSION $BUILD_REQUIRES }; # Regular build SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; requires 'File::Spec' => '0.79'; WriteAll; END_DSL ok( run_makefile_pl(run_params=>['PREREQ_PRINT >test']), 'build_dist' ); my $file = file('test'); ok( -f $file); my $content = _read($file); ok( $content, 'file is not empty'); ok( $content =~ s/^.*\$PREREQ_PM = \{/\$PREREQ_PM = {/s,'PREREQ_PM found'); eval ($content); ok( !$@,'correct content'); ok( exists $PREREQ_PM->{'File::Spec'}); if ( eval($ExtUtils::MakeMaker::VERSION) < 6.55_03 ) { ok( exists $PREREQ_PM->{'ExtUtils::MakeMaker'}); ok( !exists $BUILD_REQUIRES->{'ExtUtils::MakeMaker'}); ok (1); } else { #best to check both because user can have any version ok( exists $BUILD_REQUIRES->{'ExtUtils::MakeMaker'}); ok( !exists $PREREQ_PM->{'ExtUtils::MakeMaker'}); is( $MIN_PERL_VERSION, '5.005' , 'correct Perl version'); } ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/13_author_tests.t000644 000766 000024 00000003156 12514015554 020233 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 15; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; WriteAll; END_DSL ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; WriteAll; END_DSL ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); rmdir dir(qw(inc .author)); # non-author-mode unlink makefile(); ok( run_makefile_pl(), 'build_dist again' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; if ( $ENV{RELEASE_TESTING} ) { ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); } else { ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); } ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/13_author_tests_ext.t000644 000766 000024 00000007445 12514015554 021120 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; eval "require Module::Install::AuthorTests"; plan skip_all => "requires Module::Install::AuthorTests" if $@; plan tests => 36; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; author_tests 'xt'; WriteAll; END_DSL ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; author_tests 'xt'; WriteAll; END_DSL ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); rmdir dir(qw(inc .author)); # non-author-mode unlink makefile(); ok( run_makefile_pl(), 'build_dist again' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; if ( $ENV{RELEASE_TESTING} ) { ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); } else { ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); } ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t'); ok( kill_dist(), 'kill_dist' ); } # cases with (undocumented) tests_recursive() SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; tests_recursive; author_tests 'xt'; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; tests_recursive; author_tests 'xt'; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt test.t)), 'added xt' ); ok( build_dist(), 'build_dist' ); rmdir dir(qw(inc .author)); # non-author-mode unlink makefile(); ok( run_makefile_pl(), 'build_dist again' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; if ( $ENV{RELEASE_TESTING} ) { ok($content =~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has xt/*.t'); } else { ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); } ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t\s+xt\/\*\.t/, 'has no second xt/*.t'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/13_author_tests_ext2.t000644 000766 000024 00000007123 12514015554 021173 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; eval "use Module::Install::ExtraTests 0.007"; plan skip_all => "requires Module::Install::ExtraTests 0.007" if $@; plan tests => 38; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; extra_tests; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt author test.t)), 'added xt/author' ); ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); my $res = make('test'); ok( $res =~ /Result:\s*PASS/ ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; extra_tests; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt author test.t)), 'added xt/author' ); ok( build_dist(), 'build_dist' ); rmdir dir(qw(inc .author)); # non-author-mode unlink makefile(); ok( run_makefile_pl(), 'build_dist again' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); my $res = make('test'); ok( $res =~ /Result:\s*PASS/ ); ok( kill_dist(), 'kill_dist' ); } # cases with (undocumented) tests_recursive() SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; tests_recursive; extra_tests; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt author test.t)), 'added xt/author' ); ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); my $res = make('test'); ok( $res =~ /Result:\s*PASS/ ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; tests_recursive; extra_tests; WriteAll; END_DSL ok( add_test(qw(t test.t)), 'added t' ); ok( add_test(qw(xt author test.t)), 'added xt/author' ); ok( build_dist(), 'build_dist' ); rmdir dir(qw(inc .author)); # non-author-mode unlink makefile(); ok( run_makefile_pl(), 'build_dist again' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); diag my ($testline) = $content =~ /^#\s*(test => .+)$/m if $ENV{TEST_VERBOSE}; ok($content !~ /#\s*test => \{ TESTS=>.+xt\/\*\.t/, 'has no xt/*.t'); my $res = make('test'); ok( $res =~ /Result:\s*PASS/ ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/14_auto_include_deps_with_version.t000644 000766 000024 00000002573 12514015554 024000 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; require ExtUtils::MakeMaker; use vars qw{ $PREREQ_PM $MIN_PERL_VERSION $BUILD_REQUIRES }; plan skip_all => 'your perl is new enough to have File::Spec 3.30 in core' if $] > 5.010000; plan skip_all => 'your File::Spec is not new enough for this test' if $File::Spec::VERSION < 3.30; plan tests => 8; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; test_requires 'File::Spec' => 0.6; auto_include_deps; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file_spec = file(qw(inc File Spec.pm)); ok( !-f $file_spec, 'File::Spec is not included'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; test_requires 'File::Spec' => 3.30; auto_include_deps; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file_spec = file(qw(inc File Spec.pm)); ok( -f $file_spec, 'File::Spec is included'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/15_wrong_usage.t000644 000766 000024 00000001432 12514015554 020024 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 4; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use Module::Install 0.81; # should use "use inc::Module::Install"! name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; WriteAll; END_DSL if ( supports_capture() ) { my $error = capture_build_dist(); ok $?, 'build failed'; ok $error =~ /Please invoke Module::Install with/, 'correct error'; diag $error if $ENV{TEST_VERBOSE}; } else { ok !build_dist(), "build_dist failed"; SKIP: { skip 'this platform does not support 2>&1', 1; } } ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/16_require.t000644 000766 000024 00000000417 12514015554 017163 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 1; SCOPE: { eval "require Module::Install"; ok !$@, "import succeeds: \$Module::Install::VERSION $Module::Install::VERSION"; diag $@ if $@; } Module-Install-1.16/t/17_sign.t000644 000766 000024 00000002571 12514015554 016453 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; require ExtUtils::MakeMaker; plan skip_all => 'test requires ExtUtils::MakeMaker >= 6.17' if eval($ExtUtils::MakeMaker::VERSION) < 6.17; plan tests => 12; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; WriteAll(sign => 0); END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content !~ /#\s*SIGN => q\[[01]\]/, 'has no sign'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; author 'Someone'; license 'perl'; perl_version '5.005'; requires_from 'lib/Foo.pm'; WriteAll(sign => 1); END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ /#\s*SIGN => q\[1\]/, 'has sign'); # XXX: might be better test `$Config{make} distsign` here # but it's neither safe nor portable... ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/18_all_from.t000644 000766 000024 00000003316 12514015554 017305 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; require ExtUtils::MakeMaker; my $eumm = eval $ExtUtils::MakeMaker::VERSION; plan tests => 18; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ /#\s*ABSTRACT => q\[A test module\]/, 'has abstract'); ok($content =~ author_makefile_re("Foo Bar"), 'has author'); ok($content =~ /#\s*VERSION => q\[3\.21\]/, 'has version'); SKIP: { skip "requires ExtUtils::MakeMaker 6.31", 1 unless $eumm < 6.31; ok($content =~ /#\s*LICENSE => q\[perl\]/, 'has license'); } ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; abstract 'overriden abstract'; author 'Bar Foo'; version '0.01'; license 'MIT'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ /#\s*ABSTRACT => q\[overriden abstract\]/, 'has abstract'); ok($content =~ author_makefile_re("Bar Foo"), 'has author'); ok($content =~ /#\s*VERSION => q\[0\.01\]/, 'has version'); SKIP: { skip "requires ExtUtils::MakeMaker 6.31", 1 if $eumm < 6.31; ok($content =~ /#\s*LICENSE => q\[mit\]/, 'has license'); } ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/19_authors.t000644 000766 000024 00000005312 12514015554 017176 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use Parse::CPAN::Meta; use t::lib::Test; plan tests => 32; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; author 'ishigaki'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ author_makefile_re("ishigaki"), 'has one author'); my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [qw(ishigaki)]); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; author 'ishigaki', 'charsbar'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ author_makefile_re("ishigaki, charsbar"), 'has two authors'); my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [qw(ishigaki charsbar)]); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; authors 'ishigaki', 'charsbar'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ author_makefile_re("ishigaki, charsbar"), 'has two authors'); my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [qw(ishigaki charsbar)]); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; author 'ishigaki'; author 'charsbar'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ author_makefile_re("ishigaki, charsbar"), 'has two authors'); my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [qw(ishigaki charsbar)]); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/20_authors_with_special_characters.t000644 000766 000024 00000005611 12514015554 024122 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use Parse::CPAN::Meta; use t::lib::Test; plan tests => 26; require ExtUtils::MakeMaker; my $eumm = eval $ExtUtils::MakeMaker::VERSION; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; version '0.01'; license 'perl'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( add_file(qw(lib Foo.pm), <<'END') ); package Foo; 1; \__END__ \=head1 NAME Foo - Abstract \=head1 AUTHOR First 'Middle' Last \=cut END ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); ok($content =~ author_makefile_re("First 'Middle' Last"), 'has one author') or do { $content =~ /^(#\s*AUTHOR => .*?)$/m; diag "String: $1"; }; my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [qq(First 'Middle' Last)]); ok( kill_dist(), 'kill_dist' ); } if ($] >= 5.008) { eval "use utf8"; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; version '0.01'; license 'perl'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( add_file(qw(lib Foo.pm), <<'END') ); package Foo; 1; \__END__ \=head1 NAME Foo - Abstract \=head1 AUTHOR Olivier MenguE \=cut END ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); TODO: { local $TODO = 'EUMM 7.00 fixed unicode but we have not' if $eumm gt '6.98'; ok($content =~ author_makefile_re("Olivier Mengu\xE9"), 'has one author'); } my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [q(Olivier Mengu\xE9)]); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; version '0.01'; license 'perl'; author "Olivier Mengu\xE9"; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); TODO: { local $TODO = 'EUMM 7.00 fixed unicode but we have not' if $eumm gt '6.98'; ok($content =~ author_makefile_re("Olivier Mengu\xE9"), 'has one author'); } my $metafile = file('META.yml'); ok(-f $metafile); my $meta = Parse::CPAN::Meta::LoadFile($metafile); is_deeply($meta->{author}, [q(Olivier Mengu\xE9)]); ok( kill_dist(), 'kill_dist' ); } } else { SKIP: { skip "this test requires perl 5.8", 17; } } Module-Install-1.16/t/21_makemaker_args.t000644 000766 000024 00000010661 12514015554 020456 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 45; # Let's see how MakeMaker behaves first # normal run SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo', INC => '-I/usr/include/', ); END_DSL ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc =~ m{/usr/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # added as ARGV SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo', ); END_DSL ok( run_makefile_pl(run_params => ['INC=-I/usr/opt/include/']), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc =~ m{/usr/opt/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # combined SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo', INC => '-I/usr/include/', ); END_DSL ok( run_makefile_pl(run_params => ['INC=-I/usr/opt/include/']), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc !~ m{/usr/include/}, "INC is overriden"; ok $inc && $inc =~ m{/usr/opt/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # Now test Module::Install # normal run SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; cc_inc_paths '/usr/include/'; WriteAll; END_DSL ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc =~ m{/usr/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # multiple inc paths SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; cc_inc_paths '/usr/include/'; cc_inc_paths '/usr/opt/include/'; WriteAll; END_DSL ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc =~ m{/usr/include/}, "correct INC"; ok $inc && $inc =~ m{/usr/opt/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # added as ARGV SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteAll; END_DSL ok( run_makefile_pl(run_params => ['INC=-I/usr/opt/include/']), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc =~ m{/usr/opt/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } # combined SCOPE: { ok( create_dist( 'Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; cc_inc_paths '/usr/include/'; WriteAll; END_DSL ok( run_makefile_pl(run_params => ['INC=-I/usr/opt/include/']), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok( $content,'file is not empty'); my ($inc) = $content =~ /^INC\s*=\s*(.+)$/m; diag "INC: $inc" if $ENV{TEST_VERBOSE}; ok $inc && $inc !~ m{/usr/include/}, "INC is overriden"; ok $inc && $inc =~ m{/usr/opt/include/}, "correct INC"; ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/22_installdirs.t000644 000766 000024 00000004767 12514015554 020050 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use Parse::CPAN::Meta; use t::lib::Test; plan tests => 24; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; makemaker_args 'INSTALLDIRS' => '~/local/'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); my ($installdirs) = $content =~ /^INSTALLDIRS\s*=\s*(.+?)\r?$/m; diag "INSTALLDIRS: $installdirs" if $ENV{TEST_VERBOSE}; ok( $installdirs eq '~/local/', 'correct INSTALLDIRS'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; installdirs '~/local/'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); my ($installdirs) = $content =~ /^INSTALLDIRS\s*=\s*(.+?)\r?$/m; diag "INSTALLDIRS: $installdirs" if $ENV{TEST_VERBOSE}; ok( $installdirs eq '~/local/', 'correct INSTALLDIRS'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; installdirs '~/local/'; makemaker_args 'INSTALLDIRS' => '~/old/'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); my ($installdirs) = $content =~ /^INSTALLDIRS\s*=\s*(.+?)\r?$/m; diag "INSTALLDIRS: $installdirs" if $ENV{TEST_VERBOSE}; ok( $installdirs eq '~/local/', 'correct INSTALLDIRS'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; install_as_core; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = makefile(); ok(-f $file); my $content = _read($file); ok($content, 'file is not empty'); my ($installdirs) = $content =~ /^INSTALLDIRS\s*=\s*(.+?)\r?$/m; diag "INSTALLDIRS: $installdirs" if $ENV{TEST_VERBOSE}; ok( $installdirs eq 'perl', 'correct INSTALLDIRS'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/23_pl_files.t000644 000766 000024 00000005720 12514015554 017304 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 35; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL', <<"END_DSL" }), 'create_dist' ); use strict; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo' ); END_DSL ok( add_file('MyFoo.pm.PL', '1;'), 'created .pm.PL'); ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file); my $content = _read($file); ok( $content,'file is not empty'); my ($target) = $content =~ /^MyFoo.pm :: (.+)$/m; diag $target if $ENV{TEST_VERBOSE}; ok( $target =~ /^MyFoo.pm.PL pm_to_blib/, 'has MyFoo target' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL', <<"END_DSL" }), 'create_dist' ); use strict; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Foo', PL_FILES => { 'MyFoo.pm.PL' => 'MyFoo.pm' }, ); END_DSL ok( add_file('MyFoo.pm.PL', '1;'), 'created .pm.PL'); ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file); my $content = _read($file); ok( $content,'file is not empty'); my ($target) = $content =~ /^MyFoo.pm :: (.+)$/m; diag $target if $ENV{TEST_VERBOSE}; ok( $target =~ /^MyFoo.pm.PL pm_to_blib/, 'has MyFoo target' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo'), 'create_dist' ); ok( add_file('MyFoo.pm.PL', '1;'), 'created .pm.PL'); ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file); my $content = _read($file); ok( $content,'file is not empty'); my ($target) = $content =~ /^MyFoo.pm :: (.+)$/m; diag $target if $ENV{TEST_VERBOSE}; ok( $target =~ /^MyFoo.pm.PL pm_to_blib/, 'has MyFoo target' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL', <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; makemaker_args( PL_FILES => { 'MyFoo.pm.PL' => 'MyFoo.pm' }, ); WriteAll; END_DSL ok( add_file('MyFoo.pm.PL', '1;'), 'created .pm.PL'); ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file); my $content = _read($file); ok( $content,'file is not empty'); my ($target) = $content =~ /^MyFoo.pm :: (.+)$/m; diag $target if $ENV{TEST_VERBOSE}; ok( $target =~ /^MyFoo.pm.PL pm_to_blib/, 'has MyFoo target' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL', <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; WriteMakefile( PL_FILES => { 'MyFoo.pm.PL' => 'MyFoo.pm' }, ); END_DSL ok( add_file('MyFoo.pm.PL', '1;'), 'created .pm.PL'); ok( run_makefile_pl(), 'build_dist' ); my $file = makefile(); ok( -f $file); my $content = _read($file); ok( $content,'file is not empty'); my ($target) = $content =~ /^MyFoo.pm :: (.+)$/m; diag $target if $ENV{TEST_VERBOSE}; ok( $target =~ /^MyFoo.pm.PL pm_to_blib/, 'has MyFoo target' ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/24_multiple_license_blocks.t000644 000766 000024 00000003014 12514015554 022374 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 3; use Module::Install::Metadata; my %p = _setup(); for ( "$p{header}$p{author}$p{copyright}$p{license}$p{footer}", "$p{header}$p{author}$p{license}$p{copyright}$p{footer}", "$p{header}$p{license}$p{author}$p{copyright}$p{footer}", ) { my $license = Module::Install::Metadata::_extract_license($_); ok defined $license && $license eq 'perl', "my license is $license"; } sub _setup { my %parts; $parts{header} =<<'POD'; =head1 NAME Win32::UTCFileTime - Get/set UTC file times with stat/utime on Win32 =head1 SYNOPSIS ... (snip) ... POD $parts{author} = <<'POD'; =head1 AUTHOR Steve Hay Eshay@cpan.orgE POD $parts{copyright} = <<'POD'; =head1 COPYRIGHT Copyright (C) 2003-2007 Steve Hay. All rights reserved. Portions Copyright (C) 2001 Jonathan M Gilligan. Used with permission. Portions Copyright (C) 2001 Tony M Hoyle. Used with permission. POD $parts{copyright} = <<'POD'; =head1 COPYRIGHT Copyright (C) 2003-2007 Steve Hay. All rights reserved. Portions Copyright (C) 2001 Jonathan M Gilligan. Used with permission. Portions Copyright (C) 2001 Tony M Hoyle. Used with permission. POD $parts{license} = <<'POD'; =head1 LICENCE This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e. under the terms of either the GNU General Public License or the Artistic License, as specified in the F file. POD $parts{footer} = <<'POD'; =cut POD return %parts; } Module-Install-1.16/t/25_perl_version_from.t000644 000766 000024 00000002214 12514015554 021236 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; use Parse::CPAN::Meta; plan tests => 36; my @statements = ( 'use 5.005', 'use v5.5.0', 'require 5.005', 'require v5.5.0', ); for my $statement (@statements) { SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; version '0.01'; license 'perl'; perl_version_from 'lib/Foo.pm'; WriteAll; END_DSL ok( add_file('lib/Foo.pm', <<"END_PM") ); package Foo; use strict; $statement; 1; END_PM ok( build_dist(), 'build_dist' ); my $file = makefile(); ok( -f $file, 'Makefile exists' ); my $content = _read($file); ok($content, 'file is not empty'); SKIP: { skip 'requires ExtUtils::MakeMaker > 6.48', 1 if eval($ExtUtils::MakeMaker::VERSION) < 6.48; ok($content =~ /#\s*MIN_PERL_VERSION => q\[5\.005\]/, 'has perl_version'); } my $meta = file('META.yml'); ok( -f $meta, 'META.yml exists' ); my $yaml = Parse::CPAN::Meta::LoadFile($meta); is( $yaml->{requires}->{perl}, '5.005', 'META has correct perl version requirement' ); ok( kill_dist(), 'kill_dist' ); }} Module-Install-1.16/t/26_unknown_func.t000644 000766 000024 00000004667 12514015554 020235 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 18; SCOPE: { # runtime error ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use strict; use warnings; use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; unknown_func('args'); warn "after unknown func"; WriteAll; END_DSL if ( supports_capture() ) { my $error = capture_build_dist(); ok $?, 'build fails'; ok( $error =~ /Unknown function is found/, 'correct error'); ok( $error !~ /after unknown func/, 'no bogus warning'); diag $error if $ENV{TEST_VERBOSE}; } else { ok( !build_dist, 'build fails' ); SKIP : { skip 'this platform does not support 2>&1', 2; } } my $file = makefile(); ok(!-f $file, 'Makefile is not created'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { # Bareword not allowed while "strict subs" in use ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use strict; use warnings; use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; unknown_func; warn "after unknown func"; WriteAll; END_DSL if ( supports_capture() ) { my $error = capture_build_dist(); ok $?, 'build fails'; ok( $error =~ /Bareword .+ not allowed/, 'correct error'); ok( $error !~ /after unknown func/, 'no bogus warning'); diag $error if $ENV{TEST_VERBOSE}; } else { ok( !build_dist, 'build fails' ); SKIP : { skip "this platform does not support 2>&1", 2; } } my $file = makefile(); ok(!-f $file, 'Makefile is not created'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { # String found where operator expected ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use strict; use warnings; use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; unknown_func 'args'; warn "after unknown func"; WriteAll; END_DSL if ( supports_capture() ) { my $error = capture_build_dist(); ok $?, 'build fails'; ok( $error =~ /String found where operator expected/, 'correct error'); ok( $error !~ /after unknown func/, 'no bogus warning'); diag $error if $ENV{TEST_VERBOSE}; } else { ok( !build_dist, 'build fails' ); SKIP : { skip "this platform does not support 2>&1", 2; } } my $file = makefile(); ok(!-f $file, 'Makefile is not created'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/27_build_requires_and_include.t000644 000766 000024 00000003505 12514015554 023055 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use YAML::Tiny; use t::lib::Test; plan tests => 14; SCOPE: { # see if test_requires works correctly ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use strict; use warnings; use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; test_requires 'Test::More' => 9999; WriteAll; END_DSL ok( build_dist, 'build dist' ); my $meta_yml = file('META.yml'); ok(-f $meta_yml, 'has META.yml'); my $meta = YAML::Tiny::LoadFile($meta_yml); ok $meta->{build_requires}{'Test::More'}, 'Test::More is listed in build_requires'; my $makefile = makefile(); ok(-f $makefile, 'has Makefile'); my $content = _read($makefile); ok($content =~ /^#\s+(PREREQ_PM|BUILD_REQUIRES)\s*=>\s*{[^}]+Test::More=>q\[9999\]/m, 'Test::More is listed in PREREQ_PM|BUILD_REQUIRES in Makefile'); ok( kill_dist(), 'kill_dist' ); } SCOPE: { # include removes Test::More from the build_requires in META.yml ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use strict; use warnings; use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; test_requires 'Test::More' => 9999; include 'Test::More'; WriteAll; END_DSL ok( build_dist, 'build dist' ); my $meta_yml = file('META.yml'); ok(-f $meta_yml, 'has META.yml'); my $meta = YAML::Tiny::LoadFile($meta_yml); ok !$meta->{build_requires}{'Test::More'}, 'Test::More is not listed in build_requires'; my $makefile = makefile(); ok(-f $makefile, 'has Makefile'); my $content = _read($makefile); ok($content !~ /^#\s+(PREREQ_PM|BUILD_REQUIRES)\s*=>\s*{[^}]+Test::More=>q\[9999\]/m, 'Test::More is not listed in PREREQ_PM|BUILD_REQUIRES in Makefile'); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/28_makemaker_args.t000644 000766 000024 00000001254 12514015554 020463 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use File::Spec; use t::lib::Test; plan tests => 6; SCOPE: { # PREOP/POSTOP ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; makemaker_args(dist => { PREOP => 'my_preop', POSTOP => 'my_postop', }); WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $makefile = makefile(); ok(-f $makefile, 'has Makefile'); my $content = _read($makefile); ok( $content =~ /my_preop/, 'has PREOP' ); ok( $content =~ /my_postop/, 'has POSTOP' ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/29_requires_from.t000644 000766 000024 00000003642 12514015554 020400 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use t::lib::Test; require ExtUtils::MakeMaker; use vars qw{ $PREREQ_PM $MIN_PERL_VERSION $BUILD_REQUIRES }; plan tests => 19; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; requires_from 'lib/Foo.pm'; WriteAll; END_DSL ok( run_makefile_pl(run_params=>['PREREQ_PRINT >test']), 'build_dist' ); my $file = file('test'); ok( -f $file); my $content = _read($file); ok( $content, 'file is not empty'); ok( $content =~ s/^.*\$PREREQ_PM = \{/\$PREREQ_PM = {/s,'PREREQ_PM found'); eval ($content); ok( !$@,'correct content'); ok( $PREREQ_PM->{'File::Spec'} eq '0.80', 'correct requirement' ); ok( kill_dist(), 'kill_dist' ); } SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist' ); use inc::Module::Install 0.81; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; test_requires_from 't/test.t'; WriteAll; END_DSL ok( mkdir(dir('t')), 'created t/' ); ok( add_file('t/test.t' => <<'END_TEST'), 'added test'); use strict; use warnings; use Test::More tests => 1; use File::Spec 0.80; ok("ok"); END_TEST ok( run_makefile_pl(run_params=>['PREREQ_PRINT >test']), 'build_dist' ); my $file = file('test'); ok( -f $file); my $content = _read($file); ok( $content, 'file is not empty'); ok( $content =~ s/^.*\$PREREQ_PM = \{/\$PREREQ_PM = {/s,'PREREQ_PM found'); eval ($content); ok( !$@,'correct content'); if ( eval($ExtUtils::MakeMaker::VERSION) < 6.55_03 ) { ok( exists $PREREQ_PM->{'File::Spec'}); ok( !exists $BUILD_REQUIRES->{'File::Spec'}); } else { #best to check both because user can have any version ok( exists $BUILD_REQUIRES->{'File::Spec'}); ok( !exists $PREREQ_PM->{'File::Spec'}); } ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/30_build_subdirs.t000644 000766 000024 00000004273 12514015554 020341 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use t::lib::Test; use YAML::Tiny; plan tests => 20 * 2; foreach my $command ('', "build_subdirs 'bar';") { SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist Foo'); use inc::Module::Install; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; $command WriteAll; END_DSL ok( mkdir(dir('bar'), 0777), 'created bar directory'); ok( mkdir(dir('bar/lib'), 0777), 'created bar/lib directory'); ok( mkdir(dir('bar/t'), 0777), 'created bar/t directory'); ok( add_file('bar/MANIFEST', <<'END_MANIFEST'), 'created MANIFEST'); MANIFEST Makefile.PL lib/Bar.pm t/load.t END_MANIFEST ok( add_file('bar/Makefile.PL', <<'END_DSL'), 'created Makefile.PL'); use inc::Module::Install; name 'Bar'; abstract 'bar'; author 'foobar'; perl_version '5.005'; version_from 'lib/Bar.pm'; WriteAll; END_DSL ok( add_file('bar/lib/Bar.pm', <<'END_PERL'), 'created Bar.pm'); package Bar; $VERSION = '0.01'; 1; END_PERL ok( add_file('bar/t/load.t', <<'END_T'), 'created load.t'); use Test::More tests => 1; use_ok('Bar'); END_T ok( supports_capture() ? capture_build_dist() : build_dist(), 'build_dist' ); my $makefile_foo = makefile(); ok( -f $makefile_foo, 'has Makefile for Foo' ); my $content_foo = _read($makefile_foo); ok( $content_foo =~ /DISTNAME\s*=>\s*q\[Foo\]/, 'content is correct'); my $meta_yml_foo = file('META.yml'); ok( -f $meta_yml_foo, 'has META.yml for Foo'); my $meta_foo = YAML::Tiny::LoadFile($meta_yml_foo); ok( $meta_foo->{name} eq 'Foo', 'META.yml is correct' ); ok( $meta_foo->{version} eq '3.21', 'META.yml is correct' ); my $makefile_bar = file('bar/Makefile'); ok( -f $makefile_bar, 'has Makefile for Bar' ); my $content_bar = _read($makefile_bar); ok( $content_bar =~ /DISTNAME\s*=>\s*q\[Bar\]/, 'content is correct'); my $meta_yml_bar = file('bar/META.yml'); ok( -f $meta_yml_bar, 'has META.yml for Bar'); my $meta_bar = YAML::Tiny::LoadFile($meta_yml_bar); ok( $meta_bar->{name} eq 'Bar', 'META.yml is correct' ); ok( $meta_bar->{version} eq '0.01', 'META.yml is correct' ); ok( kill_dist(), 'kill_dist' ); } } Module-Install-1.16/t/31_add_metadata.t000644 000766 000024 00000001130 12514015554 020065 0ustar00etherstaff000000 000000 #!/usr/bin/perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More; use t::lib::Test; use YAML::Tiny; plan tests => 5; SCOPE: { ok( create_dist('Foo', { 'Makefile.PL' => <<"END_DSL" }), 'create_dist Foo'); use inc::Module::Install; name 'Foo'; perl_version '5.005'; all_from 'lib/Foo.pm'; add_metadata 'x_foo' => 'bar'; WriteAll; END_DSL ok( build_dist(), 'build_dist' ); my $file = file('META.yml'); ok( -f $file); my $yaml = YAML::Tiny::LoadFile($file); ok( $yaml->{x_foo} && $yaml->{x_foo} eq 'bar' ); ok( kill_dist(), 'kill_dist' ); } Module-Install-1.16/t/32_module_name.t000644 000766 000024 00000001616 12514015554 017774 0ustar00etherstaff000000 000000 #!perl use strict; BEGIN { $| = 1; $^W = 1; } use Test::More tests => 8; my @package_name = ( 'package Foo::Bar;', 'package Foo::Bar 1.23;', 'package Foo::Bar { ... }', 'package Foo::Bar 1.23 { ... }', ); foreach (@package_name) { if ( $_ =~ m/ ^ \s* package \s* ([\w:]+) [\s|;]* /ixms ) { my ($name, $module_name) = ($1, $1); $name =~ s{::}{-}g; is($module_name, 'Foo::Bar', "found module_name Foo::Bar in $_"); is($name, 'Foo-Bar', "found name Foo-Bar in $_"); } } __END__ Perl 5.12 introduced: package Foo::Bar 1.23; ...; Perl 5.14 introduced: package Foo::Bar { ... } and they can be combined as: package Foo::Bar 1.23 { ... } The name_from regex doesn't support any of the above. It expects the package name to be followed by optional whitespace then a semicolon. ### approx line 342 in package Module::Install::Metadata::name_from; Module-Install-1.16/t/33_copy.t000644 000766 000024 00000000540 12514015554 016455 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; use Module::Install::Admin; use File::Temp qw/ tempdir /; use autodie; my $dir = tempdir; chdir $dir; open my $test, ">", "a"; binmode $test; print $test "\n\r\n\r\r"; close $test; Module::Install::Admin->copy( "a", "b" ); is -s "b", 13, "Module::Install::Admin::copy copies in binary mode"; done_testing; Module-Install-1.16/t/34_readwrite.t000644 000766 000024 00000000701 12514015554 017471 0ustar00etherstaff000000 000000 use strict; use warnings; use Test::More; use Module::Install::Admin; use File::Temp qw/ tempdir /; use autodie; my $dir = tempdir; chdir $dir; open my $test, ">", "a"; binmode $test; print $test "\n\r\n\r\r"; close $test; my $c = Module::Install::_read( "a" ); is length $c, 5, "Module::Install::_read reads in binary mode"; Module::Install::_write( "b", $c ); is -s "b", 5, "Module::Install::Admin::_write writes in binary mode"; done_testing; Module-Install-1.16/t/lib/000700 000766 000024 00000000000 12521021366 015542 5ustar00etherstaff000000 000000 Module-Install-1.16/t/recursive/000700 000766 000024 00000000000 12521021366 017003 5ustar00etherstaff000000 000000 Module-Install-1.16/t/recursive/test.t000644 000766 000024 00000000127 12514015554 020165 0ustar00etherstaff000000 000000 #!/usr/bin/perl print "1..1\n"; print "ok - tests_recursive called test in subdir\n"; Module-Install-1.16/t/lib/Test.pm000644 000766 000024 00000013120 12521020545 017024 0ustar00etherstaff000000 000000 package t::lib::Test; use strict; use File::Spec (); use File::Remove (); use File::Path (); use Cwd; use Config; use vars qw{$VERSION @ISA @EXPORT $DIST}; BEGIN { $VERSION = '1.16'; @ISA = 'Exporter'; @EXPORT = qw{ create_dist build_dist kill_dist run_makefile_pl add_file add_test _read file dir makefile make supports_capture capture_build_dist author_makefile_re }; $DIST = ''; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; binmode FH; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; binmode FH; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD sub create_dist { $DIST = shift; my $opt = shift || {}; # Clear out any existing directory kill_dist( $DIST ); my $home = cwd; my $dist_path = dir(); my $dist_lib = dir('lib'); mkdir($dist_path, 0777) or return 0; mkdir($dist_lib, 0777) or return 0; chdir($dist_path ) or return 0; # Write the MANIFEST open( MANIFEST, '>MANIFEST' ) or return 0; binmode MANIFEST; print MANIFEST $opt->{MANIFEST} || <<"END_MANIFEST"; MANIFEST Makefile.PL lib/$DIST.pm END_MANIFEST close MANIFEST; # Write the configure script open MAKEFILE_PL, '>Makefile.PL' or return 0; binmode MAKEFILE_PL; print MAKEFILE_PL $opt->{'Makefile.PL'} || <<"END_MAKEFILE_PL"; use inc::Module::Install 0.81; name '$DIST'; version '0.01'; license 'perl'; requires_from 'lib/$DIST.pm'; requires 'File::Spec' => '0.79'; WriteAll; END_MAKEFILE_PL close MAKEFILE_PL; # Write the module file open MODULE, ">lib/$DIST.pm" or return 0; binmode MODULE; print MODULE $opt->{"lib/$DIST.pm"} || <<"END_MODULE"; package $DIST; =pod =head1 NAME $DIST - A test module =cut use 5.005; use strict; \$VERSION = '3.21'; use File::Spec 0.80; =pod =head1 AUTHORS Foo Bar =cut 1; __END__ =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut END_MODULE close MODULE; chdir $home or return 0; return 1; } sub file { File::Spec->catfile('t', $DIST . $$, @_) } sub dir { File::Spec->catdir('t', $DIST . $$, @_) } sub makefile { file(@_, $^O eq 'VMS' ? 'Descrip.MMS' : 'Makefile' ) } sub add_file { my $dist_path = dir(); return 0 unless -d $dist_path; my $content = pop; my $file = pop; my @subdir = @_; my $dist_subdir = dir(@subdir); my $dist_file = file(@subdir, $file); unless (-d $dist_subdir) { File::Path::mkpath($dist_subdir, 0, 0777) or return 0; } open FILE, "> $dist_file" or return 0; binmode FILE; print FILE $content; close FILE; return 1; } sub add_test { add_file(@_, qq{print "1..1\nok 1\n";}) } sub build_dist { my %params = @_; my $dist_path = dir(); return 0 unless -d $dist_path; my $home = cwd; chdir $dist_path or return 0; my $X_MYMETA = $params{MYMETA} || ''; local $ENV{X_MYMETA} = $X_MYMETA; my @run_params=@{ $params{run_params} || [] }; my $ret = system($^X, "-I../../lib", "-I../../blib/lib", "Makefile.PL",@run_params); chdir $home or return 0; return $ret ? 0 : 1; } sub run_makefile_pl { my %params = @_; my $dist_path = dir(); return 0 unless -d $dist_path; my $home = cwd; chdir $dist_path or return 1; my $X_MYMETA = $params{MYMETA} || ''; local $ENV{X_MYMETA} = $X_MYMETA; my $run_params=join(' ',@{ $params{run_params} || [] }); my $ret = system("$^X -I../../lib -I../../blib/lib Makefile.PL $run_params"); #my $result=qx(); chdir $home or return 0; return $ret ? 0 : 1; } sub kill_dist { my $dir = dir(); return 1 unless -d $dir; windows_delay(); File::Remove::remove( \1, $dir ); windows_delay(); return -d $dir ? 0 : 1; } sub windows_delay { return if $^O ne 'MSWin32'; select undef, undef, undef, 0.1; } sub supports_capture { # stolen from ExtUtils::MakeMaker's test use ExtUtils::MM; # Unix, modern Windows and OS/2 from 5.005_54 up can handle 2>&1 # This makes our failure diagnostics nicer to read. return 1 if (MM->os_flavor_is('Unix') or (MM->os_flavor_is('Win32') and !MM->os_flavor_is('Win9x')) or ($] > 5.00554 and MM->os_flavor_is('OS/2'))); } sub capture_build_dist { my %params = @_; my $dist_path = dir(); return '' unless -d $dist_path; my $home = cwd; chdir $dist_path or return ''; my $X_MYMETA = $params{MYMETA} || ''; local $ENV{X_MYMETA} = $X_MYMETA; my @run_params=@{ $params{run_params} || [] }; my $command = join ' ', $^X, "-I../../lib", "-I../../blib/lib", "Makefile.PL", @run_params; my $ret = `$command 2>&1`; chdir $home; return $ret; } sub extract_target { my $target = shift; my $makefile = makefile(); return '' unless -f $makefile; my $content = _read($makefile) or return ''; my @lines; my $flag; foreach (split /\n/, $content) { if (/^$target\s*:/) { $flag++ } elsif (/^\S+\s*:/) { $flag = 0 } push @lines, $_ if $flag; } return wantarray ? @lines : join "\n", @lines; } sub make { my $target = shift || ''; my $dist_path = dir(); return '' unless -d $dist_path; my $home = cwd; chdir $dist_path or return ''; my $make = $Config{make}; my $ret = supports_capture() ? `$make $target 2>&1` : `$make $target`; chdir $home; return $ret; } require ExtUtils::MakeMaker; my $eumm = eval $ExtUtils::MakeMaker::VERSION; sub author_makefile_re { my $author=shift; if ($eumm>=6.5702) { return qr/#\s*AUTHOR => \[q\[$author\]\]/; } else { return qr/#\s*AUTHOR => q\[$author\]/; } } 1; Module-Install-1.16/lib/Module/000700 000766 000024 00000000000 12521021366 016524 5ustar00etherstaff000000 000000 Module-Install-1.16/lib/inc/000700 000766 000024 00000000000 12521021366 016050 5ustar00etherstaff000000 000000 Module-Install-1.16/lib/inc/Module/000700 000766 000024 00000000000 12521021366 017275 5ustar00etherstaff000000 000000 Module-Install-1.16/lib/inc/Module/Install/000700 000766 000024 00000000000 12521021366 020703 5ustar00etherstaff000000 000000 Module-Install-1.16/lib/inc/Module/Install.pm000644 000766 000024 00000012406 12521020466 021256 0ustar00etherstaff000000 000000 package inc::Module::Install; # This module ONLY loads if the user has manually installed their own # installation of Module::Install, and are some form of MI author. # # It runs from the installed location, and is never bundled # along with the other bundled modules. # # So because the version of this differs from the version that will # be bundled almost every time, it doesn't have it's own version and # isn't part of the synchronisation-checking. use strict; use vars qw{$VERSION}; BEGIN { # While this version will be overwritten when Module::Install # loads, it remains so Module::Install itself can detect which # version an author currently has installed. # This allows it to implement any back-compatibility features # it may want or need to. $VERSION = '1.16'; } if ( -d './inc' ) { my $author = $^O eq 'VMS' ? './inc/_author' : './inc/.author'; if ( -d $author ) { my $modified_at = (stat($author))[9]; if ((time - $modified_at) > 24 * 60 * 60) { # inc is a bit stale; there may be a newer Module::Install _check_update($modified_at); } $Module::Install::AUTHOR = 1; require File::Path; File::Path::rmtree('inc'); } } else { $Module::Install::AUTHOR = 1; } unshift @INC, 'inc' unless $INC[0] eq 'inc'; local $^W; require Module::Install; sub _check_update { my $modified_at = shift; # XXX: We have several online services to get update information # including search.cpan.org. They are more reliable than the # 02packages.details.txt.gz on the local machine. We might be # better to depend on those services... but on which? my $cpan_version = 0; if (0) { # XXX: should be configurable? my $url = "http://search.cpan.org/dist/Module-Install/META.yml"; eval "require YAML::Tiny; 1" or return; if (eval "require LWP::UserAgent; 1") { my $ua = LWP::UserAgent->new( timeout => 10, env_proxy => 1, ); my $res = $ua->get($url); return unless $res->is_success; my $yaml = eval { YAML::Tiny::Load($res->content) } or return; $cpan_version = $yaml->{version}; } } else { # If you don't want to rely on the net... require File::Spec; $cpan_version = _check_update_local($modified_at) or return; } # XXX: should die instead of warn? warn <<"WARN" if $cpan_version > $VERSION; Newer version of Module::Install is available on CPAN. CPAN: $cpan_version LOCAL: $VERSION Please upgrade. WARN } sub _check_update_local { my $modified_at = shift; return unless eval "require Compress::Zlib; 1"; _require_myconfig_or_config() or return; my $file = File::Spec->catfile( $CPAN::Config->{keep_source_where}, 'modules', '02packages.details.txt.gz' ); return unless -f $file; # return if (stat($file))[9] < $modified_at; my $gz = Compress::Zlib::gzopen($file, 'r') or return; my $line; while($gz->gzreadline($line)) { my ($cpan_version) = $line =~ /^Module::Install\s+(\S+)/ or next; return $cpan_version; } return; } # adapted from CPAN::HandleConfig sub _require_myconfig_or_config { return 1 if $INC{"CPAN/MyConfig.pm"}; local @INC = @INC; my $home = _home() or return; my $cpan_dir = File::Spec->catdir($home,'.cpan'); return unless -d $cpan_dir; unshift @INC, $cpan_dir; eval { require CPAN::MyConfig }; if ($@ and $@ !~ m#locate CPAN/MyConfig\.pm#) { warn "Error while requiring CPAN::MyConfig:\n$@\n"; return; } return 1 if $INC{"CPAN/MyConfig.pm"}; eval { require CPAN::Config; }; if ($@ and $@ !~ m#locate CPAN/Config\.pm#) { warn "Error while requiring CPAN::Config:\n$@\n"; return; } return 1 if $INC{"CPAN/Config.pm"}; return; } # adapted from CPAN::HandleConfig sub _home { my $home; if (eval {require File::HomeDir; 1}) { $home = File::HomeDir->can('my_dot_config') ? File::HomeDir->my_dot_config : File::HomeDir->my_data; unless (defined $home) { $home = File::HomeDir->my_home } } unless (defined $home) { $home = $ENV{HOME}; } $home; } 1; __END__ =pod =head1 NAME inc::Module::Install - Module::Install configuration system =head1 SYNOPSIS use inc::Module::Install; =head1 DESCRIPTION This module first checks whether the F directory exists, and removes the whole F directory if it does, so the module author always get a fresh F every time they run F. Next, it unshifts C into C<@INC>, then loads B from there. Below is an explanation of the reason for using a I: The original implementation of B introduces subtle problems for distributions ending with C (e.g. B, B), because its placement in F<./CPAN/> duplicates the real libraries that will get installed; also, the directory name F<./CPAN/> may confuse users. On the other hand, putting included, for-build-time-only libraries in F<./inc/> is a normal practice, and there is little chance that a CPAN distribution will be called C, so it's much safer to use. Also, it allows for other helper modules like B to reside also in F, and to make use of them. =head1 AUTHORS Audrey Tang Eautrijus@autrijus.orgE =head1 COPYRIGHT Copyright 2003, 2004 Audrey Tang Eautrijus@autrijus.orgE. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L =cut Module-Install-1.16/lib/inc/Module/Install/DSL.pm000644 000766 000024 00000005635 12521020466 021706 0ustar00etherstaff000000 000000 package inc::Module::Install::DSL; # This module ONLY loads if the user has manually installed their own # installation of Module::Install, and are some form of MI author. # # It runs from the installed location, and is never bundled # along with the other bundled modules. # # So because the version of this differs from the version that will # be bundled almost every time, it doesn't have it's own version and # isn't part of the synchronisation-checking. use strict; use vars qw{$VERSION}; BEGIN { # While this version will be overwritten when Module::Install # loads, it remains so Module::Install itself can detect which # version an author currently has installed. # This allows it to implement any back-compatibility features # it may want or need to. $VERSION = '1.16'; } if ( -d './inc' ) { my $author = $^O eq 'VMS' ? './inc/_author' : './inc/.author'; if ( -d $author ) { $Module::Install::AUTHOR = 1; require File::Path; File::Path::rmtree('inc'); } } else { $Module::Install::AUTHOR = 1; } unshift @INC, 'inc' unless $INC[0] eq 'inc'; require inc::Module::Install; require Module::Install::DSL; # Tie our import to the main one sub import { goto &Module::Install::DSL::import; } 1; =pod =head1 NAME inc::Module::Install::DSL - Domain Specific Language for Module::Install =head1 SYNOPSIS use inc::Module::Install::DSL 0.80; all_from lib/ADAMK/Repository.pm requires File::Spec 3.29 requires File::pushd 1.00 requires File::Find::Rule 0.30 requires File::Find::Rule::VCS 1.05 requires File::Flat 0 requires File::Remove 1.42 requires IPC::Run3 0.034 requires Object::Tiny 1.06 requires Params::Util 0.35 requires CPAN::Version 5.5 test_requires Test::More 0.86 test_requires Test::Script 1.03 install_script adamk requires_external_bin svn =head1 DESCRIPTION One of the primary design goals of L is to simplify the creation of F scripts. Part of this involves the gradual reduction of any and all superfluous characters, with the ultimate goal of requiring no non-critical information in the file. L is a simple B based on the already-lightweight L command syntax. The DSL takes one command on each line, and then wraps the command (and its parameters) with the normal quotes and semi-colons etc to turn it into Perl code. =head1 SUPPORT Bugs should be reported via the CPAN bug tracker at L For other issues contact the author. =head1 AUTHORS Adam Kennedy Eadamk@cpan.orgE =head1 COPYRIGHT Copyright 2008 - 2012 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut Module-Install-1.16/lib/Module/AutoInstall.pm000644 000766 000024 00000106220 12521020466 021334 0ustar00etherstaff000000 000000 package Module::AutoInstall; use strict; use Cwd (); use File::Spec (); use ExtUtils::MakeMaker (); use vars qw{$VERSION}; BEGIN { $VERSION = '1.16'; } # special map on pre-defined feature sets my %FeatureMap = ( '' => 'Core Features', # XXX: deprecated '-core' => 'Core Features', ); # various lexical flags my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $InstallDepsTarget, $HasCPANPLUS ); my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps, $UpgradeDeps ); my ( $PostambleActions, $PostambleActionsNoTest, $PostambleActionsUpgradeDeps, $PostambleActionsUpgradeDepsNoTest, $PostambleActionsListDeps, $PostambleActionsListAllDeps, $PostambleUsed, $NoTest); # See if it's a testing or non-interactive session _accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN ); _init(); sub _accept_default { $AcceptDefault = shift; } sub _installdeps_target { $InstallDepsTarget = shift; } sub missing_modules { return @Missing; } sub do_install { __PACKAGE__->install( [ $Config ? ( UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} ) : () ], @Missing, ); } # initialize various flags, and/or perform install sub _init { foreach my $arg ( @ARGV, split( /[\s\t]+/, $ENV{PERL_AUTOINSTALL} || $ENV{PERL_EXTUTILS_AUTOINSTALL} || '' ) ) { if ( $arg =~ /^--config=(.*)$/ ) { $Config = [ split( ',', $1 ) ]; } elsif ( $arg =~ /^--installdeps=(.*)$/ ) { __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) ); exit 0; } elsif ( $arg =~ /^--upgradedeps=(.*)$/ ) { $UpgradeDeps = 1; __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) ); exit 0; } elsif ( $arg =~ /^--default(?:deps)?$/ ) { $AcceptDefault = 1; } elsif ( $arg =~ /^--check(?:deps)?$/ ) { $CheckOnly = 1; } elsif ( $arg =~ /^--skip(?:deps)?$/ ) { $SkipInstall = 1; } elsif ( $arg =~ /^--test(?:only)?$/ ) { $TestOnly = 1; } elsif ( $arg =~ /^--all(?:deps)?$/ ) { $AllDeps = 1; } } } # overrides MakeMaker's prompt() to automatically accept the default choice sub _prompt { goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault; my ( $prompt, $default ) = @_; my $y = ( $default =~ /^[Yy]/ ); print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] '; print "$default\n"; return $default; } # the workhorse sub import { my $class = shift; my @args = @_ or return; my $core_all; print "*** $class version " . $class->VERSION . "\n"; print "*** Checking for Perl dependencies...\n"; my $cwd = Cwd::getcwd(); $Config = []; my $maxlen = length( ( sort { length($b) <=> length($a) } grep { /^[^\-]/ } map { ref($_) ? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} ) : '' } map { +{@args}->{$_} } grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} } )[0] ); # We want to know if we're under CPAN early to avoid prompting, but # if we aren't going to try and install anything anyway then skip the # check entirely since we don't want to have to load (and configure) # an old CPAN just for a cosmetic message $UnderCPAN = _check_lock(1) unless $SkipInstall || $InstallDepsTarget; while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) { my ( @required, @tests, @skiptests ); my $default = 1; my $conflict = 0; if ( $feature =~ m/^-(\w+)$/ ) { my $option = lc($1); # check for a newer version of myself _update_to( $modules, @_ ) and return if $option eq 'version'; # sets CPAN configuration options $Config = $modules if $option eq 'config'; # promote every features to core status $core_all = ( $modules =~ /^all$/i ) and next if $option eq 'core'; next unless $option eq 'core'; } print "[" . ( $FeatureMap{ lc($feature) } || $feature ) . "]\n"; $modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' ); unshift @$modules, -default => &{ shift(@$modules) } if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward compatibility while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) { if ( $mod =~ m/^-(\w+)$/ ) { my $option = lc($1); $default = $arg if ( $option eq 'default' ); $conflict = $arg if ( $option eq 'conflict' ); @tests = @{$arg} if ( $option eq 'tests' ); @skiptests = @{$arg} if ( $option eq 'skiptests' ); next; } printf( "- %-${maxlen}s ...", $mod ); if ( $arg and $arg =~ /^\D/ ) { unshift @$modules, $arg; $arg = 0; } # XXX: check for conflicts and uninstalls(!) them. my $cur = _version_of($mod); if (_version_cmp ($cur, $arg) >= 0) { print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n"; push @Existing, $mod => $arg; $DisabledTests{$_} = 1 for map { glob($_) } @skiptests; } else { if (not defined $cur) # indeed missing { print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n"; } else { # no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above print "too old. ($cur < $arg)\n"; } push @required, $mod => $arg; } } next unless @required; my $mandatory = ( $feature eq '-core' or $core_all ); if ( !$SkipInstall and ( $CheckOnly or ($mandatory and $UnderCPAN) or $AllDeps or $InstallDepsTarget or _prompt( qq{==> Auto-install the } . ( @required / 2 ) . ( $mandatory ? ' mandatory' : ' optional' ) . qq{ module(s) from CPAN?}, $default ? 'y' : 'n', ) =~ /^[Yy]/ ) ) { push( @Missing, @required ); $DisabledTests{$_} = 1 for map { glob($_) } @skiptests; } elsif ( !$SkipInstall and $default and $mandatory and _prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', ) =~ /^[Nn]/ ) { push( @Missing, @required ); $DisabledTests{$_} = 1 for map { glob($_) } @skiptests; } else { $DisabledTests{$_} = 1 for map { glob($_) } @tests; } } if ( @Missing and not( $CheckOnly or $UnderCPAN) ) { require Config; my $make = $Config::Config{make}; if ($InstallDepsTarget) { print "*** To install dependencies type '$make installdeps' or '$make installdeps_notest'.\n"; } else { print "*** Dependencies will be installed the next time you type '$make'.\n"; } # make an educated guess of whether we'll need root permission. print " (You may need to do that as the 'root' user.)\n" if eval '$>'; } print "*** $class configuration finished.\n"; chdir $cwd; # import to main:: no strict 'refs'; *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main'; return (@Existing, @Missing); } sub _running_under { my $thing = shift; print <<"END_MESSAGE"; *** Since we're running under ${thing}, I'll just let it take care of the dependency's installation later. END_MESSAGE return 1; } # Check to see if we are currently running under CPAN.pm and/or CPANPLUS; # if we are, then we simply let it taking care of our dependencies sub _check_lock { return unless @Missing or @_; if ($ENV{PERL5_CPANM_IS_RUNNING}) { return _running_under('cpanminus'); } my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING}; if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) { return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS'); } require CPAN; if ($CPAN::VERSION > '1.89') { if ($cpan_env) { return _running_under('CPAN'); } return; # CPAN.pm new enough, don't need to check further } # last ditch attempt, this -will- configure CPAN, very sorry _load_cpan(1); # force initialize even though it's already loaded # Find the CPAN lock-file my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" ); return unless -f $lock; # Check the lock local *LOCK; return unless open(LOCK, $lock); if ( ( $^O eq 'MSWin32' ? _under_cpan() : == getppid() ) and ( $CPAN::Config->{prerequisites_policy} || '' ) ne 'ignore' ) { print <<'END_MESSAGE'; *** Since we're running under CPAN, I'll just let it take care of the dependency's installation later. END_MESSAGE return 1; } close LOCK; return; } sub install { my $class = shift; my $i; # used below to strip leading '-' from config keys my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } ); my ( @modules, @installed, @modules_to_upgrade ); while (my ($pkg, $ver) = splice(@_, 0, 2)) { # grep out those already installed if (_version_cmp(_version_of($pkg), $ver) >= 0) { push @installed, $pkg; if ($UpgradeDeps) { push @modules_to_upgrade, $pkg, $ver; } } else { push @modules, $pkg, $ver; } } if ($UpgradeDeps) { push @modules, @modules_to_upgrade; @installed = (); @modules_to_upgrade = (); } return @installed unless @modules; # nothing to do return @installed if _check_lock(); # defer to the CPAN shell print "*** Installing dependencies...\n"; return unless _connected_to('cpan.org'); my %args = @config; my %failed; local *FAILED; if ( $args{do_once} and open( FAILED, '.#autoinstall.failed' ) ) { while () { chomp; $failed{$_}++ } close FAILED; my @newmod; while ( my ( $k, $v ) = splice( @modules, 0, 2 ) ) { push @newmod, ( $k => $v ) unless $failed{$k}; } @modules = @newmod; } if ( _has_cpanplus() and not $ENV{PERL_AUTOINSTALL_PREFER_CPAN} ) { _install_cpanplus( \@modules, \@config ); } else { _install_cpan( \@modules, \@config ); } print "*** $class installation finished.\n"; # see if we have successfully installed them while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) { if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) { push @installed, $pkg; } elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) { print FAILED "$pkg\n"; } } close FAILED if $args{do_once}; return @installed; } sub _install_cpanplus { my @modules = @{ +shift }; my @config = _cpanplus_config( @{ +shift } ); my $installed = 0; require CPANPLUS::Backend; my $cp = CPANPLUS::Backend->new; my $conf = $cp->configure_object; return unless $conf->can('conf') # 0.05x+ with "sudo" support or _can_write($conf->_get_build('base')); # 0.04x # if we're root, set UNINST=1 to avoid trouble unless user asked for it. my $makeflags = $conf->get_conf('makeflags') || ''; if ( UNIVERSAL::isa( $makeflags, 'HASH' ) ) { # 0.03+ uses a hashref here $makeflags->{UNINST} = 1 unless exists $makeflags->{UNINST}; } else { # 0.02 and below uses a scalar $makeflags = join( ' ', split( ' ', $makeflags ), 'UNINST=1' ) if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } ); } $conf->set_conf( makeflags => $makeflags ); $conf->set_conf( prereqs => 1 ); while ( my ( $key, $val ) = splice( @config, 0, 2 ) ) { $conf->set_conf( $key, $val ); } my $modtree = $cp->module_tree; while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) { print "*** Installing $pkg...\n"; MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall; my $success; my $obj = $modtree->{$pkg}; if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) { my $pathname = $pkg; $pathname =~ s/::/\\W/; foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) { delete $INC{$inc}; } my $rv = $cp->install( modules => [ $obj->{module} ] ); if ( $rv and ( $rv->{ $obj->{module} } or $rv->{ok} ) ) { print "*** $pkg successfully installed.\n"; $success = 1; } else { print "*** $pkg installation cancelled.\n"; $success = 0; } $installed += $success; } else { print << "."; *** Could not find a version $ver or above for $pkg; skipping. . } MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall; } return $installed; } sub _cpanplus_config { my @config = (); while ( @_ ) { my ($key, $value) = (shift(), shift()); if ( $key eq 'prerequisites_policy' ) { if ( $value eq 'follow' ) { $value = CPANPLUS::Internals::Constants::PREREQ_INSTALL(); } elsif ( $value eq 'ask' ) { $value = CPANPLUS::Internals::Constants::PREREQ_ASK(); } elsif ( $value eq 'ignore' ) { $value = CPANPLUS::Internals::Constants::PREREQ_IGNORE(); } else { die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n"; } push @config, 'prereqs', $value; } elsif ( $key eq 'force' ) { push @config, $key, $value; } elsif ( $key eq 'notest' ) { push @config, 'skiptest', $value; } else { die "*** Cannot convert option $key to CPANPLUS version.\n"; } } return @config; } sub _install_cpan { my @modules = @{ +shift }; my @config = @{ +shift }; my $installed = 0; my %args; _load_cpan(); require Config; if (CPAN->VERSION < 1.80) { # no "sudo" support, probe for writableness return unless _can_write( MM->catfile( $CPAN::Config->{cpan_home}, 'sources' ) ) and _can_write( $Config::Config{sitelib} ); } # if we're root, set UNINST=1 to avoid trouble unless user asked for it. my $makeflags = $CPAN::Config->{make_install_arg} || ''; $CPAN::Config->{make_install_arg} = join( ' ', split( ' ', $makeflags ), 'UNINST=1' ) if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } ); # don't show start-up info $CPAN::Config->{inhibit_startup_message} = 1; # set additional options while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) { ( $args{$opt} = $arg, next ) if $opt =~ /^(?:force|notest)$/; # pseudo-option $CPAN::Config->{$opt} = $opt eq 'urllist' ? [$arg] : $arg; } if ($args{notest} && (not CPAN::Shell->can('notest'))) { die "Your version of CPAN is too old to support the 'notest' pragma"; } local $CPAN::Config->{prerequisites_policy} = 'follow'; while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) { MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall; print "*** Installing $pkg...\n"; my $obj = CPAN::Shell->expand( Module => $pkg ); my $success = 0; if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) { my $pathname = $pkg; $pathname =~ s/::/\\W/; foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) { delete $INC{$inc}; } my $rv = do { if ($args{force}) { CPAN::Shell->force( install => $pkg ) } elsif ($args{notest}) { CPAN::Shell->notest( install => $pkg ) } else { CPAN::Shell->install($pkg) } }; $rv ||= eval { $CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, ) ->{install} if $CPAN::META; }; if ( $rv eq 'YES' ) { print "*** $pkg successfully installed.\n"; $success = 1; } else { print "*** $pkg installation failed.\n"; $success = 0; } $installed += $success; } else { print << "."; *** Could not find a version $ver or above for $pkg; skipping. . } MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall; } return $installed; } sub _has_cpanplus { return ( $HasCPANPLUS = ( $INC{'CPANPLUS/Config.pm'} or _load('CPANPLUS::Shell::Default') ) ); } # make guesses on whether we're under the CPAN installation directory sub _under_cpan { require Cwd; require File::Spec; my $cwd = File::Spec->canonpath( Cwd::getcwd() ); my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} ); return ( index( $cwd, $cpan ) > -1 ); } sub _update_to { my $class = __PACKAGE__; my $ver = shift; return if _version_cmp( _version_of($class), $ver ) >= 0; # no need to upgrade if ( _prompt( "==> A newer version of $class ($ver) is required. Install?", 'y' ) =~ /^[Nn]/ ) { die "*** Please install $class $ver manually.\n"; } print << "."; *** Trying to fetch it from CPAN... . # install ourselves _load($class) and return $class->import(@_) if $class->install( [], $class, $ver ); print << '.'; exit 1; *** Cannot bootstrap myself. :-( Installation terminated. . } # check if we're connected to some host, using inet_aton sub _connected_to { my $site = shift; return ( ( _load('Socket') and Socket::inet_aton($site) ) or _prompt( qq( *** Your host cannot resolve the domain name '$site', which probably means the Internet connections are unavailable. ==> Should we try to install the required module(s) anyway?), 'n' ) =~ /^[Yy]/ ); } # check if a directory is writable; may create it on demand sub _can_write { my $path = shift; mkdir( $path, 0755 ) unless -e $path; return 1 if -w $path; print << "."; *** You are not allowed to write to the directory '$path'; the installation may fail due to insufficient permissions. . if ( eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt( qq( ==> Should we try to re-execute the autoinstall process with 'sudo'?), ((-t STDIN) ? 'y' : 'n') ) =~ /^[Yy]/ ) { # try to bootstrap ourselves from sudo print << "."; *** Trying to re-execute the autoinstall process with 'sudo'... . my $missing = join( ',', @Missing ); my $config = join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} ) if $Config; return unless system( 'sudo', $^X, $0, "--config=$config", "--installdeps=$missing" ); print << "."; *** The 'sudo' command exited with error! Resuming... . } return _prompt( qq( ==> Should we try to install the required module(s) anyway?), 'n' ) =~ /^[Yy]/; } # load a module and return the version it reports sub _load { my $mod = pop; # method/function doesn't matter my $file = $mod; $file =~ s|::|/|g; $file .= '.pm'; local $@; return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 ); } # report version without loading a module sub _version_of { my $mod = pop; # method/function doesn't matter my $file = $mod; $file =~ s|::|/|g; $file .= '.pm'; foreach my $dir ( @INC ) { next if ref $dir; my $path = File::Spec->catfile($dir, $file); next unless -e $path; require ExtUtils::MM_Unix; return ExtUtils::MM_Unix->parse_version($path); } return undef; } # Load CPAN.pm and it's configuration sub _load_cpan { return if $CPAN::VERSION and $CPAN::Config and not @_; require CPAN; # CPAN-1.82+ adds CPAN::Config::AUTOLOAD to redirect to # CPAN::HandleConfig->load. CPAN reports that the redirection # is deprecated in a warning printed at the user. # CPAN-1.81 expects CPAN::HandleConfig->load, does not have # $CPAN::HandleConfig::VERSION but cannot handle # CPAN::Config->load # Which "versions expect CPAN::Config->load? if ( $CPAN::HandleConfig::VERSION || CPAN::HandleConfig->can('load') ) { # Newer versions of CPAN have a HandleConfig module CPAN::HandleConfig->load; } else { # Older versions had the load method in Config directly CPAN::Config->load; } } # compare two versions, either use Sort::Versions or plain comparison # return values same as <=> sub _version_cmp { my ( $cur, $min ) = @_; return -1 unless defined $cur; # if 0 keep comparing return 1 unless $min; $cur =~ s/\s+$//; # check for version numbers that are not in decimal format if ( ref($cur) or ref($min) or $cur =~ /v|\..*\./ or $min =~ /v|\..*\./ ) { if ( ( $version::VERSION or defined( _load('version') )) and version->can('new') ) { # use version.pm if it is installed. return version->new($cur) <=> version->new($min); } elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) ) { # use Sort::Versions as the sorting algorithm for a.b.c versions return Sort::Versions::versioncmp( $cur, $min ); } warn "Cannot reliably compare non-decimal formatted versions.\n" . "Please install version.pm or Sort::Versions.\n"; } # plain comparison local $^W = 0; # shuts off 'not numeric' bugs return $cur <=> $min; } # nothing; this usage is deprecated. sub main::PREREQ_PM { return {}; } sub _make_args { my %args = @_; $args{PREREQ_PM} = { %{ $args{PREREQ_PM} || {} }, @Existing, @Missing } if $UnderCPAN or $TestOnly; if ( $args{EXE_FILES} and -e 'MANIFEST' ) { require ExtUtils::Manifest; my $manifest = ExtUtils::Manifest::maniread('MANIFEST'); $args{EXE_FILES} = [ grep { exists $manifest->{$_} } @{ $args{EXE_FILES} } ]; } $args{test}{TESTS} ||= 't/*.t'; $args{test}{TESTS} = join( ' ', grep { !exists( $DisabledTests{$_} ) } map { glob($_) } split( /\s+/, $args{test}{TESTS} ) ); my $missing = join( ',', @Missing ); my $config = join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} ) if $Config; $PostambleActions = ( ($missing and not $UnderCPAN) ? "\$(PERL) $0 --config=$config --installdeps=$missing" : "\$(NOECHO) \$(NOOP)" ); my $deps_list = join( ',', @Missing, @Existing ); $PostambleActionsUpgradeDeps = "\$(PERL) $0 --config=$config --upgradedeps=$deps_list"; my $config_notest = join( ',', (UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config}), 'notest', 1 ) if $Config; $PostambleActionsNoTest = ( ($missing and not $UnderCPAN) ? "\$(PERL) $0 --config=$config_notest --installdeps=$missing" : "\$(NOECHO) \$(NOOP)" ); $PostambleActionsUpgradeDepsNoTest = "\$(PERL) $0 --config=$config_notest --upgradedeps=$deps_list"; $PostambleActionsListDeps = '@$(PERL) -le "print for @ARGV" ' . join(' ', map $Missing[$_], grep $_ % 2 == 0, 0..$#Missing); my @all = (@Missing, @Existing); $PostambleActionsListAllDeps = '@$(PERL) -le "print for @ARGV" ' . join(' ', map $all[$_], grep $_ % 2 == 0, 0..$#all); return %args; } # a wrapper to ExtUtils::MakeMaker::WriteMakefile sub Write { require Carp; Carp::croak "WriteMakefile: Need even number of args" if @_ % 2; if ($CheckOnly) { print << "."; *** Makefile not written in check-only mode. . return; } my %args = _make_args(@_); no strict 'refs'; $PostambleUsed = 0; local *MY::postamble = \&postamble unless defined &MY::postamble; ExtUtils::MakeMaker::WriteMakefile(%args); print << "." unless $PostambleUsed; *** WARNING: Makefile written with customized MY::postamble() without including contents from Module::AutoInstall::postamble() -- auto installation features disabled. Please contact the author. . return 1; } sub postamble { $PostambleUsed = 1; my $fragment; $fragment .= <<"AUTO_INSTALL" if !$InstallDepsTarget; config :: installdeps \t\$(NOECHO) \$(NOOP) AUTO_INSTALL $fragment .= <<"END_MAKE"; checkdeps :: \t\$(PERL) $0 --checkdeps installdeps :: \t$PostambleActions installdeps_notest :: \t$PostambleActionsNoTest upgradedeps :: \t$PostambleActionsUpgradeDeps upgradedeps_notest :: \t$PostambleActionsUpgradeDepsNoTest listdeps :: \t$PostambleActionsListDeps listalldeps :: \t$PostambleActionsListAllDeps END_MAKE return $fragment; } 1; __END__ =pod =head1 NAME Module::AutoInstall - Automatic install of dependencies via CPAN =head1 SYNOPSIS In F, with L available on the author's system: use inc::Module::Install; name 'Joe-Hacker'; abstract 'Perl Interface to Joe Hacker'; author 'Joe Hacker '; include 'Module::AutoInstall'; requires 'Module0'; # mandatory modules feature 'Feature1', -default => 0, 'Module2' => '0.1'; feature 'Feature2', -default => 0, 'Module3' => '1.0'; auto_install( make_args => '--hello', # option(s) for CPAN::Config force => 1, # pseudo-option to force install do_once => 1, # skip previously failed modules ); WriteAll; Invoking the resulting F: % perl Makefile.PL # interactive behaviour % perl Makefile.PL --defaultdeps # accept default value on prompts % perl Makefile.PL --checkdeps # check only, no Makefile produced % perl Makefile.PL --skipdeps # ignores all dependencies % perl Makefile.PL --testonly # don't write installation targets Note that the trailing 'deps' of arguments may be omitted, too. Using C<--defaultdeps> will make F behave similarly to a regular Makefile.PL file with C dependencies. One can use environment variables (see "ENVIRONMENT") below to set a default behavior instead of specifying it in the command line for every invocation of F. Using F (or F): % make [all|test|install] # install dependencies first % make checkdeps # same as the --checkdeps above % make installdeps # install dependencies only % make installdeps_notest # same without running tests % make upgradedeps # upgrade all deps, even if installed % make upgradedeps_notest # same without running tests % make listdeps # print unsatisifed deps, one per line % make listalldeps # print all deps, one per line =head1 DESCRIPTION B lets module writers to specify a more sophisticated form of dependency information than the C option offered by B. This module works best with the B framework, a drop-in replacement for MakeMaker. However, this module also supports F files based on MakeMaker; see L for instructions. Specifying C instead of C will not try to install dependencies when running C, but only when running C. =head2 Prerequisites and Features Prerequisites are grouped into B, and the user could choose yes/no on each one's dependencies; the module writer may also supply a boolean value via C<-default> to specify the default choice. The B marked by the name C<-core> will double-check with the user, if the user chooses not to install the mandatory modules. This differs from the pre-0.26 'silent install' behaviour. Starting from version 0.27, if C<-core> is set to the string C (case-insensitive), every feature will be considered mandatory. The dependencies are expressed as pairs of C => C inside an array reference. If the order does not matter, and there are no C<-default>, C<-tests> or C<-skiptests> directives for that feature, you may also use a hash reference. =head2 The Installation Process Once B has determined which module(s) are needed, it checks whether it's running under the B shell and should therefore let B handle the dependency. Finally, the C is overridden to perform some additional checks, as well as skips tests associated with disabled features by the C<-tests> option. The actual installation happens at the end of the C target; both C and C will trigger the installation of required modules. If it's not running under B, the installer will probe for an active connection by trying to resolve the domain C, and check for the user's permission to use B. If all went well, a separate B instance is created to install the required modules. If you have the B package installed in your system, it is preferred by default over B; it also accepts some extra options (e.g. C<-target =E 'skiptest', -skiptest =E 1> to skip testing). All modules scheduled to be installed will be deleted from C<%INC> first, so B will check the newly installed modules. Additionally, you could use the C target to install the modules, and the C target to check dependencies without actually installing them; the C command has an equivalent effect. If the F itself needs to use an independent module (e.g. B, v1.21 or greater), then use something like below: BEGIN { require Module::AutoInstall; # the first argument is an arrayref of the -config flags Module::AutoInstall->install([], 'Acme::KillerApp' => 1.21); } use Acme::KillerApp 1.21; Module::AutoInstall->import( # ... arguments as usual ... ); Note the version test in the use clause; if you are so close to the cutting edge that B 1.20 is the latest version on CPAN, this will prevent your module from going awry. =head2 User-Defined Hooks User-defined I and I hooks are available via C and C subroutines, as shown below: # pre-install handler; takes $module_name and $version sub MY::preinstall { return 1; } # return false to skip install # post-install handler; takes $module_name, $version, $success sub MY::postinstall { return; } # the return value doesn't matter Note that since B performs installation at the time of C (i.e. before perl parses the remainder of F), you have to declare those two handlers I the C statement for them to take effect. If the user did not choose to install a module or it already exists on the system, neither of the handlers is invoked. Both handlers are invoked exactly once for each module when installation is attempted. C takes two arguments, C<$module_name> and C<$version>; if it returns a false value, installation for that module will be skipped, and C won't be called at all. C takes three arguments, C<$module_name>, C<$version> and C<$success>. The last one denotes whether the installation succeeded or not: C<1> means installation completed successfully, C<0> means failure during install, and C means that the installation was not attempted at all, possibly due to connection problems, or that module does not exist on CPAN at all. =head2 Customized C Starting from version 0.43, B supports modules that require a C subroutine in their F. The user-defined C, if present, is responsible for calling C and include the output in its return value. For example, the B (database driver) modules for the Perl DBI are required to include the postamble generated by the function C, so their F may contain lines like this: sub MY::postamble { return &Module::AutoInstall::postamble . &dbd_postamble; } Note that the B module does not export the C function, so the name should always be fully qualified. =head1 CAVEATS B will add C to your B flags if your effective uid is 0 (root), unless you explicitly disable it by setting B's C configuration option (or the C option of B) to include C. This I cause dependency problems if you are using a fine-tuned directory structure for your site. Please consult L for an explanation in detail. If either B or B is available, they will be used to compare the required version with the existing module's version and the CPAN module's. Otherwise it silently falls back to use I. This may cause inconsistent behaviours in pathetic situations. =head1 ENVIRONMENT B uses a single environment variable, C. It is taken as the command line argument passed to F; you could set it to C<--alldeps>, C<--defaultdeps> or C<--skipdeps> to avoid all interactive behaviour. C<--alldeps> will install all features, while C<--defaultdeps> will only install features for which the default answer is 'y'. C<--skipdeps> will refrain from loading L and not install anything, unless you're running under L or L, in which case required dependencies will be installed. It is also read from the C environment variable if C is not defined. You can also set C to use CPAN to install dependencies. By default CPANPLUS is used. =head1 SEE ALSO L L, L, L, L, L =head1 AUTHORS Audrey Tang Eautrijus@autrijus.orgE Adam Kennedy Eadamk@cpan.orgE Matt S Trout Emst@shadowcat.co.uE =head1 IF THIS BREAKS Report a ticket to bugs-Module-Install rt.cpan.org and cc Matt - I appear to have volunteered as primary maintainer for this stuff so if you run into any problems please tell me =head1 COPYRIGHT Copyright 2001, 2002, 2003, 2004, 2005, 2006 by Audrey Tang Some parts copyright 2006 Adam Kennedy This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L =cut Module-Install-1.16/lib/Module/Install/000700 000766 000024 00000000000 12521021366 020132 5ustar00etherstaff000000 000000 Module-Install-1.16/lib/Module/Install.pm000644 000766 000024 00000030207 12521020466 020504 0ustar00etherstaff000000 000000 package Module::Install; # For any maintainers: # The load order for Module::Install is a bit magic. # It goes something like this... # # IF ( host has Module::Install installed, creating author mode ) { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install # 3. The installed version of inc::Module::Install loads # 4. inc::Module::Install calls "require Module::Install" # 5. The ./inc/ version of Module::Install loads # } ELSE { # 1. Makefile.PL calls "use inc::Module::Install" # 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install # 3. The ./inc/ version of Module::Install loads # } use 5.006; use strict 'vars'; use Cwd (); use File::Find (); use File::Path (); use vars qw{$VERSION $MAIN}; BEGIN { # All Module::Install core packages now require synchronised versions. # This will be used to ensure we don't accidentally load old or # different versions of modules. # This is not enforced yet, but will be some time in the next few # releases once we can make sure it won't clash with custom # Module::Install extensions. $VERSION = '1.16'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # Whether or not inc::Module::Install is actually loaded, the # $INC{inc/Module/Install.pm} is what will still get set as long as # the caller loaded module this in the documented manner. # If not set, the caller may NOT have loaded the bundled version, and thus # they may not have a MI version that works with the Makefile.PL. This would # result in false errors or unexpected behaviour. And we don't want that. my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm'; unless ( $INC{$file} ) { die <<"END_DIE" } Please invoke ${\__PACKAGE__} with: use inc::${\__PACKAGE__}; not: use ${\__PACKAGE__}; END_DIE # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # If the script that is loading Module::Install is from the future, # then make will detect this and cause it to re-run over and over # again. This is bad. Rather than taking action to touch it (which # is unreliable on some platforms and requires write permissions) # for now we should catch this and refuse to run. if ( -f $0 ) { my $s = (stat($0))[9]; # If the modification time is only slightly in the future, # sleep briefly to remove the problem. my $a = $s - time; if ( $a > 0 and $a < 5 ) { sleep 5 } # Too far in the future, throw an error. my $t = time; if ( $s > $t ) { die <<"END_DIE" } Your installer $0 has a modification time in the future ($s > $t). This is known to create infinite loops in make. Please correct this, then run $0 again. END_DIE } # Build.PL was formerly supported, but no longer is due to excessive # difficulty in implementing every single feature twice. if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" } Module::Install no longer supports Build.PL. It was impossible to maintain duel backends, and has been deprecated. Please remove all Build.PL files and only use the Makefile.PL installer. END_DIE #------------------------------------------------------------- # To save some more typing in Module::Install installers, every... # use inc::Module::Install # ...also acts as an implicit use strict. $^H |= strict::bits(qw(refs subs vars)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; require "$self->{path}/$self->{dispatch}.pm"; File::Path::mkpath("$self->{prefix}/$self->{author}"); $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self ); $self->{admin}->init; @_ = ($class, _self => $self); goto &{"$self->{name}::import"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } sub autoload { my $self = shift; my $who = $self->_caller; my $cwd = Cwd::getcwd(); my $sym = "${who}::AUTOLOAD"; $sym->{$cwd} = sub { my $pwd = Cwd::getcwd(); if ( my $code = $sym->{$pwd} ) { # Delegate back to parent dirs goto &$code unless $cwd eq $pwd; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } my $method = $1; if ( uc($method) eq $method ) { # Do nothing return; } elsif ( $method =~ /^_/ and $self->can($method) ) { # Dispatch to the root M:I class return $self->$method(@_); } # Dispatch to the appropriate plugin unshift @_, ( $self, $1 ); goto &{$self->can('call')}; }; } sub preload { my $self = shift; unless ( $self->{extensions} ) { $self->load_extensions( "$self->{prefix}/$self->{path}", $self ); } my @exts = @{$self->{extensions}}; unless ( @exts ) { @exts = $self->{admin}->load_all_extensions; } my %seen; foreach my $obj ( @exts ) { while (my ($method, $glob) = each %{ref($obj) . '::'}) { next unless $obj->can($method); next if $method =~ /^_/; next if $method eq uc($method); $seen{$method}++; } } my $who = $self->_caller; foreach my $name ( sort keys %seen ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # ignore the prefix on extension modules built from top level. my $base_path = Cwd::abs_path($FindBin::Bin); unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) { delete $args{prefix}; } return $args{_self} if $args{_self}; $args{dispatch} ||= 'Admin'; $args{prefix} ||= 'inc'; $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author'); $args{bundle} ||= 'inc/BUNDLES'; $args{base} ||= $base_path; $class =~ s/^\Q$args{prefix}\E:://; $args{name} ||= $class; $args{version} ||= $class->VERSION; unless ( $args{path} ) { $args{path} = $args{name}; $args{path} =~ s!::!/!g; } $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm"; $args{wrote} = 0; bless( \%args, $class ); } sub call { my ($self, $method) = @_; my $obj = $self->load($method) or return; splice(@_, 0, 2, $obj); goto &{$obj->can($method)}; } sub load { my ($self, $method) = @_; $self->load_extensions( "$self->{prefix}/$self->{path}", $self ) unless $self->{extensions}; foreach my $obj (@{$self->{extensions}}) { return $obj if $obj->can($method); } my $admin = $self->{admin} or die <<"END_DIE"; The '$method' method does not exist in the '$self->{prefix}' path! Please remove the '$self->{prefix}' directory and run $0 again to load it. END_DIE my $obj = $admin->load($method, 1); push @{$self->{extensions}}, $obj; $obj; } sub load_extensions { my ($self, $path, $top) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $INC{$file}; push @{$self->{extensions}}, &{$new}($pkg, _top => $top ); } $self->{extensions} ||= []; } sub find_extensions { my ($self, $path) = @_; my @found; File::Find::find( sub { my $file = $File::Find::name; return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is; my $subpath = $1; return if lc($subpath) eq lc($self->{dispatch}); $file = "$self->{path}/$subpath.pm"; my $pkg = "$self->{name}::$subpath"; $pkg =~ s!/!::!g; # If we have a mixed-case package name, assume case has been preserved # correctly. Otherwise, root through the file to locate the case-preserved # version of the package name. if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) { my $content = Module::Install::_read($subpath . '.pm'); my $in_pod = 0; foreach ( split /\n/, $content ) { $in_pod = 1 if /^=\w/; $in_pod = 0 if /^=cut/; next if ($in_pod || /^=cut/); # skip pod text next if /^\s*#/; # and comments if ( m/^\s*package\s+($pkg)\s*;/i ) { $pkg = $1; last; } } } push @found, [ $file, $pkg ]; }, $path ) if -d $path; @found; } ##################################################################### # Common Utility Functions sub _caller { my $depth = 0; my $call = caller($depth); while ( $call eq __PACKAGE__ ) { $depth++; $call = caller($depth); } return $call; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; binmode FH; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; binmode FH; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD sub _readperl { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s; $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg; return $string; } sub _readpod { my $string = Module::Install::_read($_[0]); $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg; return $string if $_[0] =~ /\.pod\z/; $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg; $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg; $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg; $string =~ s/^\n+//s; return $string; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; binmode FH; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; binmode FH; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _version is for processing module versions (eg, 1.03_05) not # Perl versions (eg, 5.8.1). sub _version { my $s = shift || 0; my $d =()= $s =~ /(\.)/g; if ( $d >= 2 ) { # Normalise multipart versions $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg; } $s =~ s/^(\d+)\.?//; my $l = $1 || 0; my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; $l = $l . '.' . join '', @v if @v; return $l + 0; } sub _cmp { _version($_[1]) <=> _version($_[2]); } # Cloned from Params::Util::_CLASS sub _CLASS { ( defined $_[0] and ! ref $_[0] and $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s ) ? $_[0] : undef; } 1; # Copyright 2008 - 2012 Adam Kennedy. Module-Install-1.16/lib/Module/Install.pod000644 000766 000024 00000062141 12521020466 020654 0ustar00etherstaff000000 000000 =pod =head1 NAME Module::Install - Standalone, extensible Perl module installer =head1 SYNOPSIS In your F: (Recommended Usage) use inc::Module::Install; # Define metadata name 'Your-Module'; all_from 'lib/Your/Module.pm'; # Specific dependencies requires 'File::Spec' => '0.80'; test_requires 'Test::More' => '0.42'; recommends 'Text::CSV_XS'=> '0.50'; no_index 'directory' => 'demos'; install_script 'myscript'; WriteAll; Quickly upgrade a legacy L installer: use inc::Module::Install; WriteMakefile( ... ); =head1 DESCRIPTION B is a package for writing installers for CPAN (or CPAN-like) distributions that are clean, simple, minimalist, act in a strictly correct manner with L, and will run on any Perl installation version 5.005 or newer. The intent is to make it as easy as possible for CPAN authors (and especially for first-time CPAN authors) to have installers that follow all the best practices for distribution installation, but involve as much DWIM (Do What I Mean) as possible when writing them. =head2 Writing Module::Install Installers The quickest way to get started with Module::Install is to copy the L from above and save it as your own F. Then modify the file to suit your own particular case, using the list of commands documented in L below. If all you want to do is write an installer, go and do that now. You don't really need the rest of this description unless you are interested in the details. =head1 How it Works The motivation behind B is that distributions need to interact with a large number of different versions of L and module installers infrastructure, primarily L, L, L and L. These have accumulated B varying feature and bug profiles over the years, and it is now very difficult to write an installer that will work properly using only the installed versions of these modules, For example, the L version shipped with Perl 5.005 is now 5+ years old and considered highly buggy, yet it still exists on quite a number of legacy machines. Rather than try to target one specific installer and/or make you add twisty workaround expressions to every piece of install code you write, B will copy part of itself into each module distribution it creates. This allows new improvements to be used in your installers regardless of the age of the system a distribution is being installed on, at the cost of a small increase in the size of your distribution. =head2 History This module was originally written by Brian Ingerson as a smart drop-in replacement for L. For more information, see Brian's I in June 2003 issue of The Perl Journal (L) For a B more information, and some personal opinions on the module and its creation, see L. =head1 COMMON COMMANDS The following are the most common commands generally used in installers. It is far from an exhaustive list, as many of the plugins provide commands to work in more details that you would normally need. =head2 name name 'My-Module'; The B command is compulsory command, generally the first. It provides the name of your distribution, which for a module like B would normally be C. This naming scheme is not hard and fast and you should note that distributions are actually a separate naming scheme from modules. For example the L modules come in a distribution called C. =head2 all_from all_from 'lib/My/Module.pm'; For most simple Perl distributions that feature one dominant module or class as the base, you can get the most Do What I Mean functionality by using the B command, which will try to extract as much metadata as possible from the Perl code and POD in that primary module. Functionally, C is equivalent to C + C + C + C + C. See below for details. If any of these values are set already B C is used, they will kept and B be overwritten. =head2 abstract abstract 'This distribution does something'; All distributions have an abstract, a short description of the distribution as a whole. It is usually around 30-70 characters long. The C command is used to explicitly set the abstract for the distribution, at least as far as the metadata file for the distribution is concerned. =head2 abstract_from abstract_from 'lib/My/Module.pm'; The C command retrieves the abstract from a particular file contained in the distribution package. Most often this is done from the main module, where C will read the POD and use whatever is in the C<=head1 NAME> section (with module name stripped if needed) C is set as part of C. =head2 author author 'Adam Kennedy '; The distribution metadata contains information on the primary author or the distribution, or the primary maintainer if the original author is no longer involved. It should generally be specified in the form of an email address. It you don't want to give away a real email address, you should use the C address you receive automatically when you got your PAUSE account. The C command is used to explicitly set this value. =head2 author_from author_from 'lib/My/Module.pm'; The C command retrieves the author from a particular file contained in the distribution package. Most often this is done using the main module, where L will read the POD and use whatever it can find in the C<=head1 AUTHOR> section. =head2 version version '0.01'; The C command is used to specify the version of the distribution, as distinct from the version of any single module within the distribution. Of course, in almost all cases you want it to match the version of the primary module within the distribution, which you can do using C. =head2 version_from version_from 'lib/My/Module.pm'; The C command retrieves the distribution version from a particular file contained in the distribution package. Most often this is done from the main module. C will look for the first time you set C<$VERSION> and use the same value, using a technique consistent with various other module version scanning tools. =head2 license license 'perl'; The C command specifies the license for the distribution. Most often this value will be C<'perl'>, meaning I<"the same as for Perl itself">. Other allowed values include C<'gpl'>, C<'lgpl'>, C<'bsd'>, C<'MIT'>, and C<'artistic'>. This value is always considered a summary, and it is normal for authors to include a F file in the distribution, containing the full license for the distribution. You are also reminded that if the distribution is intended to be uploaded to the CPAN, it B be an OSI-approved open source license. Commercial software is not permitted on the CPAN. =head2 license_from license_from 'lib/My/Module.pm'; The C command retrieves the distribution license from a particular file contained in the distribution package. Most often this is done from the main module. C will look inside the POD within the indicated file for a licensing or copyright-related section and scan for a variety of strings that identify the general class of license. At this time it supports only the 6 values mentioned above in the C command summary. =head2 perl_version perl_version '5.006'; The C command is used to specify the minimum version of the perl interpreter your distribution requires. When specifying the version, you should try to use the normalized version string. Perl version segments are 3 digits long, so a dependency on Perl 5.6 will become C<'5.006'> and Perl 5.10.2 will become C<'5.010002'>. =head2 perl_version_from perl_version_from 'lib/My/Module.pm' The C command retrieves the minimum F interpreter version from a particular file contained in the distribution package. Most often this is done from the main module. The minimum version is detected by scanning the file for C pragma calls in the module file. =head2 recommends recommends 'Text::CSV_XS' => '0.50' The C command indicates an optional run-time module that provides extra functionality. Recommended dependencies are not needed to build or test your distribution, but are considered "nice to have". As with L, the dependency is on a B and not a distribution. A version of zero indicates that any version of the module is recommended. =head2 requires requires 'List::Util' => 0; requires 'LWP' => '5.69'; The C command indicates a normal run-time dependency of your distribution on another module. Most distributions will have one or more of these commands, indicating which CPAN (or otherwise) modules your distribution needs. A C dependency can be verbalised as I<"If you wish to install and use this distribution, you must first install these modules first">. Note that the dependency is on a B and not a distribution. This is to ensure that your dependency stays correct, even if the module is moved or merged into a different distribution, as is occasionally the case. A dependency on version zero indicates B version of module is sufficient. Versions should generally be quoted for clarity. =head2 test_requires test_requires 'Test::More' => '0.47'; The C command indicates a test script dependency for the distribution. The specification format is identical to that of the C command. The C command is distinct from the C command in that it indicates a module that is needed B during the testing of the distribution (often a period of only a few seconds) but will B be needed after the distribution is installed. The C command is used to allow the installer some flexibility in how it provides the module, and to allow downstream packagers (Debian, FreeBSD, ActivePerl etc) to retain only the dependencies needed for run-time operation. The C command is sometimes used by some authors along with C to bundle a small well-tested module into the distribution package itself rather than inflict yet another module installation on users installing from CPAN directly. =head2 configure_requires configure_requires 'File::Spec' => '0.80'; The C command indicates a configure-time dependency for the distribution. The specification format is identical to that of the C command. The C command is used to get around the conundrum of how to use a CPAN module in your Makefile.PL, when you have to load Makefile.PL (and thus the CPAN module) in order to know that you need it. Traditionally, this circular logic could not be broken and so Makefile.PL scripts needed to rely on lowest-common-denominator approaches, or to bundle those dependencies using something like the C command. The C command creates an entry in the special configure_requires: key in the distribution's F file. Although most of F is considered advisory only, a L client will treat the contents of configure_requires: as authoritive, and install the listed modules B it executes the F (from which it then determines the other dependencies). Please note that support for configure_requires: in CPAN clients is not 100% complete at time of writing, and still cannot be relied upon. Because B itself only supports 5.005, it will silently add the equivalent of a C<< configure_requires( perl => '5.005' ); >> command to your distribution. =head2 requires_external_bin requires_external_bin 'cvs'; As part of its role as the dominant "glue" language, a lot of Perl modules run commands or programs on the host system. The C command is used to verify that a particular command is available on the host system. Unlike a missing Perl module, a missing external binary is unresolvable at make-time, and so the F run will abort with a "NA" (Not Applicable) result. In future, this command will also add additional information to the metadata for the dist, so that auto-packagers for particular operating system are more-easily able to auto-discover the appropriate non-Perl packages needed as a dependency. =head2 install_script # The following are equivalent install_script 'script/scriptname' The C command provides support for the installation of scripts that will become available at the console on both Unix and Windows (in the later case by wrapping it up as a .bat file). Note that is it normal practice to B put a .pl on the end of such scripts, so that they feel more natural when being used. In the example above, the F