开发者

Using a perl script on windows without installing ActivePerl?

开发者 https://www.devze.com 2023-03-02 17:45 出处:网络
I\'m using Perl as my scripting language of choice under Windows and normally I just install ActivePer开发者_JAVA百科l (mostly 5.8 for personal legacy reasons) and be done with it.

I'm using Perl as my scripting language of choice under Windows and normally I just install ActivePer开发者_JAVA百科l (mostly 5.8 for personal legacy reasons) and be done with it.

I now face the problem that I'd like to use some small scripts on a machine where I do not have any admin rights and therefore cannot install the ActiveState distribution with its installer.

What needs to be zipped together from an installed ActiveState Perl to do an xcopy-style installation of Perl on Windows? (And which environment variables will then have to be set in a command shell to make it work?)


Strawberry Perl has a portable edition. I'd use that in preference to trying to hack ActivePerl into working without being properly installed.


You can install ActivePerl without admin rights by using the *.zip file installer instead of the *.msi. Download from the ActivePerl 5.26.3 download directory and run the installer.bat file in the root of the extracted tree.


PAR::Packer allows you to pack perl along with your scripts and modules it depends on in a standalone executable. You might want to double-check ActiveState's license terms to make sure this type of distribution is allowed.


Strawberry Perl from David's answer might be the best solution as it officially supports xcopy installation.

However, I have now just tried copying the installation directory C:\Perl of ActiveState and when C:\Perl\bin is added to PATH it seems to execute my script(s) just fine.

Obviously, you have to run scripts via __> perl file.pl as no file association exists for Windows to know how to call just __> file.pl as it would when using the installed version, but you always have to do that with xcopy-installs.

I have also inspected the MSI installer from ActiveState (for 5.8) and it only contains files that are installed to TARGETDIR\Perl so I think just copying the Perl directory should also be safe for ActiveState.


From what I hear, ActivePerl can be tricky to handle this way.. however, I found this at perlmonks:

http://www.perlmonks.org/?node=Portable%20perl%3A%20usb%20thumbdrive

In short: Guy wants perl on windows without admin rights, so he makes a usb thumbdrive that does the job.


Here is the link where you can get portable perl edition. http://strawberryperl.com/releases.html

Here are some Explanatory Notes from the page where you can fine different installation files. e.g MSI, ZIP etc

MSI installer = preferred way, requires admin privileges to install

ZIP edition = admin privileges not required, however you need to run some post-install scripts manually after unzip

PortableZIP edition = suitable for "perl on USB stick" (you can move/rename the perl directory and it will still work)

MSM merge module = for advanced users who want to build their own MSI based on Strawberry Perl

DDrive edition = (not used since 5.12 series) special edition with fixed install path to d:\strawberry

0

精彩评论

暂无评论...
验证码 换一张
取 消