pm_to_blib({ 'lib/foo/bar.pm' => 'blib/lib/foo/bar.pm' }); Handles the installing and uninstalling of perl modules, scripts, man pages, etc...

Similar documents
This document describes version 2.07 of File::Path, released

runs all the testscripts named as arguments and checks standard output for the expected strings in TAP format.

If you're on Windows where the current directory is always searched first for scripts, you'll probably do something like this:

subtest $builder->subtest($name,

ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker

This document describes version 2.09 of File::Path, released

$ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name:

ExtUtils::MM_VMS - methods to override UN*X behaviour in ExtUtils::MakeMaker

11/3/71 SYS BREAK (II)

use File::Find; find({ wanted => \&process, follow => 1 }, '.');

# use a BEGIN block so we print our plan before MyModule is loaded BEGIN { plan tests => 14, todo => [3,4] }

Subclass off of ExtUtils::MM_Any and ExtUtils::MM_Unix. This is a temporary solution.

print STDERR "This is a debugging message.\n";

1. Introduction. 2. Scalar Data

lock_ref_keys unlock_ref_keys lock_ref_value unlock_ref_value lock_hashref unlock_hashref lock_ref_keys_plus hidden_ref_keys legal_ref_keys

AHHHHHHH!!!! NOT TESTING! Anything but testing! Beat me, whip me, send me to Detroit, but don t make me write tests!

This module provide a convenient way to create directories of arbitrary depth and to delete an entire directory subtree from the filesystem.

lock_ref_keys unlock_ref_keys lock_ref_value unlock_ref_value lock_hashref unlock_hashref lock_ref_keys_plus hidden_ref_keys legal_ref_keys

IT441. Network Services Administration. Perl: File Handles

$ftp = Net::FTP->new("some.host.name", Debug => 0) or die "Cannot connect to some.host.name:

use Params::Check qw[check allow last_error];

Testing Exceptions with Enforcer

use Log::Message private => 0, config => '/our/cf_file'; my $log = Log::Message->new( private => 1, level => 'log', config => '/my/cf_file', );

Subroutines. Subroutines. The Basics. aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc.

Hash::Util::FieldHash offers a number of functions in support of The Inside-out Technique of class construction.

Pod::Usage, pod2usage() - print a usage message from embedded pod documentation

*roff code is suitable for display on a terminal using nroff(1), normally via man(1), or printing using troff(1).

perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sletters][,-xlevel] prog.pl

WinCvs Version 1.1. Users Guide. Don Harper

Manual Shell Script Bash If File Exists And Is Not Empty

Module::Pluggable - automatically give your module the ability to have plugins

### build a File::Fetch object ### my $ff = File::Fetch->new(uri => '

