Skip Menu |

This queue is for tickets about the AnyEvent-SMTP CPAN distribution.

Report information
The Basics
Id: 65579
Status: resolved
Priority: 0/
Queue: AnyEvent-SMTP

People
Owner: MONS [...] cpan.org
Requestors: dynot [...] JUNKMAIL.ATH.CX
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.06
Fixed in: (no value)



Subject: Can't call method "reply" on unblessed reference
On two debian systems both stable and unstable, with perl 5.10.0 and 5.10.1, the attached script dies with an error message: Can't call method "reply" on unblessed reference at /usr/local/share/ perl/5.10.0/AnyEvent/SMTP/Server.pm line 188. from a simple message: `cat telnet.txt | nc localhost 25251` telnet.txt contains: HELO client.example.com MAIL from: <sender@example.com> RCPT to: <recipient@example.com> DATA From: sender@example.com To: recipient@example.com Subject: Test message This is a test message. . QUIT if the email processing function doesnt call an undefined function, the program will not crash. however, i have another complex email processing script, without calling any undefined functions, and it crashes on every email with the same unblessed reference error.
Subject: AnyEvent-SMTP-Server-debug.pl
#!/usr/bin/perl -w use strict; use AnyEvent::SMTP::Server; my $server_port = 25251; my $server = AnyEvent::SMTP::Server->new( port => $server_port ); $server->reg_cb( client => sub { my ($s,$con) = @_; warn "Client from $con->{host}:$con->{port} connected\n"; }, disconnect => sub { my ($s,$con) = @_; warn "Client from $con->{host}:$con->{port} gone\n"; }, mail => sub { my ($s,$mail) = @_; warn "Received mail from $mail->{from} to @{$mail->{to}}\n"; &process_message ($mail->{data} ); }, ); $server->start; AnyEvent->condvar->recv; sub process_message { my $email = shift; my $mailbox = shift ; print &jadsuigflsgs($email); }
From: dynot [...] JUNKMAIL.ATH.CX
heres another one: when mail arrives we only do: &process_message($mail-> {data}); which does: sub process_message { die shift; } the result is the same: Can't call method "reply" on unblessed reference at /usr/local/share/ perl/5.10.1/AnyEvent/SMTP/Server.pm line 188. if i use print or warn instead of die, there is no crash.
Subject: AnyEvent-SMTP-Server-debug.pl
#!/usr/bin/perl -w use strict; use AnyEvent::SMTP::Server; my $server_port = 25251; my $server = AnyEvent::SMTP::Server->new( port => $server_port ); $server->reg_cb( client => sub { my ($s,$con) = @_; warn "Client from $con->{host}:$con->{port} connected\n"; }, disconnect => sub { my ($s,$con) = @_; warn "Client from $con->{host}:$con->{port} gone\n"; }, mail => sub { my ($s,$mail) = @_; warn "Received mail from $mail->{from} to @{$mail->{to}}\n"; &process_message($mail->{data}); } ); $server->start; AnyEvent->condvar->recv; sub process_message { die shift; }
From: dynot [...] JUNKMAIL.ATH.CX
after installing Thread::Queue, this error no longer happens!
Error occurs when program die's in mail event Fix will be included in 0.07