| Module-Install-CustomInstallationPath documentation | Contained in the Module-Install-CustomInstallationPath distribution. |
Module::Install::CustomInstallationPath - A Module::Install extension that allows the user to interactively specify custom installation directories
In Makefile.PL:
use inc::Module::Install;
...
check_custom_installation();
This is a Module::Install extension that helps users who do not have root access to install modules. It first prompts the user for a normal installation into the default Perl paths, or a custom installation. If the user selects a custom installation, it prompts the user for the value for PREFIX. This value is then used to add PREFIX=value to @ARGV.
If the user specifies PREFIX or INSTALLDIRS as arguments to Makefile.PL, then the prompts are skipped and a normal installation is done.
Consider carefully whether you want to use this module. In my experience, many people don't want an interactive installation. For example, CPAN users have likely already thought about custom installation paths. Debian package maintainers also want non-interactive installs.
Imported into Makefile.PL by Module::Install when invoked. This causes the prompts to be displayed and @ARGV to be updated (if necessary).
This code is distributed under the GNU General Public License (GPL). See the file LICENSE in the distribution, http://www.opensource.org/gpl-license.html, and http://www.opensource.org/.
David Coppit <david@coppit.org>
| Module-Install-CustomInstallationPath documentation | Contained in the Module-Install-CustomInstallationPath distribution. |
package Module::Install::CustomInstallationPath; use strict; use 5.004; use File::HomeDir; use Config; use vars qw( @ISA $VERSION ); use Module::Install::Base; @ISA = qw( Module::Install::Base ); $VERSION = sprintf "%d.%02d%02d", q/0.10.40/ =~ /(\d+)/g; # --------------------------------------------------------------------------- sub check_custom_installation { my $self = shift; $self->include_deps('File::HomeDir',0); return if (grep {/^PREFIX=/} @ARGV) || (grep {/^INSTALLDIRS=/} @ARGV); my $install_location = $self->prompt( "Would you like to install this package into a location other than the\n" . "default Perl location (i.e. change the PREFIX)?" => 'n'); if ($install_location eq 'y') { my $home = home(); die "Your home directory could not be determined. Aborting." unless defined $home; print "\n","-"x78,"\n\n"; my $prefix = $self->prompt( "What PREFIX should I use?\n=>" => $home); push @ARGV,"PREFIX=$prefix"; } } 1; # ---------------------------------------------------------------------------