1N/A@
EXPORT = (
'install',
'uninstall',
'pm_to_blib',
'install_default');
1N/A# install relative to here 1N/AExtUtils::Install - install files from here to there 1N/A use ExtUtils::Install; 1N/A uninstall($packlist); 1N/AHandles the installing and uninstalling of perl modules, scripts, man 1N/ABoth install() and uninstall() are specific to the way 1N/AExtUtils::MakeMaker handles the installation and deinstallation of 1N/Aperl modules. They are not designed as general purpose tools. 1N/A install(\%from_to, $verbose, $dont_execute, $uninstall_shadows); 1N/ACopies each directory tree of %from_to to its corresponding value 1N/Apreserving timestamps and permissions. 1N/AThere are two keys with a special meaning in the hash: "read" and 1N/A"write". These contain packlist files. After the copying is done, 1N/Ainstall() will write the list of target files to $from_to{write}. If 1N/A$from_to{read} is given the contents of this file will be merged into 1N/Athe written file. The read and the written file may be identical, but 1N/Aon AFS it is quite likely that people are installing to a different 1N/Adirectory than the one where the files later appear. 1N/AIf $verbose is true, will print out each file removed. Default is 1N/Afalse. This is "make install VERBINST=1" 1N/AIf $dont_execute is true it will only print what it was going to do 1N/Awithout actually doing it. Default is false. 1N/AIf $uninstall_shadows is true any differing versions throughout @INC 1N/Awill be uninstalled. This is "make install UNINST=1" 1N/A # -w doesn't work reliably on FAT dirs 1N/A for (
qw/
read write/) {
1N/A #Check if there are files, and if yes, look if the corresponding 1N/A #target directory is writable for us 1N/A warn "Warning: You do not have permissions to " .
1N/A "install into $from_to{$source_dir_or_file}" 1N/A #copy the tree to the target directory without altering 1N/A #timestamp and permission and remember for the .packlist 1N/A #file. The packlist file contains the absolute paths of the 1N/A #install locations. AFS users may call this a bug. We'll have 1N/A #to reconsider how to add the means to satisfy AFS users also. 1N/A #October 1997: we want to install .pm files into archlib if 1N/A #there are any files in arch. So we depend on having ./blib/arch 1N/A print "Files found in $blib_arch: installing files in $blib_lib into architecture dependent library tree\n";
1N/A chdir $
cwd;
# in case the target is relative 1N/A # 5.5.3's File::Find missing no_chdir option. 1N/A # We have a good chance, we can skip this one 1N/A print "mkpath($targetdir,0,0755)\n" if $
verbose>
1;
1N/A print "Installing $targetfile\n";
1N/A print "utime($atime,$mtime,$targetfile)\n" if $
verbose>
1;
1N/A print "chmod($mode, $targetfile)\n" if $
verbose>
1;
1N/A print "Skipping $targetfile (unchanged)\n" if $
verbose;
1N/A # Record the full pathname. 1N/A # File::Find can get confused if you chdir in here. 1N/A # File::Find seems to always be Unixy except on MacPerl :( 1N/A chdir($
cwd)
or Carp::
croak(
"Couldn't chdir to $cwd: $!");
1N/A print "Writing $pack{'write'}\n";
1N/A unlink $_[
0]
or Carp::
croak(
"Cannot forceunlink $_[0]: $!")
1N/A return if $_
eq ".exists";
1N/A=item B<install_default> I<DISCOURAGED> 1N/A install_default($fullext); 1N/ACalls install() with arguments to copy a module from blib/ to the 1N/Adefault site installation location. 1N/A$fullext is the name of the module converted to a directory 1N/A(ie. Foo::Bar would be Foo/Bar). If $fullext is not specified, it 1N/Awill attempt to read it from @ARGV. 1N/AThis is primarily useful for install scripts. 1N/AB<NOTE> This function is not really useful because of the hard-coded 1N/Ainstall location with no way to control site vs core vs vendor 1N/Adirectories and the strange way in which the module name is given. 1N/AConsider its use discouraged. 1N/A @_ <
2 or die "install_default should be called with 0 or 1 argument";
1N/A defined $
FULLEXT or die "Do not know to where to write install log";
1N/A read =>
"$Config{sitearchexp}/auto/$FULLEXT/.packlist",
1N/A write =>
"$Config{installsitearch}/auto/$FULLEXT/.packlist",
1N/A uninstall($packlist_file); 1N/A uninstall($packlist_file, $verbose, $dont_execute); 1N/ARemoves the files listed in a $packlist_file. 1N/AIf $verbose is true, will print out each file removed. Default is 1N/AIf $dont_execute is true it will only print what it was going to do 1N/Awithout actually doing it. Default is false. 1N/A die "no packlist file found: $fil" unless -f $
fil;
1N/A # my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al)); 1N/A # require $my_req; # Hairy, but for the first 1N/A # The reason why we compare file's contents is, that we cannot 1N/A # know, which is the file we just installed (AFS). So we leave 1N/A # an identical file in place 1N/A # We have a good chance, we can skip this one 1N/A print "#$file and $targetfile differ\n" if $
verbose>
1;
1N/A $
libdir =~ s|^\./||s ;
# That's just cosmetics, no need to port. It looks prettier. 1N/A # if not verbose, we just say nothing 1N/A print "Unlinking $targetfile (shadowing?)\n";
1N/A open(
CMD,
"|$cmd >$dest") ||
die "Cannot fork: $!";
1N/A open(
SRC, $
src) ||
die "Cannot open $src: $!";
1N/A close CMD or die "Filter command '$cmd' failed for $src";
1N/A pm_to_blib(\%from_to, $autosplit_dir); 1N/A pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd); 1N/ACopies each key of %from_to to its corresponding value efficiently. 1N/AFilenames with the extension .pm are autosplit into the $autosplit_dir. 1N/A$filter_cmd is an optional shell command to run each .pm file through 1N/Aprior to splitting and copying. Input is the contents of the module, 1N/Aoutput the new module contents. 1N/AYou can have an environment variable PERL_INSTALL_ROOT set which will 1N/Abe prepended as a directory to each installed file (and directory). 1N/A # my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al)); 1N/A # require $my_req; # Hairy, but for the first 1N/A # Win32 has severe command line length limitations, but 1N/A # can generate temporary files on-the-fly 1N/A # so we pass name of file here - eval it to get hash 1N/A open(
FROMTO,
"<$fromto")
or die "Cannot open $fromto:$!";
1N/A print "Skip $to (unchanged)\n";
1N/A # When a pm_filter is defined, we need to pre-process the source first 1N/A # to determine whether it has changed or not. Therefore, only perform 1N/A # the comparison check when there's no filter to be ran. 1N/A # -- RAM, 03/01/2001 1N/A print "Skip $to (unchanged)\n";
1N/A print "$pm_filter <$from >$to\n";
1N/A print "cp $from $to\n";
1N/A chmod(
0444 | ( $
mode &
0111 ?
0111 :
0 ),$
to);
1N/AFrom 1.0307 back, AutoSplit will sometimes leave an open filehandle to 1N/Athe file being split. This causes problems on systems with mandatory 1N/Alocking (ie. Windows). So we wrap it and close the filehandle. 1N/Asub new {
bless {},
shift }
1N/A print "## Differing version$plural of $file found. You might like to\n";
1N/A for (
0..$
#{$self->{$file}}) { 1N/A $
plural = $i>
1 ?
"all those files" :
"this file";
1N/A print "## Running 'make install UNINST=1' will unlink $plural for you.\n";
1N/A=item B<PERL_INSTALL_ROOT> 1N/AWill be prepended to each install path. 1N/AOriginal author lost in the mists of time. Probably the same as Makemaker. 1N/ACurrently maintained by Michael G Schwern <F<schwern@pobox.com>> 1N/ASend patches and ideas to <F<makemaker@perl.org>>. 1N/Agenerated Makefile along with your report. 1N/AThis program is free software; you can redistribute it and/or 1N/Amodify it under the same terms as Perl itself.