$bool = $obj->mk_aliases( # create an alias to an existing alias_name => 'method'); # method name

A Crash Course in Perl5

NAME SYNOPSIS. Perl version documentation - Pod::Parser. Pod::Parser - base class for creating POD filters and translators.

Or, if you're on a platform (like DOS or Windows) that doesn't require the "./" notation, you can do this:

$syntax_okay = podchecker($filepath, $outputpath, %options);

The init routine asks a few questions and writes a CPAN/Config.pm or CPAN/MyConfig.pm file (depending on what it is currently using).

Dec2005: Released with v6.u1u1. Other than the title, the document is unchanged relative to v6.1.

CMPS 12M Winter 2018 Lab 1 Due: Monday January 11:59pm

The Perl Debugger. Avoiding Bugs with Warnings and Strict. Daniel Allen. Abstract

### build an Archive::Extract object ### my $ae = Archive::Extract->new( archive => 'foo.tgz' );

NAME SYNOPSIS. Perl version documentation - Pod::Parser. Pod::Parser - base class for creating POD filters and translators.

autodie - Replace functions with ones that succeed or die with lexical scope # Recommended: implies 'use autodie qw(:default)'

Manual Shell Script Linux If File Exists And

A Tutorial on using Code::Blocks with Catalina 3.0.3

CS370 Operating Systems

Command line options come in several flavours. Historically, they are preceded by a single dash -, and consist of a single letter.

Master Syndication Gateway V2. User's Manual. Copyright Bontrager Connection LLC

Classnote for COMS6100

Chapter 1 Getting Started

AutoArchive. Release 1.4.1

This document contains information about the ElectricAccelerator Solution Support Add-in. Topics include: Overview 2. New Features and Improvements 2

1 Apache::File - advanced functions for manipulating

my $gm = new File::GlobMapper $input => $output or die $File::GlobMapper::Error ;

Exercise 3: Adding a file to the master directory

9.2 Linux Essentials Exam Objectives

Programming II (CS300)

use Pod::Man; my $parser = Pod::Man->new (release => $VERSION, section => 8);

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

By default, optional warnings are disabled, so any legacy code that doesn't attempt to control the warnings will work unchanged.

19 AMSDOS BIOS Facilities

Subclass off of ExtUtils::MM_Any and ExtUtils::MM_Unix. This is a temporary solution.

use CGI::Carp qw(fatalstobrowser); die "Fatal error messages are now sent to browser";

perl -MO=Deparse[,-d][,-fFILE][,-p][,-q][,-l] [,-sletters][,-xlevel] prog.pl

Pathologically Eclectic Rubbish Lister

Be sure to read ENCODING if your Pod contains non-ascii characters.

my $full_path = can_run('wget') or warn 'wget is not installed!';

Chapter 2. Basics of Program Writing

CS 105 Perl: Completing the Toolbox

Automated Testing of Large Projects With Perl. Andy Lester

PS1-MOPS SOURCE CODE DOCUMENTATION

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

Jlint status of version 3.0

ExtUtils::MakeMaker::FAQ - Frequently Asked Questions About MakeMaker

EMC Documentum Foundation Classes

# Rather than print STDERR "# here s what went wrong\n" diag("here s what went wrong");

Laboratory Assignment #4 Debugging in Eclipse CDT 1

OPERATING SYSTEMS, ASSIGNMENT 4 FILE SYSTEM

A Field Guide To The Perl Command Line. Andy Lester

Version control with RCS and CVS An introduction. Markus Bjartveit Krüger

17 CIF Converter Tools

CS61 Scribe Notes Lecture 18 11/6/14 Fork, Advanced Virtual Memory

Reviewing gcc, make, gdb, and Linux Editors 1

ALICE: Application-Level Intelligent Crash Explorer

CIS 505: Software Systems

use attributes (); # optional, to get subroutine declarations = attributes::get(\&foo);

Exceptions. References. Exceptions. Exceptional Conditions. CSE 413, Autumn 2005 Programming Languages

TARGETPROCESS PLUGIN DEVELOPMENT GUIDE

CSC 8400: Computer Systems. Using the Stack for Function Calls

CS 326: Operating Systems. Process Execution. Lecture 5

Program Structure. Steven M. Bellovin April 3,

Lab #0 Getting Started Due In Your Lab, August 25, 2004

Exceptions. CSE 142, Summer 2002 Computer Programming 1.

Exceptions. Readings and References. Exceptions. Exceptional Conditions. Reading. CSE 142, Summer 2002 Computer Programming 1.

Programming Project 1: Introduction to the BLITZ Tools

General Coding Standards

This document describes version 0.87 of Attribute::Handlers, released September 21, 2009.

Dialyzer Copyright Ericsson AB. All Rights Reserved. Dialyzer December 9, 2014

rpaths Documentation Release 0.2 Remi Rampin

Transcription:

NAME ExtUtils::Install - install files from here to there SYNOPSIS use ExtUtils::Install; install({ 'blib/lib' => 'some/install/dir' } ); uninstall($packlist); VERSION 2.04 DESCRIPTION pm_to_blib({ 'lib/foo/bar.pm' => 'blib/lib/foo/bar.pm' }); Handles the installing and uninstalling of perl modules, scripts, man pages, etc... Both install() and uninstall() are specific to the way ExtUtils::MakeMaker handles the installation and deinstallation of perl modules. They are not designed as general purpose tools. On some operating systems such as Win32 installation may not be possible until after a reboot has occurred. This can have varying consequences: removing an old DLL does not impact programs using the new one, but if a new DLL cannot be installed properly until reboot then anything depending on it must wait. The package variable $ExtUtils::Install::MUST_REBOOT is used to store this status. If this variable is true then such an operation has occurred and anything depending on this module cannot proceed until a reboot has occurred. If this value is defined but false then such an operation has ocurred, but should not impact later operations. _chmod($$;$) _warnonce(@) _choke(@) Wrapper to chmod() for debugging and error trapping. Warns about something only once. Dies with a special message. _move_file_at_boot( $file, $target, $moan ) OS-Specific, Win32/Cygwin Schedules a file to be moved/renamed/deleted at next boot. $file should be a filespec of an existing file $target should be a ref to an array if the file is to be deleted otherwise it should be a filespec for a rename. If the file is existing it will be replaced. Sets $MUST_REBOOT to 0 to indicate a deletion operation has occurred and sets it to 1 to indicate that a move operation has been requested. returns 1 on success, on failure if $moan is false errors are fatal. If $moan is true then returns 0 on error and warns instead of dies. Page 1

Functions _unlink_or_rename( $file, $tryhard, $installing ) OS-Specific, Win32/Cygwin Tries to get a file out of the way by unlinking it or renaming it. On some OS'es (Win32 based) DLL files can end up locked such that they can be renamed but not deleted. Likewise sometimes a file can be locked such that it cant even be renamed or changed except at reboot. To handle these cases this routine finds a tempfile name that it can either rename the file out of the way or use as a proxy for the install so that the rename can happen later (at reboot). $file : the file to remove. $tryhard : should advanced tricks be used for deletion $installing : we are not merely deleting but we want to overwrite When $tryhard is not true if the unlink fails its fatal. When $tryhard is true then the file is attempted to be renamed. The renamed file is then scheduled for deletion. If the rename fails then $installing governs what happens. If it is false the failure is fatal. If it is true then an attempt is made to schedule installation at boot using a temporary file to hold the new file. If this fails then a fatal error is thrown, if it succeeds it returns the temporary file name (which will be a derivative of the original in the same directory) so that the caller can use it to install under. In all other cases of success returns $file. On failure throws a fatal error. _get_install_skip Handles loading the INSTALL.SKIP file. Returns an array of patterns to use. _have_write_access Abstract a -w check that tries to use POSIX::access() if possible. _can_write_dir($dir) Checks whether a given directory is writable, taking account the possibility that the directory might not exist and would have to be created first. Returns a list, containing: ($writable, $determined_by, @create) $writable says whether the directory is (hypothetically) writable $determined_by is the directory the status was determined from. It will be either the $dir, or one of its parents. @create is a list of directories that would probably have to be created to make the requested directory. It may not actually be correct on relative paths with.. in them. But for our purposes it should work ok _mkpath($dir,$show,$mode,$verbose,$dry_run) Wrapper around File::Path::mkpath() to handle errors. If $verbose is true and >1 then additional diagnostics will be produced, also this will force $show to true. If $dry_run is true then the directory will not be created but a check will be made to see whether it would be possible to write to the directory, or that it would be possible to create the directory. If $dry_run is not true dies if the directory can not be created or is not writable. _copy($from,$to,$verbose,$dry_run) Wrapper around File::Copy::copy to handle errors. If $verbose is true and >1 then additional diagnostics will be emitted. If $dry_run is true then the copy will not actually occur. Page 2

Dies if the copy fails. _chdir($from) Wrapper around chdir to catch errors. If not called in void context returns the cwd from before the chdir. dies on error. install # deprecated forms install(\%from_to); install(\%from_to, $verbose, $dry_run, $uninstall_shadows, $skip, $always_copy, \%result); # recommended form as of 1.47 install([ from_to => \%from_to, verbose => 1, dry_run => 0, uninstall_shadows => 1, skip => undef, always_copy => 1, result => \%install_results, ]); Copies each directory tree of %from_to to its corresponding value preserving timestamps and permissions. There are two keys with a special meaning in the hash: "read" and "write". These contain packlist files. After the copying is done, install() will write the list of target files to $from_to{write}. If $from_to{read} is given the contents of this file will be merged into the written file. The read and the written file may be identical, but on AFS it is quite likely that people are installing to a different directory than the one where the files later appear. If $verbose is true, will print out each file removed. Default is false. This is "make install VERBINST=1". $verbose values going up to 5 show increasingly more diagnostics output. If $dry_run is true it will only print what it was going to do without actually doing it. Default is false. If $uninstall_shadows is true any differing versions throughout @INC will be uninstalled. This is "make install UNINST=1" As of 1.37_02 install() supports the use of a list of patterns to filter out files that shouldn't be installed. If $skip is omitted or undefined then install will try to read the list from INSTALL.SKIP in the CWD. This file is a list of regular expressions and is just like the MANIFEST.SKIP file used by ExtUtils::Manifest. A default site INSTALL.SKIP may be provided by setting then environment variable EU_INSTALL_SITE_SKIPFILE, this will only be used when there isn't a distribution specific INSTALL.SKIP. If the environment variable EU_INSTALL_IGNORE_SKIP is true then no install file filtering will be performed. If $skip is undefined then the skip file will be autodetected and used if it is found. If $skip is a reference to an array then it is assumed the array contains the list of patterns, if $skip is a true non reference it is assumed to be the filename holding the list of patterns, any other value of $skip is taken to mean that no install filtering should occur. Changes As of Version 1.47 As of version 1.47 the following additions were made to the install interface. Note that the new argument style and use of the %result hash is recommended. Page 3

The $always_copy parameter which when true causes files to be updated regardless as to whether they have changed, if it is defined but false then copies are made only if the files have changed, if it is undefined then the value of the environment variable EU_INSTALL_ALWAYS_COPY is used as default. The %result hash will be populated with the various keys/subhashes reflecting the install. Currently these keys and their structure are: install => { $target => $source }, install_fail => { $target => $source }, install_unchanged => { $target => $source }, install_filtered => { $source => $pattern }, uninstall => { $uninstalled => $source }, uninstall_fail => { $uninstalled => $source }, where $source is the filespec of the file being installed. $target is where it is being installed to, and $uninstalled is any shadow file that is in @INC or $ENV{PERL5LIB} or other standard locations, and $pattern is the pattern that caused a source file to be skipped. In future more keys will be added, such as to show created directories, however this requires changes in other modules and must therefore wait. These keys will be populated before any exceptions are thrown should there be an error. Note that all updates of the %result are additive, the hash will not be cleared before use, thus allowing status results of many installs to be easily aggregated. NEW ARGUMENT STYLE If there is only one argument and it is a reference to an array then the array is assumed to contain a list of key-value pairs specifying the options. In this case the option "from_to" is mandatory. This style means that you do not have to supply a cryptic list of arguments and can use a self documenting argument list that is easier to understand. This is now the recommended interface to install(). RETURN _do_cleanup If all actions were successful install will return a hashref of the results as described above for the $result parameter. If any action is a failure then install will die, therefore it is recommended to pass in the $result parameter instead of using the return value. If the result parameter is provided then the returned hashref will be the passed in hashref. Standardize finish event for after another instruction has occurred. Handles converting $MUST_REBOOT to a die for instance. install_rooted_file( $file ) Returns $file, or catfile($install_root,$file) if $INSTALL_ROOT is defined. install_rooted_dir( $dir ) Returns $dir, or catdir($install_root,$dir) if $INSTALL_ROOT is defined. forceunlink( $file, $tryhard ) Tries to delete a file. If $tryhard is true then we will use whatever devious tricks we can to delete the file. Currently this only applies to Win32 in that it will try to use Win32API::File to schedule a delete at reboot. A wrapper for _unlink_or_rename(). directory_not_empty( $dir ) Returns 1 if there is an.exists file somewhere in a directory tree. Returns 0 if there is not. Page 4

install_default DISCOURAGED install_default(); install_default($fullext); Calls install() with arguments to copy a module from blib/ to the default site installation location. $fullext is the name of the module converted to a directory (ie. Foo::Bar would be Foo/Bar). If $fullext is not specified, it will attempt to read it from @ARGV. This is primarily useful for install scripts. NOTE This function is not really useful because of the hard-coded install location with no way to control site vs core vs vendor directories and the strange way in which the module name is given. Consider its use discouraged. uninstall uninstall($packlist_file); uninstall($packlist_file, $verbose, $dont_execute); Removes the files listed in a $packlist_file. If $verbose is true, will print out each file removed. Default is false. If $dont_execute is true it will only print what it was going to do without actually doing it. Default is false. inc_uninstall($filepath,$libdir,$verbose,$dry_run,$ignore,$results) Remove shadowed files. If $ignore is true then it is assumed to hold a filename to ignore. This is used to prevent spurious warnings from occurring when doing an install at reboot. We now only die when failing to remove a file that has precedence over our own, when our install has precedence we only warn. $results is assumed to contain a hashref which will have the keys 'uninstall' and 'uninstall_fail' populated with keys for the files removed and values of the source files they would shadow. run_filter($cmd,$src,$dest) pm_to_blib _autosplit _invokant Filter $src using $cmd into $dest. pm_to_blib(\%from_to, $autosplit_dir); pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd); Copies each key of %from_to to its corresponding value efficiently. Filenames with the extension.pm are autosplit into the $autosplit_dir. Any destination directories are created. $filter_cmd is an optional shell command to run each.pm file through prior to splitting and copying. Input is the contents of the module, output the new module contents. You can have an environment variable PERL_INSTALL_ROOT set which will be prepended as a directory to each installed file (and directory). By default verbose output is generated, setting the PERL_INSTALL_QUIET environment variable will silence this output. From 1.0307 back, AutoSplit will sometimes leave an open filehandle to the file being split. This causes problems on systems with mandatory locking (ie. Windows). So we wrap it and close the filehandle. Page 5

ENVIRONMENT AUTHOR LICENSE Does a heuristic on the stack to see who called us for more intelligent error messages. Currently assumes we will be called only by Module::Build or by ExtUtils::MakeMaker. PERL_INSTALL_ROOT Will be prepended to each install path. EU_INSTALL_IGNORE_SKIP Will prevent the automatic use of INSTALL.SKIP as the install skip file. EU_INSTALL_SITE_SKIPFILE If there is no INSTALL.SKIP file in the make directory then this value can be used to provide a default. EU_INSTALL_ALWAYS_COPY If this environment variable is true then normal install processes will always overwrite older identical files during the install process. Note that the alias EU_ALWAYS_COPY will be supported if EU_INSTALL_ALWAYS_COPY is not defined until at least the 1.50 release. Please ensure you use the correct EU_INSTALL_ALWAYS_COPY. Original author lost in the mists of time. Probably the same as Makemaker. Production release currently maintained by demerphq yves at cpan.org, extensive changes by Michael G. Schwern. Send bug reports via http://rt.cpan.org/. Please send your generated Makefile along with your report. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/artistic.html Page 6