Net-Z3950-AsyncZ
view release on metacpan or search on metacpan
# returns true if the error was a cycle 1 fatal error
sub isZ_nonRetryable { $_[0] == 1; }
{
my @results=();
my @errors=();
my @recSize = ();
my $busy = 0;
my $utf8_init = 0;
sub is_utf8_init {
$utf8_init;
}
sub set_uft8_init {
$utf8_init = 1;
}
_setupUTF8() if !$utf8_init;
return if !$utf8_init;
my $cs = MARC::Charset->new();
for(my $i = 0; $i < scalar(@{$results[$index]}); $i++) {
$results[$index]->[$i] = $cs->to_utf8($results[$index]->[$i]);
}
}
sub _saveResults {
$busy = 1;
my ($arr, $index) = @_;
$results[$index] = $arr;
$busy = 0;
}
sub _saveErrors {
@errors = @_;
}
sub _isBusy { return $busy; }
# returns reference to results array
sub getResult {
my ($self,$index) = @_;
_utf8($index) if $self->{options}[$index]-> _getFieldValue('utf8');
return $results[$index];
}
sub getZ_RecSize { $recSize[$_[0]]; }
sub getErrors {
my ($self,$index) = @_;
return [$errors[$index]->[0], $errors[$index]->[1]] if $errors[$index];
return undef;
}
sub getMaxErrors { return scalar @errors; }
sub _callback {
$busy = 1;
my ($self, $index) = @_;
_utf8($index) if $self->{options}[$index]-> _getFieldValue('utf8');
my $cb = $self->{options}[$index]-> _getFieldValue('cb');
$cb = $self->{cb} if !$cb;
my $last_el = scalar(@{$results[$index]})-1;
my $size = $results[$index]->[$last_el];
$size =~ /\*==(\d+)==\*/;
$recSize[$index] = $1 ? $1 : 0;
$results[$index]->[$last_el] =~s/\*==(\d+)==\*//;
&$cb($index, $results[$index]) if $cb;
$busy = 0;
}
}
#-------------------------------------------------------------------#
# private paramaters:
# start: start time for timers
# zl: array of forked processes
AsyncZ/ErrMsg.pm view on Meta::CPAN
use vars "%errors";
# structure: Error_Number => [ Error_Number, retry, type ]
# retry 1 = true, 0 = false
# type 0 = system, 1 = network, 2 = try again, 3 = unspecified, 4 = success
# 5 = Z3950 error
%errors =
(
# syseror
(EBUSY+0)=> [EBUSY, 1, 0], # Device or resource busy
(ENODEV+0)=> [ENODEV, 0, 0], # No such device
(EUSERS+0)=> [EUSERS,1, 0], # Too many users
(EACCES+0)=> [EACCES, 0, 0], # Permission denied
(ECONNABORTED+0)=> [ECONNABORTED, 1, 0], # Software caused connection abort
(EINTR +0)=> [EINTR, 1, 0], # Interrupted system call
(EINVAL +0)=> [EINVAL, 1, 0], # Invalid argument
# %neterr
(ETIMEDOUT+0)=> [ETIMEDOUT, 1, 1], # Connection timed out
(ECONNRESET+0)=> [ECONNRESET, 1, 1], # Connection reset by peer
doc/AsyncZ.html view on Meta::CPAN
$err->method();</pre>
<dl>
<dt><strong><a name="item_issystem">isSystem</a></strong><br />
</dt>
<dd>
These are ususally errors reported back from Perl or C library
routines. For instance:
</dd>
<dd>
<pre>
Device or resource busy
Too many users
Permission denied
Software caused connection abort
Invalid argument</pre>
</dd>
<dd>
<p>An ``Invalid argument'' will often come back when a query
fails and a library routine attempts to do
something which can't be done without the return value</p>
</dd>
doc/AsyncZ.pod view on Meta::CPAN
$err->method();
=over 4
=item isSystem
These are ususally errors reported back from Perl or C library
routines. For instance:
Device or resource busy
Too many users
Permission denied
Software caused connection abort
Invalid argument
An "Invalid argument" will often come back when a query
fails and a library routine attempts to do
something which can't be done without the return value
=item isNetwork
( run in 0.294 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )