If getPRByNumber() is called with a PR that does not
exist in the database, then it returns an empty object.
I think that the correct behaviour is to return undef,
to indicate the problem.
The cause is that the lack of a PR is not returned from
the daemon as an error, rather as '220 No PRs Match'.
The patch below treats this as an error condition.
--- Net-Gnats-0.06.orig/Gnats.pm 2003-11-08
03:41:47.000000000 +1100
+++ Net-Gnats-0.06/Gnats.pm 2005-09-07
14:47:08.984710000 +1000
@@ -529,7 +529,7 @@
}
($code, $response) = $self->_doGnatsCmd("QUER $num");
- if (not $self->_isCodeOK($code)) {
+ if ((not $self->_isCodeOK($code)) || $code == 220) {
$self->_markError($code, $response);
return undef;
}
Logged In: YES
user_id=323038
Thanks malcomp. I'll try to do a release this weekend
incorporating this patch.
Confirmed this as an issue.
Added regress test to t/live.t
Issue is _is_code_ok sees the 220 as OK but no PRs match.
Ultimately, Net::Gnats::PR->parse should error ... but it is solved in the meantime ... and the function will probably move to Net::Gnats::Response anyway.