ActiveState Perl

Introduction

The ActiveState Perl distribution is a port of Perl to the Windows environment, sometimes referred to as Win32. As part of my work, I need to build, develop and install packages in this environment. I normally build packages using RPM and manage package files with it. Since utilitizing RPM would require building and installing RPM, a task that is too daunting for the project timeline, I decided to try to utilize perl itself to manage the perl module installs.

Xern::AS::Tools

One of the first issues that I came across in utilizing perl to manage installs, is that the uninstall target of a modules generated Makefile just prints out a warning about not uninstalling modules. So I needed a tool to uninstall modules. This is important during development as the need to rename or remove files and directories requires that the installed versions no leave any of these old files behind.

I've created a module called Xern::AS::Tools to provide tools for managing modules.

When installing a perl module, a file named .packlist is created with a list of all the installed files and directories in it. The documentation for ExtUtils::Packlist includes code for removing modules interactively. I've adapted this code to allow an argument to be passed for specifying the module to remove.

I've found that in working with scripts on Windows, calling a script that is named without an extension causes some problems. This is due to the fact that there is no interpretation of the pound-bang line that is normally used in unix and linux environments to tell the system which interpreter to use. Perl provides the pl2bat utility to create a batch file, but if the original script has no extension, it is read instead of the .bat file and will be interpreted as a batch file. This problem can be solved by renaming the original perl script with the .pl extension. The normal extension order places .pl files behind .bat files, so the batch file is read and run producing the expected results.

I've created a script called renamepl.pl that will rename scripts in modules and update the MANIFEST and Makefile.PL files adding the pl extension.

Overriding The libscan Subroutine

When creating the Makefile, a subroutine called libscan is called to search for files that should be excluded from the lib directory tree. By default directories named CVS, RCS and SCCS are excluded. However, with the advent of subversion, there is a new directory called .svn. In order to ignore the subversion directory, the code shown in Figure 1, “libscan Code” needs to be added.

Figure 1. libscan Code

sub MY::libscan {
    my($self,$path) = @_;
    return '' if $path =~ m:\.svn:;
    $path;
}