From: Mike Taylor Date: Wed, 10 May 2006 15:55:19 +0000 (+0000) Subject: Usage message for zero-argument invocation. X-Git-Tag: CPAN-v1.02~54^2~1227 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=965784cc9f302244a9c8ff322b1ddbe1f76f0e0c Usage message for zero-argument invocation. Add exception-handling callback (commented out). --- diff --git a/test-pod.pl b/test-pod.pl index 37d7fab..e37a98d 100644 --- a/test-pod.pl +++ b/test-pod.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# $Id: test-pod.pl,v 1.6 2006-05-10 13:38:31 mike Exp $ +# $Id: test-pod.pl,v 1.7 2006-05-10 15:55:19 mike Exp $ # # Run like this: # YAZ_LOG=pod perl -I lib test-pod.pl "bagel.indexdata.com/gils" "bagel.indexdata.com/marc" @@ -9,12 +9,18 @@ use strict; use warnings; use ZOOM::Pod; -ZOOM::Log::mask_str("appl"); +if (@ARGV == 0) { + printf STDERR "Usage: $0 [ ...]\n"; + exit 1; +} + +ZOOM::Log::mask_str("appl"); my $pod = new ZOOM::Pod(@ARGV); $pod->option(elementSetName => "b"); $pod->callback(ZOOM::Event::RECV_SEARCH, \&completed_search); $pod->callback(ZOOM::Event::RECV_RECORD, \&got_record); +#$pod->callback(exception => \&exception_thrown); $pod->search_pqf("the"); my $err = $pod->wait(); die "$pod->wait() failed with error $err" if $err; @@ -51,6 +57,12 @@ sub got_record { return 0; } +sub exception_thrown { + my($conn, $state, $rs, $exception) = @_; + print "Uh-oh! $exception\n"; + return 0; +} + sub request_records { my($conn, $rs, $state, $count) = @_;