Windows 上的 Perl 的集群()在哪里?

发布于 2024-07-12 03:18:24 字数 298 浏览 7 评论 0原文

我有一个 Perl 脚本,想在 Windows 上运行,使用 Strawberry PerlActivePerl; 我不在乎哪个。 然而,该脚本使用了 flock() 调用,该调用似乎并未包含在这两个版本的 Perl 中。

任何人都可以帮助启动并运行它吗?

I have a Perl script that I'd like to run on Windows, using either Strawberry Perl or ActivePerl; I don't care which. This script however, uses flock() calls, which does not seem to be included in either of those versions of Perl.

Can anyone help get this up and running?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

断舍离 2024-07-19 03:18:24

是否安装了Fcntl模块? 试试这个:

perl.exe -MFcntl -e 1

如果它抱怨,你没有安装 Fcntl 模块。 如果它没有抱怨,那么您就可以访问 Fcntl::flock,因此将其放入您的脚本中:

use Fcntl qw(:DEFAULT :flock);

然后就可以了。

Is the Fcntl module installed? Try this:

perl.exe -MFcntl -e 1

If it complains, you don't have the Fcntl module installed. If it doesn't complain, then you have access to Fcntl::flock, so put this in your script:

use Fcntl qw(:DEFAULT :flock);

and off you go.

柠檬色的秋千 2024-07-19 03:18:24

尝试使用 perldoc -f flock 来检查是否支持和支持这些内容。 然后查看给定的示例以了解该函数的使用标准。 这里是从 perldoc 复制的:

C:>perldoc -f集群

 use Fcntl ':flock'; # import LOCK_* constant

 sub lock {
     flock(MBOX,LOCK_EX);
     # and, in case someone appended
     # while we were waiting...
     seek(MBOX, 0, 2);
 }

 sub unlock {
     flock(MBOX,LOCK_UN);
 }

 open(MBOX, ">>/usr/spool/mail/$ENV{'USER'}") 

Try using perldoc -f flock to check the things are supported & then look into the given example to know the usage criteria of the function. Here copied from the perldoc:

C:>perldoc -f flock

 use Fcntl ':flock'; # import LOCK_* constant

 sub lock {
     flock(MBOX,LOCK_EX);
     # and, in case someone appended
     # while we were waiting...
     seek(MBOX, 0, 2);
 }

 sub unlock {
     flock(MBOX,LOCK_UN);
 }

 open(MBOX, ">>/usr/spool/mail/$ENV{'USER'}") 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文