Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
# MASON COMPILER ID: 2097!27211 package HTML::Mason::Commands; use strict; use vars qw($m $r); HTML::Mason::Component::FileBased->new( 'code' => sub { $m->debug_hook( $m->current_comp->path ) if ( %DB:: ); #line 1 /data/www/lena.franken.de/wwwroot/perl_hier/running_perl_win32_without_installing_it.html $m->print( ' Running Perl/Win32 without installing it

Running Perl/Win32 without installing it

Howto create a tree with a perl/win32 installation without installing it on the computer where the script shall run in the future will be shown here. You need this for running perl-scripts as logon-scripts or in an installing environment to run perl-scripts from a CD.

We are trying to install our autarkic into d:\\myperl. When ready we are able to move this directory to any path we like.

Step 1:

a. Copy your locally installed e:\\program files\\perl to d:\\myperl\\perl
b. Copy %windir%\\system32\\PerlCRT.dll to d:\\myperl\\perl\\bin
We try to leave this directory mostly untouched.

 

Step 2:

Create Directories:

d:\\myperl\\mymodules (your *.pm will be here)
d:\\myperl\\myscripts (your scripts will be here)

 

Step 3:

Create a test-perl-script d:\\myperl\\myscripts\\test.pl:

# free space on drives
#
BEGIN {
   # this is for running perl as logonscript
   push (@INC,"$ENV{\'LOGONSERVER\'}\\\\netlogon\\\\myperl\\\\mymodules");
   # this is for running perl from usual dos-box
   push (@INC,"../mymodules");
}
use testmodule;

use Win32::AdminMisc;
use Win32::NetAdmin;
# which drives are available, possible parameters are:
# DRIVE_REMOTE
# DRIVE_FIXED
# DRIVE_CDROM
# DRIVE_REMOVABLE
@drives=Win32::AdminMisc::GetDrives(DRIVE_FIXED);
&testmodule::printout ("These fixed drives are available:\\n");
foreach $drive (@drives) {
&testmodule::printout ("\\tDrive $drive\\n");
($size,$free)=Win32::AdminMisc::GetDriveSpace($drive);
&testmodule::printout ("\\t\\tsize is $size\\n");
&testmodule::printout ("\\t\\tfree is $free\\n");
}

 

Step 4:

Create a sample-pm d:\\myperl\\mymodules\\testmodule.pm we only use for ourself. It\'s not standard, only for our special purposes:

package testmodule;

sub printout {
print "printout says: @_";
}
1;



Step 5:

Create "perl-startup-script" d:\\myperl\\myscripts\\perl.bat . Perl must be started somehow. In our case this will be a batch-file. This script first checks wether perl is in PATH. If it\'s not the path-variable will be extended:

rem @echo off
rem perl.bat for running a perl-script
rem without installing perl
rem is perl in the PATH?
perl.exe -v >NUL: 2>NUL:
if errorlevel 0 goto path_ok
@echo adding perl-path to PATH
set path=..\\perl\\bin;%path%
:path_ok
@echo starting perl-script
path
perl.exe %1 %2 %3 %4

 

Step 6:

Test it:
d:> cd \\myperl\\myscripts
d:\\myperl\\myscripts\\> perl.bat test.pl
This must run.

 

Step 7:

Only if you need perl called in a login-script in your domain, have a script like this:

rem @echo off
rem File: %logonserver%\\netlogon\\perllogin.bat
rem call this script in usrmgr for every user with: perllogin.bat
rem test this script in a dos-shell with: \\\\sv-whoknows\\netlogon\\perllogin.bat
rem the usual stuff
net use z: \\\\myserver\\whoknows /persistent:no
net time %logonserver% /set /yes
rem
rem is perl in the PATH?
perl.exe -v >NUL: 2>NUL:
if errorlevel 0 goto path_ok
@echo adding perl-path to PATH
set path=%LOGONSERVER%\\netlogon\\myperl\\perl\\bin;%path%
:path_ok
@echo starting perl-script
rem path
perl.exe %logonserver%\\netlogon\\myperl\\myscripts\\test.pl

rem pause


Don\'t forget to set this in your Perlscript if you need your own modules:

push (@INC,"$ENV{\'LOGONSERVER\'}\\\\netlogon\\\\myperl\\\\mymodules");


back to my main perl-page

Last revised at December 29th, 2001 by Richard Lippmann

' ); return undef; }, 'compiler_id' => '2097!27211', 'load_time' => 1063610356, 'object_size' => 5719, ) ;
Impressum