home *** CD-ROM | disk | FTP | other *** search
- @rem = '-*- Perl -*-';
- @rem = '
- @echo off
- .\perl %0.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9
- goto endofperl
- ';
-
- #
- # this perl script is used to install NT registry keys and environment
- # variables for perl. It takes one optional argument, the directory where
- # perl resides (defaults to the current directory).
- #
-
- if (@ARGV == 0) {
- chop ($perldir = `cd`);
- $perldir =~ tr/A-Z/a-z/;
- }
- else {
- ($perldir = shift) =~ tr/A-Z/a-z/;
- }
-
- die "Can't find $perldir\\perl.exe!\n"
- if ! -e "$perldir\\perl.exe";
-
- print "Installing NT Perl in $perldir\n";
- unshift (@INC, "$perldir\\lib");
- require "registry.pl";
-
- #
- # First put the keys that perl will use into the registry
- #
- &RegCreateKeyEx ($HKEY_LOCAL_MACHINE,
- "SOFTWARE\\Intergraph\\Perl\\4.036\\Parameters",
- 0, 0, $REG_OPTIONS_NON_VOLATILE,
- $KEY_ALL_ACCESS, 0, $key, $disp) ||
- die "Can't open parameter key: $!\n";
-
- &RegSetValueEx($key, "PRIVLIB", 0, $REG_SZ, "$perldir\\lib") ||
- die "Can't set PRIVLIB value in registry: $!\n";
- print "Added PRIVLIB key (for locating library files) as $perldir\\lib\n";
- &RegSetValueEx($key, "BIN", 0, $REG_SZ, "$perldir") ||
- die "Can't set BIN value in registry: $!\n";
- print "Added BIN key (for locating executable files) as $perldir\n";
-
- &RegCloseKey($key);
-
- #
- # Now add the perl directory to the default path
- #
- &RegOpenKeyEx ($HKEY_LOCAL_MACHINE,
- "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
- 0, $KEY_ALL_ACCESS, $key) ||
- die "Can't open Session Manager Environment for update: $!\n";
- &RegQueryValueEx ($key, "Path", 0, $type, $pathstring) ||
- die "Can't get Session Manager Path value: $!\n";
- #
- # I had more fun with this than I should be allowed to have!
- # The idea here is to check the path string for any old perl paths, omitting
- # them if found. Then re-assemble the path string, prepending the new perl
- # path to the path string. All of this in one line...incredible!
- #
-
- $newstring =
- "$perldir;" . join (';', grep(!/perl/i, split(/;/, $pathstring))) . ";";
-
- &RegSetValueEx($key, "Path", 0, $type, $newstring) ||
- die "Can't set Session Manager Path: $!\n";
- &RegCloseKey($key);
- print "Updated default path to include $perldir\n";
- print "Perl installation finished!\n";
-
- __END__
- :endofperl
-