Subject: | "message" field of Message.pm |
When send_ping() receive error message (xml), the error code is shown but error message string isn't...
sub parse {
my($class,$xml) = @_;
# should use xml parser but...
my($code) = $xml =~ m!<error>(\d+)</error>!s;
my($message) = $xml =~ m!<message>(.+?)</message>!s;
defined $code ?
$class->new({code=>$code,message=>$message}) : <<--- I think it should msg=>$message , considering other codes in Message.pm
$class->error('Invalid message.');
}
Additionally, I found that:
sub to_xml {
my $self = shift;
my $code = $self->{__stash}->{code} || 0;
my $msg = encode_xml($self->{__stash}->{msg}) || ''; <<--- This doesn't work. It returns just null string.
my $msg = Net::Trackback->encode_xml($self->{__stash}->{msg}) || ''; <<--- This works. I don't know why.
my $xml = <<MESSAGE;
<?xml version="1.0" encoding="iso-8859-1"?>
<response>
<error>$code</error>
<message>$msg</message>
</response>
MESSAGE
$xml;
}