简体   繁体   English

如何在 Windows 上调用 Perl 脚本?

[英]How do I invoke a Perl script on Windows?

I tried compile apache 2.2, my Visual Studio 2008 returned error on RC.我尝试编译 apache 2.2,我的 Visual Studio 2008 在 RC 上返回错误。 After some googling, I found this explanation:经过一番谷歌搜索,我发现了这个解释:

What appears to have happened is that you've opened it up unsuccessfully in Visual Studio;似乎发生的事情是您在 Visual Studio 中未成功打开它; before you convert to an.sln file +.vcproj files, it's important to invoke the perl script在转换为 .sln 文件 +.vcproj 文件之前,调用 perl 脚本很重要

perl srclib\apr\build\cvtdsp.pl -2005 perl srclib\apr\build\cvtdsp.pl -2005

which will do evil things to the.dsp file syntax, breaking them forever but allowing us to work around a visual studio bug.这将对 .dsp 文件语法做坏事,永远破坏它们,但允许我们解决一个 Visual Studio 错误。 Then, load the Apache.dsw into a modern visual studio;然后,将 Apache.dsw 加载到现代视觉工作室中; it should 'just work'.它应该“正常工作”。

Can anyone explain to me how to invoke Perl script on Windows?谁能向我解释如何在 Windows 上调用 Perl 脚本?

Thank you谢谢

The two distributions of Perl for Windows that you could get are您可以获得的 Windows 的 Perl 的两个分布是

  • Strawberry Perl (A new distribution that integrates a C compiler to have the CPAN archive fully working on Windows) Strawberry Perl (集成了 C 编译器以使 CPAN 存档在 Windows 上完全运行的新发行版)
  • ActivePerl (The most common distribution but the CPAN doesn't work) ActivePerl (最常见的发行版,但 CPAN 不起作用)

Just install one of them as this script doesn't seem to use any thing fancy.只需安装其中一个,因为此脚本似乎没有使用任何花哨的东西。

I tend to use in my perl scripts always a short cmd file with the same name as the script to set some initial variables and call the actual script: The benefits?: Portability to Unix and Linux is easier when you wrap all of the logic in the Perl script and the sh or cmd files are just setting some basic kick off vars : I tend to use in my perl scripts always a short cmd file with the same name as the script to set some initial variables and call the actual script: The benefits?: Portability to Unix and Linux is easier when you wrap all of the logic in Perl 脚本和 sh 或 cmd 文件只是设置一些基本的启动变量:

Something like:就像是:

    set _BaseDir=E:\Perl\sfw
    set _ProjectName=logger
    set _ProjectVersion=0.6.0
    set _ProjectVersionDir=%_BaseDir%\%_ProjectName%\%_ProjectName%.%_ProjectVersion%

    set _PerlScript=%_ProjectVersionDir%\%_ProjectName%.pl
    set _CmdScript=%_ProjectVersionDir%\%_ProjectName%.cmd


    :: Action !!!
    perl %_PerlScript% 

    :: ping localhost -n 5
    pause

Also since it is Windows make sure the Perl interpretor is in your system path.此外,由于它是 Windows 确保 Perl 解释器在您的系统路径中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM