summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes40
-rw-r--r--INSTALL44
-rw-r--r--LICENSE379
-rw-r--r--MANIFEST15
-rw-r--r--META.json71
-rw-r--r--META.yml36
-rw-r--r--Makefile.PL72
-rw-r--r--README15
-rw-r--r--dist.ini9
-rw-r--r--lib/ExtUtils/InstallPaths.pm630
-rw-r--r--t/00-compile.t51
-rw-r--r--t/destinations.t284
-rw-r--r--t/release-pod-coverage.t15
-rw-r--r--t/release-pod-syntax.t14
14 files changed, 1675 insertions, 0 deletions
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..0435ad2
--- /dev/null
+++ b/Changes
@@ -0,0 +1,40 @@
+Revision history for ExtUtils-InstallPaths
+
+0.011 2015-02-16 00:47:54+01:00 Europe/Amsterdam
+ Make EU::IP compatible with perl 5.6
+ Declare dependency on File::Spec 0.83 for case_sensitive
+
+0.010 2013-10-29 12:17:18 Europe/Amsterdam
+ Deprecated usage of legacy configuration variables
+ Generate default paths more dynamically
+
+0.009 2012-12-07 00:04:52 Europe/Amsterdam
+ Add relative path checkers to relpaths arguments
+ Rewrote merging algorithm
+
+0.008 2012-11-29 21:13:50 Europe/Amsterdam
+ Don't require ExtUtils::Config object
+ Fix portability issues in test paths
+
+0.007 2012-11-22 21:00:18 Europe/Amsterdam
+ Refactor everything into sanity
+
+0.006 2012-08-05 20:28:27 Europe/Bucharest
+ Add original_prefix and install_sets
+ Various documentation improvements
+
+0.005 2012-01-09 23:34:16 Europe/Amsterdam
+ Don't return references to internal state
+
+0.004 2011-10-29 00:49:21 Europe/Amsterdam
+ Sanatized the config method
+
+0.003 2011-08-22 16:23:30 Europe/Amsterdam
+ Reinstated the module_name parameter
+
+0.002 2011-05-08 11:59:59 Europe/Amsterdam
+ Fixed case insensitive file matching in test
+ Fixed attribution
+
+0.001 2011-04-04 15:32:56 Europe/Amsterdam
+ - Initial version
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..0162238
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,44 @@
+
+This is the Perl distribution ExtUtils-InstallPaths.
+
+Installing ExtUtils-InstallPaths is straightforward.
+
+## Installation with cpanm
+
+If you have cpanm, you only need one line:
+
+ % cpanm ExtUtils::InstallPaths
+
+If you are installing into a system-wide directory, you may need to pass the
+"-S" flag to cpanm, which uses sudo to install the module:
+
+ % cpanm -S ExtUtils::InstallPaths
+
+## Installing with the CPAN shell
+
+Alternatively, if your CPAN shell is set up, you should just be able to do:
+
+ % cpan ExtUtils::InstallPaths
+
+## Manual installation
+
+As a last resort, you can manually install it. Download the tarball, untar it,
+then build it:
+
+ % perl Makefile.PL
+ % make && make test
+
+Then install it:
+
+ % make install
+
+If you are installing into a system-wide directory, you may need to run:
+
+ % sudo make install
+
+## Documentation
+
+ExtUtils-InstallPaths documentation is available as POD.
+You can run perldoc from a shell to read the documentation:
+
+ % perldoc ExtUtils::InstallPaths
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..409e5bf
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,379 @@
+This software is copyright (c) 2011 by Ken Williams, Leon Timmermans.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+Terms of the Perl programming language system itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+--- The GNU General Public License, Version 1, February 1989 ---
+
+This software is Copyright (c) 2011 by Ken Williams, Leon Timmermans.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 1, February 1989
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The license agreements of most software companies try to keep users
+at the mercy of those companies. By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License. The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications. Each
+licensee is addressed as "you".
+
+ 1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program. You may charge a fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish, that
+ in whole or in part contains the Program or any part thereof, either
+ with or without modifications, to be licensed at no charge to all
+ third parties under the terms of this General Public License (except
+ that you may choose to grant warranty protection to some or all
+ third parties, at your option).
+
+ c) If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use
+ in the simplest and most usual way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this General
+ Public License.
+
+ d) You may charge a fee for the physical act of transferring a
+ copy, and you may at your option offer warranty protection in
+ exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+ 3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal charge
+ for the cost of distribution) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it. For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+ 4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License. However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+ 5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+ 7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+ 8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+ To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19xx name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (a program to direct compilers to make passes
+ at assemblers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+--- The Artistic License 1.0 ---
+
+This software is Copyright (c) 2011 by Ken Williams, Leon Timmermans.
+
+This is free software, licensed under:
+
+ The Artistic License 1.0
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ - "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through
+ textual modification.
+ - "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+ - "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ - "You" is you, if you're thinking about copying or distributing this Package.
+ - "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will
+ not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+ - "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+from the Public Domain or from the Copyright Holder. A Package modified in such
+a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that
+you insert a prominent notice in each changed file stating how and when you
+changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site
+ such as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to
+ get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package
+ with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard
+ names, and clearly documenting the differences in manual pages (or
+ equivalent), together with instructions on where to get the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package. You
+may not charge a fee for this Package itself. However, you may distribute this
+Package in aggregate with other (possibly commercial) programs as part of a
+larger (possibly commercial) software distribution provided that you do not
+advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+from the programs of this Package do not automatically fall under the copyright
+of this Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..ba5eb17
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,15 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.025.
+Changes
+INSTALL
+LICENSE
+MANIFEST
+META.json
+META.yml
+Makefile.PL
+README
+dist.ini
+lib/ExtUtils/InstallPaths.pm
+t/00-compile.t
+t/destinations.t
+t/release-pod-coverage.t
+t/release-pod-syntax.t
diff --git a/META.json b/META.json
new file mode 100644
index 0000000..08d7cfd
--- /dev/null
+++ b/META.json
@@ -0,0 +1,71 @@
+{
+ "abstract" : "Build.PL install path logic made easy",
+ "author" : [
+ "Ken Williams <kwilliams@cpan.org>",
+ "Leon Timmermans <leont@cpan.org>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.143240",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "ExtUtils-InstallPaths",
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "develop" : {
+ "requires" : {
+ "Pod::Coverage::TrustPod" : "0",
+ "Test::Pod" : "1.41",
+ "Test::Pod::Coverage" : "1.08"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Carp" : "0",
+ "ExtUtils::Config" : "0.002",
+ "File::Spec" : "0",
+ "perl" : "5.006",
+ "strict" : "0",
+ "warnings" : "0"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Spec" : "0",
+ "File::Spec::Functions" : "0.83",
+ "File::Temp" : "0",
+ "IO::Handle" : "0",
+ "IPC::Open3" : "0",
+ "Test::More" : "0"
+ }
+ }
+ },
+ "provides" : {
+ "ExtUtils::InstallPaths" : {
+ "file" : "lib/ExtUtils/InstallPaths.pm",
+ "version" : "0.011"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "mailto" : "bug-extutils-installpaths at rt.cpan.org",
+ "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-InstallPaths"
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/Leont/extutils-installpaths.git",
+ "web" : "https://github.com/Leont/extutils-installpaths"
+ }
+ },
+ "version" : "0.011"
+}
+
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..ad9f4dd
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,36 @@
+---
+abstract: 'Build.PL install path logic made easy'
+author:
+ - 'Ken Williams <kwilliams@cpan.org>'
+ - 'Leon Timmermans <leont@cpan.org>'
+build_requires:
+ File::Spec: '0'
+ File::Spec::Functions: '0.83'
+ File::Temp: '0'
+ IO::Handle: '0'
+ IPC::Open3: '0'
+ Test::More: '0'
+configure_requires:
+ ExtUtils::MakeMaker: '0'
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.143240'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: ExtUtils-InstallPaths
+provides:
+ ExtUtils::InstallPaths:
+ file: lib/ExtUtils/InstallPaths.pm
+ version: '0.011'
+requires:
+ Carp: '0'
+ ExtUtils::Config: '0.002'
+ File::Spec: '0'
+ perl: '5.006'
+ strict: '0'
+ warnings: '0'
+resources:
+ bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-InstallPaths
+ repository: git://github.com/Leont/extutils-installpaths.git
+version: '0.011'
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..b465137
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,72 @@
+
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.025.
+use strict;
+use warnings;
+
+use 5.006;
+
+use ExtUtils::MakeMaker;
+
+
+
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "Build.PL install path logic made easy",
+ "AUTHOR" => "Ken Williams <kwilliams\@cpan.org>, Leon Timmermans <leont\@cpan.org>",
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => 0
+ },
+ "DISTNAME" => "ExtUtils-InstallPaths",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "MIN_PERL_VERSION" => "5.006",
+ "NAME" => "ExtUtils::InstallPaths",
+ "PREREQ_PM" => {
+ "Carp" => 0,
+ "ExtUtils::Config" => "0.002",
+ "File::Spec" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "TEST_REQUIRES" => {
+ "File::Spec" => 0,
+ "File::Spec::Functions" => "0.83",
+ "File::Temp" => 0,
+ "IO::Handle" => 0,
+ "IPC::Open3" => 0,
+ "Test::More" => 0
+ },
+ "VERSION" => "0.011",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
+);
+
+
+my %FallbackPrereqs = (
+ "Carp" => 0,
+ "ExtUtils::Config" => "0.002",
+ "ExtUtils::MakeMaker" => 0,
+ "File::Spec" => 0,
+ "File::Spec::Functions" => "0.83",
+ "File::Temp" => 0,
+ "IO::Handle" => 0,
+ "IPC::Open3" => 0,
+ "Test::More" => 0,
+ "strict" => 0,
+ "warnings" => 0
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+
diff --git a/README b/README
new file mode 100644
index 0000000..fdb3ff7
--- /dev/null
+++ b/README
@@ -0,0 +1,15 @@
+
+
+This archive contains the distribution ExtUtils-InstallPaths,
+version 0.011:
+
+ Build.PL install path logic made easy
+
+This software is copyright (c) 2011 by Ken Williams, Leon Timmermans.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+
+This README file was generated by Dist::Zilla::Plugin::Readme v5.025.
+
diff --git a/dist.ini b/dist.ini
new file mode 100644
index 0000000..2e5cc5f
--- /dev/null
+++ b/dist.ini
@@ -0,0 +1,9 @@
+name = ExtUtils-InstallPaths
+author = Ken Williams <kwilliams@cpan.org>
+author = Leon Timmermans <leont@cpan.org>
+license = Perl_5
+copyright_holder = Ken Williams, Leon Timmermans
+copyright_year = 2011
+
+[@LEONT::PP]
+AutoPrereqs.skip = VMS::Filespec
diff --git a/lib/ExtUtils/InstallPaths.pm b/lib/ExtUtils/InstallPaths.pm
new file mode 100644
index 0000000..0a70427
--- /dev/null
+++ b/lib/ExtUtils/InstallPaths.pm
@@ -0,0 +1,630 @@
+package ExtUtils::InstallPaths;
+$ExtUtils::InstallPaths::VERSION = '0.011';
+use 5.006;
+use strict;
+use warnings;
+
+use File::Spec ();
+use Carp ();
+use ExtUtils::Config 0.002;
+
+my %complex_accessors = map { $_ => 1 } qw/prefix_relpaths install_sets/;
+my %hash_accessors = map { $_ => 1 } qw/install_path install_base_relpaths original_prefix /;
+
+my %defaults = (
+ installdirs => 'site',
+ install_base => undef,
+ prefix => undef,
+ verbose => 0,
+ blib => 'blib',
+ create_packlist => 1,
+ dist_name => undef,
+ module_name => undef,
+ destdir => undef,
+ install_path => sub { {} },
+ install_sets => \&_default_install_sets,
+ original_prefix => \&_default_original_prefix,
+ install_base_relpaths => \&_default_base_relpaths,
+ prefix_relpaths => \&_default_prefix_relpaths,
+);
+
+sub _merge_shallow {
+ my ($name, $filter) = @_;
+ return sub {
+ my ($override, $config) = @_;
+ my $defaults = $defaults{$name}->($config);
+ $filter->($_) for grep $filter, values %$override;
+ return { %$defaults, %$override };
+ }
+}
+
+sub _merge_deep {
+ my ($name, $filter) = @_;
+ return sub {
+ my ($override, $config) = @_;
+ my $defaults = $defaults{$name}->($config);
+ my $pair_for = sub {
+ my $key = shift;
+ my %override = %{ $override->{$key} || {} };
+ $filter && $filter->($_) for values %override;
+ return $key => { %{ $defaults->{$key} }, %override };
+ };
+ return { map { $pair_for->($_) } keys %$defaults };
+ }
+}
+
+my %allowed_installdir = map { $_ => 1 } qw/core site vendor/;
+my $must_be_relative = sub { Carp::croak('Value must be a relative path') if File::Spec->file_name_is_absolute($_[0]) };
+my %deep_filter = map { $_ => $must_be_relative } qw/install_base_relpaths prefix_relpaths/;
+my %filter = (
+ installdirs => sub {
+ my $value = shift;
+ $value = 'core', Carp::carp('Perhaps you meant installdirs to be "core" rather than "perl"?') if $value eq 'perl';
+ Carp::croak('installdirs must be one of "core", "site", or "vendor"') if not $allowed_installdir{$value};
+ return $value;
+ },
+ (map { $_ => _merge_shallow($_, $deep_filter{$_}) } qw/original_prefix install_base_relpaths/),
+ (map { $_ => _merge_deep($_, $deep_filter{$_}) } qw/install_sets prefix_relpaths/),
+);
+
+sub new {
+ my ($class, %args) = @_;
+ my $config = $args{config} || ExtUtils::Config->new;
+ my %self = (
+ config => $config,
+ map { $_ => exists $args{$_} ? $filter{$_} ? $filter{$_}->($args{$_}, $config) : $args{$_} : ref $defaults{$_} ? $defaults{$_}->($config) : $defaults{$_} } keys %defaults,
+ );
+ $self{module_name} ||= do { my $module_name = $self{dist_name}; $module_name =~ s/-/::/g; $module_name } if defined $self{dist_name};
+ return bless \%self, $class;
+}
+
+for my $attribute (keys %defaults) {
+ no strict qw/refs/;
+ *{$attribute} = $hash_accessors{$attribute} ?
+ sub {
+ my ($self, $key) = @_;
+ Carp::confess("$attribute needs key") if not defined $key;
+ return $self->{$attribute}{$key};
+ } :
+ $complex_accessors{$attribute} ?
+ sub {
+ my ($self, $installdirs, $key) = @_;
+ Carp::confess("$attribute needs installdir") if not defined $installdirs;
+ Carp::confess("$attribute needs key") if not defined $key;
+ return $self->{$attribute}{$installdirs}{$key};
+ } :
+ sub {
+ my $self = shift;
+ return $self->{$attribute};
+ };
+}
+
+my $script = $] > 5.008000 ? 'script' : 'bin';
+my @install_sets_keys = qw/lib arch bin script bindoc libdoc binhtml libhtml/;
+my @install_sets_tail = ('bin', $script, qw/man1dir man3dir html1dir html3dir/);
+my %install_sets_values = (
+ core => [ qw/privlib archlib /, @install_sets_tail ],
+ site => [ map { "site$_" } qw/lib arch/, @install_sets_tail ],
+ vendor => [ map { "vendor$_" } qw/lib arch/, @install_sets_tail ],
+);
+
+sub _default_install_sets {
+ my $c = shift;
+
+ my %ret;
+ for my $installdir (qw/core site vendor/) {
+ @{$ret{$installdir}}{@install_sets_keys} = map { $c->get("install$_") } @{ $install_sets_values{$installdir} };
+ }
+ return \%ret;
+}
+
+sub _default_base_relpaths {
+ my $config = shift;
+ return {
+ lib => ['lib', 'perl5'],
+ arch => ['lib', 'perl5', $config->get('archname')],
+ bin => ['bin'],
+ script => ['bin'],
+ bindoc => ['man', 'man1'],
+ libdoc => ['man', 'man3'],
+ binhtml => ['html'],
+ libhtml => ['html'],
+ };
+}
+
+my %common_prefix_relpaths = (
+ bin => ['bin'],
+ script => ['bin'],
+ bindoc => ['man', 'man1'],
+ libdoc => ['man', 'man3'],
+ binhtml => ['html'],
+ libhtml => ['html'],
+);
+
+sub _default_prefix_relpaths {
+ my $c = shift;
+
+ my @libstyle = $c->get('installstyle') ? File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
+ my $arch = $c->get('archname');
+ my $version = $c->get('version');
+
+ return {
+ core => {
+ lib => [@libstyle],
+ arch => [@libstyle, $version, $arch],
+ %common_prefix_relpaths,
+ },
+ vendor => {
+ lib => [@libstyle],
+ arch => [@libstyle, $version, $arch],
+ %common_prefix_relpaths,
+ },
+ site => {
+ lib => [@libstyle, 'site_perl'],
+ arch => [@libstyle, 'site_perl', $version, $arch],
+ %common_prefix_relpaths,
+ },
+ };
+}
+
+sub _default_original_prefix {
+ my $c = shift;
+
+ my %ret = (
+ core => $c->get('installprefixexp'),
+ site => $c->get('siteprefixexp'),
+ vendor => $c->get('usevendorprefix') ? $c->get('vendorprefixexp') : '',
+ );
+
+ return \%ret;
+}
+
+sub _log_verbose {
+ my $self = shift;
+ print @_ if $self->verbose;
+ return;
+}
+
+# Given a file type, will return true if the file type would normally
+# be installed when neither install-base nor prefix has been set.
+# I.e. it will be true only if the path is set from Config.pm or
+# set explicitly by the user via install-path.
+sub is_default_installable {
+ my $self = shift;
+ my $type = shift;
+ my $installable = $self->install_destination($type) && ( $self->install_path($type) || $self->install_sets($self->installdirs, $type));
+ return $installable ? 1 : 0;
+}
+
+sub _prefixify_default {
+ my $self = shift;
+ my $type = shift;
+ my $rprefix = shift;
+
+ my $default = $self->prefix_relpaths($self->installdirs, $type);
+ if( !$default ) {
+ $self->_log_verbose(" no default install location for type '$type', using prefix '$rprefix'.\n");
+ return $rprefix;
+ } else {
+ return File::Spec->catdir(@{$default});
+ }
+}
+
+# Translated from ExtUtils::MM_Unix::prefixify()
+sub _prefixify_novms {
+ my($self, $path, $sprefix, $type) = @_;
+
+ my $rprefix = $self->prefix;
+ $rprefix .= '/' if $sprefix =~ m{/$};
+
+ $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n") if defined $path && length $path;
+
+ if (not defined $path or length $path == 0 ) {
+ $self->_log_verbose(" no path to prefixify, falling back to default.\n");
+ return $self->_prefixify_default( $type, $rprefix );
+ } elsif( !File::Spec->file_name_is_absolute($path) ) {
+ $self->_log_verbose(" path is relative, not prefixifying.\n");
+ } elsif( $path !~ s{^\Q$sprefix\E\b}{}s ) {
+ $self->_log_verbose(" cannot prefixify, falling back to default.\n");
+ return $self->_prefixify_default( $type, $rprefix );
+ }
+
+ $self->_log_verbose(" now $path in $rprefix\n");
+
+ return $path;
+}
+
+sub _catprefix_vms {
+ my ($self, $rprefix, $default) = @_;
+
+ my ($rvol, $rdirs) = File::Spec->splitpath($rprefix);
+ if ($rvol) {
+ return File::Spec->catpath($rvol, File::Spec->catdir($rdirs, $default), '');
+ }
+ else {
+ return File::Spec->catdir($rdirs, $default);
+ }
+}
+sub _prefixify_vms {
+ my($self, $path, $sprefix, $type) = @_;
+ my $rprefix = $self->prefix;
+
+ return '' unless defined $path;
+
+ $self->_log_verbose(" prefixify $path from $sprefix to $rprefix\n");
+
+ require VMS::Filespec;
+ # Translate $(PERLPREFIX) to a real path.
+ $rprefix = VMS::Filespec::vmspath($rprefix) if $rprefix;
+ $sprefix = VMS::Filespec::vmspath($sprefix) if $sprefix;
+
+ $self->_log_verbose(" rprefix translated to $rprefix\n sprefix translated to $sprefix\n");
+
+ if (length($path) == 0 ) {
+ $self->_log_verbose(" no path to prefixify.\n")
+ }
+ elsif (!File::Spec->file_name_is_absolute($path)) {
+ $self->_log_verbose(" path is relative, not prefixifying.\n");
+ }
+ elsif ($sprefix eq $rprefix) {
+ $self->_log_verbose(" no new prefix.\n");
+ }
+ else {
+ my ($path_vol, $path_dirs) = File::Spec->splitpath( $path );
+ my $vms_prefix = $self->config->get('vms_prefix');
+ if ($path_vol eq $vms_prefix.':') {
+ $self->_log_verbose(" $vms_prefix: seen\n");
+
+ $path_dirs =~ s{^\[}{\[.} unless $path_dirs =~ m{^\[\.};
+ $path = $self->_catprefix_vms($rprefix, $path_dirs);
+ }
+ else {
+ $self->_log_verbose(" cannot prefixify.\n");
+ return File::Spec->catdir($self->prefix_relpaths($self->installdirs, $type));
+ }
+ }
+
+ $self->_log_verbose(" now $path\n");
+
+ return $path;
+}
+
+BEGIN { *_prefixify = $^O eq 'VMS' ? \&_prefixify_vms : \&_prefixify_novms }
+
+# Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
+sub prefix_relative {
+ my ($self, $installdirs, $type) = @_;
+
+ my $relpath = $self->install_sets($installdirs, $type);
+
+ return $self->_prefixify($relpath, $self->original_prefix($installdirs), $type);
+}
+
+sub install_destination {
+ my ($self, $type) = @_;
+
+ return $self->install_path($type) if $self->install_path($type);
+
+ if ( $self->install_base ) {
+ my $relpath = $self->install_base_relpaths($type);
+ return $relpath ? File::Spec->catdir($self->install_base, @{$relpath}) : undef;
+ }
+
+ if ( $self->prefix ) {
+ my $relpath = $self->prefix_relative($self->installdirs, $type);
+ return $relpath ? File::Spec->catdir($self->prefix, $relpath) : undef;
+ }
+ return $self->install_sets($self->installdirs, $type);
+}
+
+sub install_types {
+ my $self = shift;
+
+ my %types = ( %{ $self->{install_path} },
+ $self->install_base ? %{ $self->{install_base_relpaths} }
+ : $self->prefix ? %{ $self->{prefix_relpaths}{ $self->installdirs } }
+ : %{ $self->{install_sets}{ $self->installdirs } });
+
+ return sort keys %types;
+}
+
+sub install_map {
+ my ($self, $blib) = @_;
+ $blib ||= $self->blib;
+
+ my (%map, @skipping);
+ foreach my $type ($self->install_types) {
+ my $localdir = File::Spec->catdir($blib, $type);
+ next unless -e $localdir;
+
+ # the line "...next if (($type eq 'bindoc'..." was one of many changes introduced for
+ # improving HTML generation on ActivePerl, see https://rt.cpan.org/Public/Bug/Display.html?id=53478
+ # Most changes were ok, but this particular line caused test failures in t/manifypods.t on windows,
+ # therefore it is commented out.
+
+ # ********* next if (($type eq 'bindoc' || $type eq 'libdoc') && not $self->is_unixish);
+
+ if (my $dest = $self->install_destination($type)) {
+ $map{$localdir} = $dest;
+ } else {
+ push @skipping, $type;
+ }
+ }
+
+ warn "WARNING: Can't figure out install path for types: @skipping\nFiles will not be installed.\n" if @skipping;
+
+ # Write the packlist into the same place as ExtUtils::MakeMaker.
+ if ($self->create_packlist and my $module_name = $self->module_name) {
+ my $archdir = $self->install_destination('arch');
+ my @ext = split /::/, $module_name;
+ $map{write} = File::Spec->catfile($archdir, 'auto', @ext, '.packlist');
+ }
+
+ # Handle destdir
+ if (length(my $destdir = $self->destdir || '')) {
+ foreach (keys %map) {
+ # Need to remove volume from $map{$_} using splitpath, or else
+ # we'll create something crazy like C:\Foo\Bar\E:\Baz\Quux
+ # VMS will always have the file separate than the path.
+ my ($volume, $path, $file) = File::Spec->splitpath( $map{$_}, 0 );
+
+ # catdir needs a list of directories, or it will create something
+ # crazy like volume:[Foo.Bar.volume.Baz.Quux]
+ my @dirs = File::Spec->splitdir($path);
+
+ # First merge the directories
+ $path = File::Spec->catdir($destdir, @dirs);
+
+ # Then put the file back on if there is one.
+ if ($file ne '') {
+ $map{$_} = File::Spec->catfile($path, $file)
+ } else {
+ $map{$_} = $path;
+ }
+ }
+ }
+
+ $map{read} = ''; # To keep ExtUtils::Install quiet
+
+ return \%map;
+}
+
+1;
+
+# ABSTRACT: Build.PL install path logic made easy
+
+__END__
+
+=pod
+
+=encoding UTF-8
+
+=head1 NAME
+
+ExtUtils::InstallPaths - Build.PL install path logic made easy
+
+=head1 VERSION
+
+version 0.011
+
+=head1 SYNOPSIS
+
+ use ExtUtils::InstallPaths;
+ use ExtUtils::Install 'install';
+ GetOptions(\my %opt, 'install_base=s', 'install_path=s%', 'installdirs=s', 'destdir=s', 'prefix=s', 'uninst:1', 'verbose:1');
+ my $paths = ExtUtils::InstallPaths->new(%opt, dist_name => $dist_name);
+ install($paths->install_map, $opt{verbose}, 0, $opt{uninst});
+
+=head1 DESCRIPTION
+
+This module tries to make install path resolution as easy as possible.
+
+When you want to install a module, it needs to figure out where to install things. The nutshell version of how this works is that default installation locations are determined from L<ExtUtils::Config>, and they may be individually overridden by using the C<install_path> attribute. An C<install_base> attribute lets you specify an alternative installation root like F</home/foo> and C<prefix> does something similar in a rather different (and more complicated) way. C<destdir> lets you specify a temporary installation directory like F</tmp/install> in case you want to create bundled-up installable packages.
+
+The following types are supported by default.
+
+=over 4
+
+=item * lib
+
+Usually pure-Perl module files ending in F<.pm> or F<.pod>.
+
+=item * arch
+
+"Architecture-dependent" module files, usually produced by compiling XS, L<Inline>, or similar code.
+
+=item * script
+
+Programs written in pure Perl. In order to improve reuse, you may want to make these as small as possible - put the code into modules whenever possible.
+
+=item * bin
+
+"Architecture-dependent" executable programs, i.e. compiled C code or something. Pretty rare to see this in a perl distribution, but it happens.
+
+=item * bindoc
+
+Documentation for the stuff in C<script> and C<bin>. Usually generated from the POD in those files. Under Unix, these are manual pages belonging to the 'man1' category. Unless explicitly set, this is only available on platforms supporting manpages.
+
+=item * libdoc
+
+Documentation for the stuff in C<lib> and C<arch>. This is usually generated from the POD in F<.pm> and F<.pod> files. Under Unix, these are manual pages belonging to the 'man3' category. Unless explicitly set, this is only available on platforms supporting manpages.
+
+=item * binhtml
+
+This is the same as C<bindoc> above, but applies to HTML documents. Unless explicitly set, this is only available when perl was configured to do so.
+
+=item * libhtml
+
+This is the same as C<libdoc> above, but applies to HTML documents. Unless explicitly set, this is only available when perl was configured to do so.
+
+=back
+
+=head1 ATTRIBUTES
+
+=head2 installdirs
+
+The default destinations for these installable things come from entries in your system's configuration. You can select from three different sets of default locations by setting the C<installdirs> parameter as follows:
+
+ 'installdirs' set to:
+ core site vendor
+
+ uses the following defaults from ExtUtils::Config:
+
+ lib => installprivlib installsitelib installvendorlib
+ arch => installarchlib installsitearch installvendorarch
+ script => installscript installsitescript installvendorscript
+ bin => installbin installsitebin installvendorbin
+ bindoc => installman1dir installsiteman1dir installvendorman1dir
+ libdoc => installman3dir installsiteman3dir installvendorman3dir
+ binhtml => installhtml1dir installsitehtml1dir installvendorhtml1dir [*]
+ libhtml => installhtml3dir installsitehtml3dir installvendorhtml3dir [*]
+
+ * Under some OS (eg. MSWin32) the destination for HTML documents is determined by the C<Config.pm> entry C<installhtmldir>.
+
+The default value of C<installdirs> is "site".
+
+=head2 install_base
+
+You can also set the whole bunch of installation paths by supplying the C<install_base> parameter to point to a directory on your system. For instance, if you set C<install_base> to "/home/ken" on a Linux system, you'll install as follows:
+
+ lib => /home/ken/lib/perl5
+ arch => /home/ken/lib/perl5/i386-linux
+ script => /home/ken/bin
+ bin => /home/ken/bin
+ bindoc => /home/ken/man/man1
+ libdoc => /home/ken/man/man3
+ binhtml => /home/ken/html
+ libhtml => /home/ken/html
+
+=head2 prefix
+
+This sets a prefix, identical to ExtUtils::MakeMaker's PREFIX option. This does something similar to C<install_base> in a much more complicated way.
+
+=head2 config()
+
+The L<ExtUtils::Config|ExtUtils::Config> object used for this object.
+
+=head2 verbose
+
+The verbosity of ExtUtils::InstallPaths. It defaults to 0
+
+=head2 blib
+
+The location of the blib directory, it defaults to 'blib'.
+
+=head2 create_packlist
+
+Together with C<module_name> this controls whether a packlist will be added; it defaults to 1.
+
+=head2 dist_name
+
+The name of the current module.
+
+=head2 module_name
+
+The name of the main module of the package. This is required for packlist creation, but in the future it may be replaced by dist_name. It defaults to C<dist_name =~ s/-/::/gr> if dist_name is set.
+
+=head2 destdir
+
+If you want to install everything into a temporary directory first (for instance, if you want to create a directory tree that a package manager like C<rpm> or C<dpkg> could create a package from), you can use the C<destdir> parameter. E.g. Setting C<destdir> to C<"/tmp/foo"> will effectively install to "/tmp/foo/$sitelib", "/tmp/foo/$sitearch", and the like, except that it will use C<File::Spec> to make the pathnames work correctly on whatever platform you're installing on.
+
+=head1 METHODS
+
+=head2 new
+
+Create a new ExtUtils::InstallPaths object. B<All attributes are valid arguments> to the constructor, as well as this:
+
+=over 4
+
+=item * install_path
+
+This must be a hashref with the type as keys and the destination as values.
+
+=item * install_base_relpaths
+
+This must be a hashref with types as keys and a path relative to the install_base as value.
+
+=item * prefix_relpaths
+
+This must be a hashref any of these three keys: core, vendor, site. Each of the values mush be a hashref with types as keys and a path relative to the prefix as value. You probably want to make these three hashrefs identical.
+
+=item * original_prefix
+
+This must be a hashref with the legal installdirs values as keys and the prefix directories as values.
+
+=item * install_sets
+
+This mush be a hashref with the legal installdirs are keys, and the values being hashrefs with types as keys and locations as values.
+
+=back
+
+=head2 install_map()
+
+Return a map suitable for use with L<ExtUtils::Install>. B<In most cases, this is the only method you'll need>.
+
+=head2 install_destination($type)
+
+Returns the destination of a certain type.
+
+=head2 install_types()
+
+Return a list of all supported install types in the current configuration.
+
+=head2 is_default_installable($type)
+
+Given a file type, will return true if the file type would normally be installed when neither install-base nor prefix has been set. I.e. it will be true only if the path is set from the configuration object or set explicitly by the user via install_path.
+
+=head2 install_path($type)
+
+Gets the install path for a certain type.
+
+=head2 install_sets($installdirs, $type)
+
+Get the path for a certain C<$type> with a certain C<$installdirs>.
+
+=head2 install_base_relpaths($type, $relpath)
+
+Get the relative paths for use with install_base for a certain type.
+
+=head2 prefix_relative($installdirs, $type)
+
+Gets the path of a certain C<$type> and C<$installdirs> relative to the prefix.
+
+=head2 prefix_relpaths($install_dirs, $type)
+
+Get the default relative path to use in case the config install paths cannot be prefixified. You do not want to use this to get any relative path, but may require it to set it for custom types.
+
+=head2 original_prefix($installdirs)
+
+Get the original prefix for a certain type of $installdirs.
+
+=head1 SEE ALSO
+
+=over 4
+
+=item * L<Build.PL spec|http://github.com/dagolden/cpan-api-buildpl/blob/master/lib/CPAN/API/BuildPL.pm>
+
+=back
+
+=head1 AUTHORS
+
+=over 4
+
+=item *
+
+Ken Williams <kwilliams@cpan.org>
+
+=item *
+
+Leon Timmermans <leont@cpan.org>
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2011 by Ken Williams, Leon Timmermans.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=cut
diff --git a/t/00-compile.t b/t/00-compile.t
new file mode 100644
index 0000000..0b7224f
--- /dev/null
+++ b/t/00-compile.t
@@ -0,0 +1,51 @@
+use 5.006;
+use strict;
+use warnings;
+
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
+
+use Test::More;
+
+plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
+
+my @module_files = (
+ 'ExtUtils/InstallPaths.pm'
+);
+
+
+
+# no fake home requested
+
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
+
+use File::Spec;
+use IPC::Open3;
+use IO::Handle;
+
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
+
+my @warnings;
+for my $lib (@module_files)
+{
+ # see L<perlfaq8/How can I capture STDERR from an external command?>
+ my $stderr = IO::Handle->new;
+
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
+ binmode $stderr, ':crlf' if $^O eq 'MSWin32';
+ my @_warnings = <$stderr>;
+ waitpid($pid, 0);
+ is($?, 0, "$lib loaded ok");
+
+ if (@_warnings)
+ {
+ warn @_warnings;
+ push @warnings, @_warnings;
+ }
+}
+
+
+
+is(scalar(@warnings), 0, 'no warnings found')
+ or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
+
+
diff --git a/t/destinations.t b/t/destinations.t
new file mode 100644
index 0000000..0575eb3
--- /dev/null
+++ b/t/destinations.t
@@ -0,0 +1,284 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings FATAL => 'all';
+use Test::More tests => 105;
+
+use Config;
+use File::Temp ();
+
+use File::Spec::Functions 0.83 ':ALL';
+my $tmp = File::Temp::tempdir('EIP-XXXXXXXX', CLEANUP => 1, DIR => tmpdir);
+
+use ExtUtils::Config;
+use ExtUtils::InstallPaths;
+
+#########################
+
+# We need to create a well defined environment to test install paths.
+# We do this by setting up appropriate Config entries.
+
+my @installstyle = qw(lib perl5);
+my $config = ExtUtils::Config->new({
+ installstyle => catdir(@installstyle),
+
+ installprivlib => catdir($tmp, @installstyle),
+ installarchlib => catdir($tmp, @installstyle, @Config{qw(version archname)}),
+ installbin => catdir($tmp, 'bin'),
+ installscript => catdir($tmp, 'bin'),
+ installman1dir => catdir($tmp, 'man', 'man1'),
+ installman3dir => catdir($tmp, 'man', 'man3'),
+ installhtml1dir => catdir($tmp, 'html'),
+ installhtml3dir => catdir($tmp, 'html'),
+
+ installsitelib => catdir($tmp, 'site', @installstyle, 'site_perl'),
+ installsitearch => catdir($tmp, 'site', @installstyle, 'site_perl', @Config{qw(version archname)}),
+ installsitebin => catdir($tmp, 'site', 'bin'),
+ installsitescript => catdir($tmp, 'site', 'bin'),
+ installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'),
+ installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'),
+ installsitehtml1dir => catdir($tmp, 'site', 'html'),
+ installsitehtml3dir => catdir($tmp, 'site', 'html'),
+});
+
+sub get_ei {
+ my %args = @_;
+ return ExtUtils::InstallPaths->new(installdirs => 'site', config => $config, dist_name => 'ExtUtils-InstallPaths', %args);
+}
+
+isa_ok(get_ei, 'ExtUtils::InstallPaths');
+
+{
+ my $elem = catdir(rootdir, qw/foo bar/);
+ my $ei = get_ei(install_path => { elem => $elem});
+ is($ei->install_path('elem'), $elem, ' can read stored path');
+}
+
+{
+ my $ei = get_ei(install_base => catdir(rootdir, 'bar'), install_base_relpaths => { 'elem' => catdir(qw/foo bar/) });
+
+ is($ei->install_base_relpaths('elem'), catdir(qw/foo bar/), ' can read stored path');
+ is($ei->install_destination('lib'), catdir(rootdir, qw/bar lib perl5/), 'destination of other items is not affected');
+}
+
+
+{
+ my $ei = eval { get_ei(prefix_relpaths => { 'site' => { 'elem' => catdir(rootdir, qw/foo bar/)} }) };
+ is ($ei, undef, '$ei undefined');
+ like($@, qr/Value must be a relative path/, ' emits error if path not relative');
+}
+
+{
+ my $ei = get_ei(prefix_relpaths => { site => { elem => catdir(qw/foo bar/) } });
+
+ my $path = $ei->prefix_relpaths('site', 'elem');
+ is($path, catdir(qw(foo bar)), ' can read stored path');
+}
+
+
+# Check that we install into the proper default locations.
+{
+ my $ei = get_ei();
+
+ test_install_destinations($ei, {
+ lib => catdir($tmp, 'site', @installstyle, 'site_perl'),
+ arch => catdir($tmp, 'site', @installstyle, 'site_perl', @Config{qw(version archname)}),
+ bin => catdir($tmp, 'site', 'bin'),
+ script => catdir($tmp, 'site', 'bin'),
+ bindoc => catdir($tmp, 'site', 'man', 'man1'),
+ libdoc => catdir($tmp, 'site', 'man', 'man3'),
+ binhtml => catdir($tmp, 'site', 'html'),
+ libhtml => catdir($tmp, 'site', 'html'),
+ }, 'installdirs=site');
+ test_install_map($ei, {
+ read => '',
+ write => catfile($ei->install_destination('arch'), qw/auto ExtUtils InstallPaths .packlist/),
+ catdir('blib', 'lib') => catdir($tmp, 'site', @installstyle, 'site_perl'),
+ catdir('blib', 'arch') => catdir($tmp, 'site', @installstyle, 'site_perl', @Config{qw(version archname)}),
+ catdir('blib', 'bin') => catdir($tmp, 'site', 'bin'),
+ catdir('blib', 'script') => catdir($tmp, 'site', 'bin'),
+ }, 'installdirs=site');
+}
+
+# Is installdirs honored?
+{
+ my $ei = get_ei(installdirs => 'core');
+ is($ei->installdirs, 'core');
+
+ test_install_destinations($ei, {
+ lib => catdir($tmp, @installstyle),
+ arch => catdir($tmp, @installstyle, @Config{qw(version archname)}),
+ bin => catdir($tmp, 'bin'),
+ script => catdir($tmp, 'bin'),
+ bindoc => catdir($tmp, 'man', 'man1'),
+ libdoc => catdir($tmp, 'man', 'man3'),
+ binhtml => catdir($tmp, 'html'),
+ libhtml => catdir($tmp, 'html'),
+ });
+}
+
+# Check install_base()
+{
+ my $install_base = catdir('foo', 'bar');
+ my $ei = get_ei(install_base => $install_base);
+
+ is($ei->prefix, undef);
+ is($ei->install_base, $install_base);
+
+ test_install_destinations($ei, {
+ lib => catdir($install_base, 'lib', 'perl5'),
+ arch => catdir($install_base, 'lib', 'perl5', $Config{archname}),
+ bin => catdir($install_base, 'bin'),
+ script => catdir($install_base, 'bin'),
+ bindoc => catdir($install_base, 'man', 'man1'),
+ libdoc => catdir($install_base, 'man', 'man3'),
+ binhtml => catdir($install_base, 'html'),
+ libhtml => catdir($install_base, 'html'),
+ });
+
+ test_install_map($ei, {
+ read => '',
+ write => catfile($ei->install_destination('arch'), qw/auto ExtUtils InstallPaths .packlist/),
+ catdir('blib', 'lib') => catdir($install_base, 'lib', 'perl5'),
+ catdir('blib', 'arch') => catdir($install_base, 'lib', 'perl5', $Config{archname}),
+ catdir('blib', 'bin') => catdir($install_base, 'bin'),
+ catdir('blib', 'script') => catdir($install_base, 'bin'),
+ }, 'install_base');
+}
+
+
+# Basic prefix test. Ensure everything is under the prefix.
+{
+ my $prefix = catdir(qw/some prefix/);
+ my $ei = get_ei(prefix => $prefix);
+
+ ok(!defined $ei->install_base, 'install_base is not defined');
+ is($ei->prefix, $prefix, "The prefix is $prefix");
+
+ test_prefix($ei, $prefix);
+# test_prefix($ei, $prefix, $ei->install_sets('site'));
+}
+
+# And now that prefix honors installdirs.
+{
+ my $prefix = catdir(qw/some prefix/);
+ my $ei = get_ei(prefix => $prefix, installdirs => 'core');
+
+ is($ei->installdirs, 'core');
+ test_prefix($ei, $prefix);
+}
+
+{
+ my $ei = get_ei;
+# Try a config setting which would result in installation locations outside
+# the prefix. Ensure it doesn't.
+ # Get the prefix defaults
+ my @types = $ei->install_types;
+
+ # Create a configuration involving weird paths that are outside of
+ # the configured prefix.
+ my @prefixes = ([qw(foo bar)], [qw(biz)], []);
+
+ my %test_config;
+ foreach my $type (@types) {
+ my $prefix = shift @prefixes || [qw(foo bar)];
+ $test_config{$type} = catdir(rootdir, @$prefix, @{$ei->prefix_relpaths('site', $type)});
+ }
+
+ # Poke at the innards of E::IP to change the default install locations.
+ my $prefix = catdir('another', 'prefix');
+ my $config = ExtUtils::Config->new({ siteprefixexp => catdir(rootdir, 'wierd', 'prefix')});
+ $ei = get_ei(install_sets => { site => \%test_config }, config => $config, prefix => $prefix);
+
+ test_prefix($ei, $prefix, \%test_config);
+}
+
+# Check that we can use install_base after setting prefix.
+{
+ my $install_base = catdir('foo', 'bar');
+ my $ei = get_ei(install_base => $install_base, prefix => 'whatever');
+
+ test_install_destinations($ei, {
+ lib => catdir($install_base, 'lib', 'perl5'),
+ arch => catdir($install_base, 'lib', 'perl5', $Config{archname}),
+ bin => catdir($install_base, 'bin'),
+ script => catdir($install_base, 'bin'),
+ bindoc => catdir($install_base, 'man', 'man1'),
+ libdoc => catdir($install_base, 'man', 'man3'),
+ binhtml => catdir($install_base, 'html'),
+ libhtml => catdir($install_base, 'html'),
+ });
+}
+
+sub dir_contains {
+ my ($first, $second) = @_;
+ # File::Spec doesn't have an easy way to check whether one directory
+ # is inside another, unfortunately.
+
+ ($first, $second) = map { canonpath($_) } ($first, $second);
+ my @first_dirs = splitdir($first);
+ my @second_dirs = splitdir($second);
+
+ return 0 if @second_dirs < @first_dirs;
+
+ my $is_same = ( case_tolerant() ? sub { lc(shift()) eq lc(shift()) } : sub { shift() eq shift() });
+
+ while (@first_dirs) {
+ return 0 unless $is_same->(shift @first_dirs, shift @second_dirs);
+ }
+
+ return 1;
+}
+
+
+sub test_prefix {
+ my ($ei, $prefix, $test_config) = @_;
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ foreach my $type (qw/lib arch bin script bindoc libdoc binhtml libhtml/) {
+ my $dest = $ei->install_destination($type);
+ ok dir_contains($prefix, $dest), "$type prefixed";
+
+ SKIP: {
+ skip("'$type' not configured", 1) unless $test_config && $test_config->{$type};
+
+ have_same_ending($dest, $test_config->{$type}, " suffix correctish ($test_config->{$type} + $prefix = $dest)");
+ }
+ }
+}
+
+sub have_same_ending {
+ my ($dir1, $dir2, $message) = @_;
+
+ $dir1 =~ s{/$}{} if $^O eq 'cygwin'; # remove any trailing slash
+ my (undef, $dirs1, undef) = splitpath $dir1;
+ my @dir1 = splitdir $dirs1;
+
+ $dir2 =~ s{/$}{} if $^O eq 'cygwin'; # remove any trailing slash
+ my (undef, $dirs2, undef) = splitpath $dir2;
+ my @dir2 = splitdir $dirs2;
+
+ is $dir1[-1], $dir2[-1], $message;
+}
+
+sub test_install_destinations {
+ my ($build, $expect) = @_;
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ while(my ($type, $expect) = each %$expect) {
+ is($build->install_destination($type), $expect, "$type destination");
+ }
+}
+
+sub test_install_map {
+ my ($paths, $expect, $case) = @_;
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
+ my $map = $paths->install_map;
+ while(my ($type, $expect) = each %$expect) {
+ is($map->{$type}, $expect, "$type destination for $case");
+ }
+}
diff --git a/t/release-pod-coverage.t b/t/release-pod-coverage.t
new file mode 100644
index 0000000..18a8274
--- /dev/null
+++ b/t/release-pod-coverage.t
@@ -0,0 +1,15 @@
+#!perl
+
+BEGIN {
+ unless ($ENV{RELEASE_TESTING}) {
+ require Test::More;
+ Test::More::plan(skip_all => 'these tests are for release candidate testing');
+ }
+}
+
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
+
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
diff --git a/t/release-pod-syntax.t b/t/release-pod-syntax.t
new file mode 100644
index 0000000..cdd6a6c
--- /dev/null
+++ b/t/release-pod-syntax.t
@@ -0,0 +1,14 @@
+#!perl
+
+BEGIN {
+ unless ($ENV{RELEASE_TESTING}) {
+ require Test::More;
+ Test::More::plan(skip_all => 'these tests are for release candidate testing');
+ }
+}
+
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
+use Test::More;
+use Test::Pod 1.41;
+
+all_pod_files_ok();