我们可以使用MinGW编译Perl脚本吗? [英] Can we use MinGW to compile a Perl script?
问题描述
在Windows中编译或运行Perl脚本时遇到一些问题.我已经在Windows中安装了MinGW,以使用 GCC 包来编译C代码.现在,我可以使用MinGW编译Perl脚本/代码吗?
I have some problems to compile or run a Perl script in Windows. I have installed MinGW in my Windows to compile C code using the GCC package. Now, can I use MinGW to compile Perl script/code and how?
推荐答案
ActivePerl为.pl文件创建快捷方式(如果在安装过程中选中了该复选框).您可以通过在提示符下运行以下命令来查看关联:
ActivePerl creates shortcuts for .pl files (if you check the box during installation). You can see the association by running the following from a prompt:
>assoc .pl
.pl=Perl
>ftype Perl
Perl="C:\Progs\perl5121-ap1201\bin\perl.exe" "%1" %*
(使用返回的assoc
作为ftype
的参数.)
(Use wahtever assoc
returned as the argument for ftype
.)
您可以自己执行以下操作:
You can do it yourself with:
assoc .pl=Perl
ftype Perl=Perl="C:\Progs\perl5121-ap1201\bin\perl.exe" "%1" %*
(使用正确的机器路径.)
(Use the correct path for your machine.)
请记住,许多脚本需要命令行输入,并且从双击启动脚本后,一旦退出脚本,控制台就会关闭.因此,通常最好从提示符处运行脚本.
Keep in mind that many scripts require command line inputs, and that the console closes down as soon as the script exits when you launch it from double-clicking. As such, it's often better to run your script from the prompt.
如果您具有上述关联设置,则只需输入控制台名称即可从控制台运行Perl脚本
If you have the association setup as above, you can run a Perl script from the console simply by typing its name
>script.pl
Hello, World!
或者您可以明确地指定它需要Perl.
Or you can be explicit and specify that it requires Perl.
>perl script.pl
Hello, World!
假定Perl在PATH
中.如果没有,则可以指定Perl的整个路径.
That assumes that Perl is in the PATH
. If not, you can specify the whole path to Perl.
>C:\Progs\perl5121-ap1201\bin\perl script.pl
Hello, World!
这篇关于我们可以使用MinGW编译Perl脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!