Skip Menu |

This queue is for tickets about the Net-TrackBack CPAN distribution.

Report information
The Basics
Id: 6104
Status: resolved
Priority: 0/
Queue: Net-TrackBack

People
Owner: Nobody in particular
Requestors: yk [...] cyberion.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.991
Fixed in: (no value)



Subject: Ping->parse : Interface inconsistency ?
The parse method of the Ping object sometimes returns Message objects (to report errors) and sometimes returns a Ping object. I would have prefered if it always returned the same class of object, because checking the type is not so aesthetic : my $ping = Net::Trackback::Server->receive_ping($apr); if (ref $ping eq 'Net::Trackback::Message') { print STDERR "oops !\n" if $ping->is_success; $apr->send_http_header('text/xml'); $apr->print($ping->to_xml); } Problem : It's an interface change, interface changes are risky. Just suggestions according to my personnal feelings : my $server = Net::Trackback::Server->new; if (!$server->receive_ping($apr)) { $apr->send_http_header('text/xml'); $apr->print($server->error->to_xml); } or #... my $msg = $server->receive_ping($apr); if ($msg->is_error) { # ... } $server->ping->blog_name; or for fewer change my ($msg, $ping) = Net::Trackback::Server->receive_ping($apr); if ($msg->is_error) { $apr->send_http_header('text/xml'); $apr->print($msg->to_xml); } $ping->blog_name Regards, Yann Kerherve
From: tima
I agree this is inconsistent and should be better. I am very cautious about breaking code and changing interfaces, but one reason for giving it the 0.99x label was that I felt the interface may need more refinement and such a change would be needed. I will be incorporating this change into the next release that I hope to get to soon. Thanks for your input. <tim/>