Macos Mac OS上的Perl Net::SMTP::SSL错误:“;malloc:**对象0x7fff8929d50d的错误:未分配要释放的指针";

Macos Mac OS上的Perl Net::SMTP::SSL错误:“;malloc:**对象0x7fff8929d50d的错误:未分配要释放的指针";,macos,perl,ssl,smtp,Macos,Perl,Ssl,Smtp,我正在使用Perl5.12.4(随附的版本)运行MacOSX10.8.2 我通过CPAN安装了Net::SMTP::SSL('sudo CPAN',然后是'install Net::SMTP::SSL') 每当我尝试使用perl模块时,都会出现如下错误: perl(41125) malloc: *** error for object 0x7fff8929d50d: pointer being freed was not allocated *** set a breakpoint in mal

我正在使用Perl5.12.4(随附的版本)运行MacOSX10.8.2

我通过CPAN安装了Net::SMTP::SSL('sudo CPAN',然后是'install Net::SMTP::SSL')

每当我尝试使用perl模块时,都会出现如下错误:

perl(41125) malloc: *** error for object 0x7fff8929d50d: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
我试着尽可能地简化它,以缩小误差。在下面的代码中,当它试图运行
$smtp->auth
行(就在“即将崩溃”行之后)时,它将崩溃

#/usr/bin/perl
使用Net::SMTP::SSL;
$mailhost='foo.bar.com';
$sender=baz@foo.bar.com';
$sender_acct='baz';
$sender_name='Foo Bar';
$sender_password='password';
$subject='自动通知';
$userEmail='1user@foo.bar.com';
$thisMessage=“来自Foo-Bar的Hello\n”;
我们的$smtp=新网络::smtp::SSL(
$mailhost,
端口=>465,
#调试=>1,
#你好=>'foo.bar.com',
#超时=>10
)或“无法设置SMTP$!\n$SMTP->message”;
打印“即将崩溃\n”;
#--向SMTP服务器授权--
$smtp->auth($sender\u acct,$sender\u password);
#--输入发件人邮件地址--
$smtp->mail($sender);
#--输入收件人邮件地址--
@success=$smtp->recipient($userEmail,{SkipBad=>1});
$smtp->data();
#--此部分创建您看到的SMTP标头--
$smtp->datasend(“收件人:\n”);
$smtp->datasend(“发件人:$sender\u name\n”);
$smtp->datasend(“主题:$Subject”);
#--换行以将标题与消息正文分开--
$smtp->datasend(“\n”);
$smtp->datasend($thisMessage);
$smtp->datasend(“\n”);
$smtp->dataend();
$smtp->quit();
我很自信这不是我的脚本中的错误,因为当我在另一个平台上运行它时,它工作正常(我很确定它是Solaris,但我不能发誓,它安装了perl 5.8.8)

那么,我做错了什么?如何让
Net::SMTP::SSL
在Mac上工作


非常感谢

当您安装它时,测试通过了吗?是的,当我使用cpan安装Net::SMTP::SSL时,测试通过了。我只是在没有Net::SMTP::SSL的Mac上重现了这个问题,以便在安装时捕获输出。有关显示的内容,请参见。谢谢@ikegami!哇,这是整个测试套件:
usetest::moretests=>1;使用_ok'Net::SMTP::SSL'valgrind perl script.pl
可能为您指明了正确的方向。因此,基本上您的意思是,这是Net::SMTP::SSL perl模块中的一个bug?我尝试运行
$valgrind perl netsmtpssl.pl
,(
netsmtpssl.pl
是我原始消息中的脚本),但我的机器上没有
valgrind
(安装了当前Xcode版本的Mac OS X 10.8.2)。
#!/usr/bin/perl

use Net::SMTP::SSL;

$mailhost           = 'foo.bar.com';
$sender             = 'baz@foo.bar.com';
$sender_acct        = 'baz';
$sender_name        = 'Foo Bar';
$sender_password    = 'password';
$subject            = 'Auto notice';
$userEmail          = 'user@foo.bar.com';
$thisMessage        = "Hello from Foo Bar\n";

our $smtp = new Net::SMTP::SSL(
                   $mailhost,
                   Port    =>       465,
                   #Debug   =>        1,
                   #Hello   =>       'foo.bar.com',
                   #Timeout =>      10
                   ) or die "Could not set up SMTP $!\n$smtp->message";

print "About to crash\n";

# -- Authorize ourselves with the SMTP server --
$smtp->auth($sender_acct, $sender_password);

#  -- Enter sender mail address. --
$smtp->mail($sender);

#  -- Enter recipient mails address. --
@success = $smtp->recipient($userEmail,  { SkipBad => 1 });

$smtp->data();

# -- This part creates the SMTP headers you see. --
$smtp->datasend("To: <$userEmail> \n");
$smtp->datasend("From: $sender_name <$sender> \n");
$smtp->datasend("Subject: $subject");

# -- line break to separate headers from message body. --
$smtp->datasend("\n");

$smtp->datasend($thisMessage);

$smtp->datasend("\n");
$smtp->dataend();
$smtp->quit();