From beb0211a4003983bbacbe2b8c1a6f08144ccc39a Mon Sep 17 00:00:00 2001 From: mike Date: Wed, 9 May 2007 12:03:52 +0000 Subject: [PATCH] =?utf8?q?New=20->exception()=20method=C2=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Changes | 3 ++- lib/ZOOM.pm | 10 +++++++++- lib/ZOOM.pod | 11 ++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index 97f5a67..9161ddc 100644 --- a/Changes +++ b/Changes @@ -1,8 +1,9 @@ -$Id: Changes,v 1.60 2007-04-18 11:19:10 mike Exp $ +$Id: Changes,v 1.61 2007-05-09 12:03:52 mike Exp $ Revision history for Perl extension Net::Z3950::ZOOM. 1.19 (IN PROGRESS) + - Add $conn->exception() method. - Set version number for Net::Z3950 to 0.99 -- less than the 1.0 version number that will be used when it successfully emulates the old Net::Z3950 module, but superseding the last diff --git a/lib/ZOOM.pm b/lib/ZOOM.pm index 2b335b4..0a42e3e 100644 --- a/lib/ZOOM.pm +++ b/lib/ZOOM.pm @@ -1,4 +1,4 @@ -# $Id: ZOOM.pm,v 1.47 2007-02-26 14:52:21 mike Exp $ +# $Id: ZOOM.pm,v 1.48 2007-05-09 12:03:52 mike Exp $ use strict; use warnings; @@ -402,6 +402,14 @@ sub error_x { return wantarray() ? ($errcode, $errmsg, $addinfo, $diagset) : $errcode; } +sub exception { + my $this = shift(); + + my($errcode, $errmsg, $addinfo, $diagset) = $this->error_x(); + return undef if $errcode == 0; + return new ZOOM::Exception($errcode, $errmsg, $addinfo, $diagset); +} + sub errcode { my $this = shift(); return Net::Z3950::ZOOM::connection_errcode($this->_conn()); diff --git a/lib/ZOOM.pod b/lib/ZOOM.pod index 5d63838..acc0cce 100644 --- a/lib/ZOOM.pod +++ b/lib/ZOOM.pod @@ -1,4 +1,4 @@ -# $Id: ZOOM.pod,v 1.42 2007-02-26 14:40:01 mike Exp $ +# $Id: ZOOM.pod,v 1.43 2007-05-09 12:03:52 mike Exp $ use strict; use warnings; @@ -305,6 +305,15 @@ returns all four at once. See the C for the interpretation of these elements. +=head4 exception() + + die $conn->exception(); + +C returns the same information as C in the +form of a C object which may be thrown or rendered. +If no error occurred on the connection, then C returns an +undefined value. + =head4 check() $conn->check(); -- 1.7.10.4