How to Memorize a File in Perl
In Unix-based operating systems such as Linux, it is common for multiple Perl packages to be installed in the same run-time directory tree. One problem with this arrangement is that the administrator may have difficulty identifying which files belong to which package whenever an upgrade or uninstall is needed. One method would be to simply memorize the names of all Perl files or to write them down separately, but these solutions are cumbersome and prone to error. The "stow" command represents a suitable solution, however.
Instructions
-
-
1
Create a child directory called "stow" below the one in which you would normally install the Perl package. For example, the most common location is /usr/local/stow.
-
2
Create additional folders inside the stow directory for each of the packages you want to install, such as /usr/local/stow/package1 and /usr/local/stow/package2. Stow works by installing each program in its own directory and creating symbolic links in the target directory --- in this example, /usr/local --- to give, for all functional purposes, the appearance of a shared tree. Upgrades, uninstallations and other administrative tasks can thus be performed in the program's own tree, and changes are reflected in the target tree.
-
-
3
Install stow by downloading the source file from gnu.org, navigating to its location and entering the following code:
tar -zxvf stow-1.3.3.tar.gz
cd stow-1.3.3
./configure
make
make install prefix=/usr/local/stow
-
4
Unpack and install the tar file of the first Perl package you want to install. To do this, navigate to its location and use the following commands, replacing "package1" with the name of the file:
tar -zxvf package1.tar.gz
cd package1
-
5
Install the package in the stow directory with the following commands:
./configure --prefix=/usr/local/stow/package1
make
make install
-
6
Stow the package and create the symlinks with the following commands:
cd /usr/local/stow/
stow -t /usr/local package1
-
1
Tips & Warnings
When changes have been made to the actual files, including automated upgrades, the package must be restowed for the changes to take effect. To accomplish this, use the following command: stow -R packagename
To uninstall a package, use this command: stow -D packagename
To complete this process, you must be logged in as root. If you do not want to be logged in as root for security purposes, prefix each command with "sudo" and type your root password whenever prompted. This uses root access to complete the command, but does not log you permanently into your root account.
References
- Photo Credit Hemera Technologies/PhotoObjects.net/Getty Images