Net::XMPP windows 系统上的 Perl module:ssl 路径错误

Net::XMPP Perl module:ssl path error on windows system

我试图在 windows 10 机器 运行 Strawberry Perl 上使用 perl 模块 Net::XMPP 连接到 XMPP 服务器,但出现以下错误:

Invalid or unreadable path specified for ssl_ca_path. at C:/strawberry/perl/site/lib/XML/Stream.pm line 640

我使用的代码如下:

#!/bin/perl -w

use strict;
use warnings;

use Net::XMPP;

my $con = new Net::XMPP::Client(); 

my $status = $con->Connect(  
    hostname => 'hostnamepart',  
    connectiontype => 'tcpip',  
    tls => 1);  
die('ERROR: XMPP connection failed') if ! defined($status);

我已经测试了我是否可以在我的 Windows 机器上使用 Pidgin 客户端应用程序连接到服务器并且它工作正常。

Is there any way to fix my Perl problem?

从我查看源代码可以看出,在使用 ssl => 1tls => 1 时必须提供 ssl_ca_path。 (可以是文件也可以是目录。)

例如,相信您可以使用类似下面的东西来信任 Mozilla 信任的 CA。

use Mozilla::CA       qw( );
use Net::XMPP::Client qw( );

my $con = Net::XMPP::Client->new();

$con->Connect(  
    ...
    tls         => 1,
    ssl_ca_path => Mozilla::CA::SSL_ca_file(),
);