如何强制Perl脚本使用ActiveState的wperl?

时间:2022-07-29 21:15:01

I have a Perl script that requires two command line arguments that takes a while to run. I am using ActiveState Perl to run it. I can call it with

我有一个Perl脚本,需要两个命令行参数,需要一段时间才能运行。我正在使用ActiveState Perl来运行它。我可以打电话给它

wperl script.pl arg1 arg2
from a command prompt and it runs in the background fine. If I change the .pl association from perl.exe to wperl.exe and call it with
script.pl arg1 arg2
the arguments don’t get passed. Is there something similar to the #!/usr/bin/perl like I can use to force wperl to get used?

3 个解决方案

#1


What you can do is change the file association with regards to wperl.exe in the Tools > Folder Options > File Types in any Explorer window and update the .pl extension through Advanced > Open > Edit command line to

你可以做的是在任何资源管理器窗口的工具>文件夹选项>文件类型中更改关于wperl.exe的文件关联,并通过高级>打开>编辑命令行更新.pl扩展名

{Path to wperl}\wperl.exe "%1" %*

This ensures that all the command line arguments (%*) are passed to wperl.exe whenever you call your script using

这样可确保在使用脚本调用脚本时将所有命令行参数(%*)传递给wperl.exe

script.pl arg1 arg2

#2


The Perlmonks node wperl.exe vs perl.exe suggests associating the .wpl extension with wperl. Name all the scripts that you want to run under wperl with a .wpl extension and the other .pl named files use the normal perl.exe.

Perlmonks节点wperl.exe vs perl.exe建议将.wpl扩展名与wperl相关联。将要在wperl下运行的所有脚本命名为.wpl扩展名,其他.pl命名文件使用普通的perl.exe。

#3


unless ($^X =~ m/wperl\.exe$/i) {
    exec "wperl",$0,@ARGV;
    exit 0;
}

#1


What you can do is change the file association with regards to wperl.exe in the Tools > Folder Options > File Types in any Explorer window and update the .pl extension through Advanced > Open > Edit command line to

你可以做的是在任何资源管理器窗口的工具>文件夹选项>文件类型中更改关于wperl.exe的文件关联,并通过高级>打开>编辑命令行更新.pl扩展名

{Path to wperl}\wperl.exe "%1" %*

This ensures that all the command line arguments (%*) are passed to wperl.exe whenever you call your script using

这样可确保在使用脚本调用脚本时将所有命令行参数(%*)传递给wperl.exe

script.pl arg1 arg2

#2


The Perlmonks node wperl.exe vs perl.exe suggests associating the .wpl extension with wperl. Name all the scripts that you want to run under wperl with a .wpl extension and the other .pl named files use the normal perl.exe.

Perlmonks节点wperl.exe vs perl.exe建议将.wpl扩展名与wperl相关联。将要在wperl下运行的所有脚本命名为.wpl扩展名,其他.pl命名文件使用普通的perl.exe。

#3


unless ($^X =~ m/wperl\.exe$/i) {
    exec "wperl",$0,@ARGV;
    exit 0;
}