Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
VisualSVN服务器无法在提交后挂钩中识别Perl_Perl_Svn_Visualsvn Server_Post Commit Hook - Fatal编程技术网

VisualSVN服务器无法在提交后挂钩中识别Perl

VisualSVN服务器无法在提交后挂钩中识别Perl,perl,svn,visualsvn-server,post-commit-hook,Perl,Svn,Visualsvn Server,Post Commit Hook,我已经在本地机器Windows7 Professional上安装并设置了VisualSVN服务器v3.2.2(64位),并且我用Perl编写了post commit hook,它基本上应该在每次提交某个内容时向某个服务器发送一个HTTP post请求。 我已经通过cmd测试了我的Perl脚本,并且得到了有效的响应,但是当我使用TortoiseSVN客户端提交某些内容时,我会得到错误 Error post-commit hook failed (exit code 1) with output:

我已经在本地机器Windows7 Professional上安装并设置了VisualSVN服务器v3.2.2(64位),并且我用Perl编写了post commit hook,它基本上应该在每次提交某个内容时向某个服务器发送一个HTTP post请求。 我已经通过cmd测试了我的Perl脚本,并且得到了有效的响应,但是当我使用TortoiseSVN客户端提交某些内容时,我会得到错误

Error post-commit hook failed (exit code 1) with output: 
'perl' is not recognized as an internal or external command, 
operable program or batch file.
以下是我的perl脚本:

$svnlook = '"C:\Program Files\VisualSVN Server\bin\svnlook.exe"';

$repos = $ARGV[0];
$txn = $ARGV[1];

print STDOUT "message sent " . $repos . " " . $txn;

use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $server_endpoint = "http://jsonplaceholder.typicode.com/posts";

# set custom HTTP request header fields
my $req = HTTP::Request->new(POST => $server_endpoint);
$req->header('content-type' => 'application/json');

# add POST data to HTTP request body
my $post_data = '{ "repos":"' . $repos . '", "txn":"' . $txn  . '"}';
$req->content($post_data);

my $resp = $ua->request($req);
if ($resp->is_success) {
    my $message = $resp->decoded_content;
    print "Received reply: $message\n";
}
else {
    print "HTTP POST error code: ", $resp->code, "\n";
    print "HTTP POST error message: ", $resp->message, "\n";
}


exit(0);
和我的提交后批处理文件:

perl myhook.pl %1 %2
我尝试重新启动svn服务器和我的机器,但没有成功。 另外,当我在cmd中键入path时,我确实在路径C:\Perl64\bin中看到了perl

也许我对这个钩子的方法不正确或者其他什么。。。有人能帮上忙吗

谢谢

您的路径与运行VisualSVN服务器的用户帐户的路径不同

始终指定钩子脚本中所有项目的完整绝对路径,而不管您使用的是什么SVN服务器和操作系统

C:\Perl64\bin\perl myhook.pl %1 %2
您的路径与运行VisualSVN服务器的用户帐户的路径不同

始终指定钩子脚本中所有项目的完整绝对路径,而不管您使用的是什么SVN服务器和操作系统

C:\Perl64\bin\perl myhook.pl %1 %2

感谢您的快速响应,但现在我遇到了另一个奇怪的错误:错误:post-commit-hook失败退出代码2,输出:无法打开perl脚本myhook.pl:当myhook.pl与post-commit.cmd位于同一文件夹中时,没有这样的文件或目录正如我所说的,您需要指定所有项目的完整路径。我不知道myhook.pl的路径,所以我无法将其放在我的帖子中。感谢您的快速响应,但现在我遇到了另一个奇怪的错误:错误:post-commit-hook失败,退出代码2,输出:无法打开perl脚本myhook.pl:当myhook.pl与post-commit.cmd位于同一文件夹中时,没有这样的文件或目录,如我所说,您需要指定所有项目的完整路径。我不知道myhook.pl的路径,所以无法将其放在我的帖子中。