Getting Started with Scripting
New to Perl scripting? Check out this Web-exclusive sidebar for information about the helpful Perl Package Manager (PPM).
August 28, 2001
If you've never used scripts to automate system processes, or if you've never done any programming before, now is the perfect time to start. This article's Perl scripts are short, simple, and easy to customize. The short code snippets show you the basic core code necessary for each script. You can download the full scripts—which contain additional comments, logging, and counter features—from the Windows 2000 Magazine Web site. Perl is available free for download from ActiveState's Web site (http://www.activestate.com). I tested these scripts on Windows 2000 with ActiveState's ActivePerl (build 623) and on Windows NT 4.0 Service Pack 6 (SP6) and SP5 with ActivePerl (build 522). The scripts also require the File::Recurse module, which is a component of Aaron Sherman's File::Tools set, available from http://www.cpan.org.
The Perl Package Manager (PPM) is a component of the Perl installation. PPM, which is the command-line equivalent of Windows Update, lets you easily add to and update Perl modules to add functionality to the basic Perl installation. The installation also places HTML reference documents on your system. The ppm.html document explains PPM commands and their usage.
After you configure the PPM proxy server settings, install the File::Tools module. Go to a command prompt, and type
ppm install file-tools
After you install File::Tools, you can successfully run this article's scripts.
To start the interactive PPM shell, type
ppm
Some versions of Perl and PPM updates use a slash (/) for command prefixes; other versions use a dash (). To determine the prefix syntax appropriate for your version, type
ppm help
To determine whether you have the most recent version of installed modules, type
ppm verify
To update installed modules to their newest versions, type
ppm verify /upgrade
For complete syntax details, refer to the ppm.html document.
About the Author
You May Also Like