我可以在 Windows 上使用 Proc::Reliable 吗?
我在 Win 7 机器上使用 ActivePerl,并且想使用 Proc::Reliable CPAN 模块。它正确下载并安装,但是当我尝试运行以下代码时,它在 run
处失败,
my $newProc = Proc::Reliable->new()
$newProc->run("perl.exe -e print 'hello world'");
我尝试了一些操作,例如测试 status
并尝试检索输出,但没有运气。据我所知,程序在运行
时默默地终止了。
作为参考,perl.exe 在我的 PATH 变量中,我从命令行调用它:perl.exe test.pl
I'm using ActivePerl on a Win 7 box and I want to use the Proc::Reliable CPAN module. It downloaded and installed properly but when I tried to run the following code, it failed at run
my $newProc = Proc::Reliable->new()
$newProc->run("perl.exe -e print 'hello world'");
I tried a couple things, such as testing the status
and trying to retrieve output, but with no luck. As best as I can tell, the program dies silently on run
.
For reference perl.exe is in my PATH
variable and I'm calling this from commandline as: perl.exe test.pl
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它可能并没有失败。
-e print 'hello world'
告诉 perl 执行代码print
,@ARGV 设置为hello world
(或者也许(" 'hello","world'")
,我忘记了 windows cmd 引用如何处理 '')。这会将 $_(即 undef)的内容打印到 STDOUT。始终使用警告。即使是单行线。也许尤其是在单行话上。比较:
和
It probably isn't failing.
-e print 'hello world'
tells perl to execute the codeprint
with @ARGV set tohello world
(or perhaps("'hello","world'")
, I forgot how windows cmd quoting handles ''). This prints the contents of $_ (that is, undef) to STDOUT.Always use warnings. Even on one-liners. Perhaps especially on one-liners. Compare:
and
Windows“shell”中的引用略有不同。要让您的小程序被解释为单个参数,请尝试类似的操作
Quoting is a little different in the Windows "shell". To get your mini-program to be interpreted as a single argument, try something like
我已经联系了
Proc::Reliable
模块的作者,他确认该模块无法在 Windows 上运行。I have contacted the author of the
Proc::Reliable
module and he confirmed that the module does not work on Windows.