我怎么能得到振管工作在Perl在Windows?
题
我想口Perl脚本从Unix到Windows但我有一个几乎不可能的时间得到它的工作由于不支持振管在开放的功能。这里的代码:
sub p4_get_file_content {
my $filespec = shift;
return 'Content placeholder!' if ($options{'dry-run'});
debug("p4_get_file_content: $filespec\n");
local *P4_OUTPUT;
local $/ = undef;
my $pid = open(P4_OUTPUT, "-|");
die "Fork failed: $!" unless defined $pid;
if ($pid == 0) { # child
my $p4 = p4_init();
my $result = undef;
$result = $p4->Run('print', $filespec);
die $p4->Errors() if $p4->ErrorCount();
if (ref $result eq 'ARRAY') {
for (my $i = 1; $i < @$result; $i++) {
print $result->[$i];
}
}
$p4->Disconnect();
exit 0;
}
my $content = <P4_OUTPUT>;
close(P4_OUTPUT) or die "Close failed: ($?) $!";
return $content;
}
错误是:
'-' is not recognized as an internal or external command,
operable program or batch file.
任何人都不会知道如何使这项工作?谢谢!
Mike
解决方案
我知道这不是一个直接回答你的问题,但是它看起来像你的脚本的东西上的必然在Perl?如果是这样,你可能会找到一个现有的图书馆不会你想要什么已经和保存自己很多头痛,或者至少给你的一些样品代码的工作。
例如:
编辑:现在我知道你在做什么我猜你想口p42svn到窗口,或相反使它与Windows最少。看看 这个线程 讨论的这个确切的问题。建议(未经测试)是尝试代码样本列在 http://perldoc.perl.org/perlfork.html 下"Forking管open()尚未实施"明确地创建的管道,而不是。
其他提示
它行不通的原样。你需要找到另一种方法来完成它在做什么。它看起来并不像有这么烧需要叉管,但很难说,因为我不知道什么是P4是和你的很多代码都流失到尖括号解释。
不隶属于 StackOverflow