ActiveState::RelocateTree - copy tree substituting paths at the same time
use ActiveState::RelocateTree qw(relocate); relocate(from => 'C:\Perl', to => 'D:\lang\perl');
When a perl installation is copied into a new location, some of its
files need to be modified accordingly. The
ActiveState::RelocateTree
module provide functions that helps you
do this.
The following functions are provided. None of them are exported by default.
to
inplace
option is
true, it will copy the tree at from
to to
before transforming
it. This option is the only one required. The other options have
reasonable defaults, so in most cases this is the only option you need
to provide.
from
$Config{prefix}
, the
home of the currently executing perl interpreter.
search
to
. This
defaults to the value of from
.
replace
search
. This defaults to the value of to
.
inplace
to
already exists and you just want to transform it in-situ,
use this option. It skips the copying step and just transforms the tree.
If from
equals to
, it is set to true and cannot be unset. Otherwise it
defaults to false.
killorig
from
after
copying and transforming to
. Use with care! Defaults to false.
bak
relocate()
creates a backup file for each file
being edited. This option allows you to specify the extension of backup files.
Defaults to .~1~
.
savebaks
relocate()
deletes the backup files before returning. savebaks
skips that step, leaving the backup files alone. Defaults to false (backups
are deleted).
textonly
relocate()
edits both text and binary files. Text files are replaced
using a normal search-and-replace algorithm, but binary files are NULL-padded
so that all offsets remain the same. By default, textonly
is false, i.e.
relocate()
operates on both text and binary files.
ranlib
ranlib
is true, relocate()
will call ranlib
on binary files which
look like library files (have the $Config{_a}
extension). Defaults to true.
verbose
verbose
is true, relocate()
emits warning messages as it performs
certain operations. This may be useful for debugging, or for command-line
tools, where user feedback is a good thing.
quiet
relocate()
prints out some status messages even with verbose
disabled. If quiet
is true, all messages (except error messages) are
temporarily silenced. This option overrides verbose
, so there isn't much
point calling relocate()
with both quiet
and verbose
set. By default,
quiet
is false.
filelist
relocate()
will write a list of the files modified to
filelist
, one filename per line. The lines are prefixed with ``B ''
for binary files and ``T '' for text files.
If $delete_after is TRUE, then tree at $from will be removed after the copy completes. If $verbose is TRUE, then print a message when deleting the $from tree.
relocate()
to search for files which should be edited. If
$is_binary is TRUE, then read the file in binmode.
edit()
is designed to rip though a set of files, efficiently replacing $from
with $dest. It operates on the whole set of files, which all need to be of the
same type (binary or text). It accepts the following parameters:
relocate()
to detect when a replacement path will not fit into the binary.
reloc_perl
Copyright 2002 ActiveState. All Rights Reserved. ActiveState is a division of Sophos.