X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=blobdiff_plain;f=lib%2FZOOM%2FPod.pm;h=3e2f9ceec2e3c3ba22346e94cad9b718ce7cf3ab;hp=27ae050b484d20cc2ced83647480cd3535bcf798;hb=daa885a1a02081d685ce88a85936a98e71a4bcce;hpb=cadde72b589f2b46e3cfc4457d3261834a2641fd diff --git a/lib/ZOOM/Pod.pm b/lib/ZOOM/Pod.pm index 27ae050..3e2f9ce 100644 --- a/lib/ZOOM/Pod.pm +++ b/lib/ZOOM/Pod.pm @@ -1,4 +1,4 @@ -# $Id: Pod.pm,v 1.16 2006-07-21 10:58:42 mike Exp $ +# $Id: Pod.pm,v 1.21 2006-09-27 12:48:20 mike Exp $ package ZOOM::Pod; @@ -8,7 +8,7 @@ use warnings; use ZOOM; BEGIN { - # Just register the name + # Just register the names: this doesn't turn the levels on ZOOM::Log::mask_str("pod"); ZOOM::Log::mask_str("pod_unhandled"); } @@ -205,12 +205,25 @@ sub callback { my($event, $sub) = @_; my $old = $this->{callback}->{$event}; - $this->{callback}->{$event} = $sub - if defined $sub; + $this->{callback}->{$event} = $sub; return $old; } +=head2 remove_callbacks() + + $pod->remove_callbacks(); + +Removes all registed callbacks from the pod. This is useful when the +pod has completed one operation and is about to start the next. + +=cut + +sub remove_callbacks { + my $this = shift(); + $this->{callback} = {}; +} + =head2 search_pqf() $pod->search_pqf("@attr 1=1003 wedel"); @@ -228,8 +241,8 @@ have one search active on it at a time: this allows the pod to maintain the one-to-one mapping between connections and result-sets. Submitting a new search on a connection before the old one has completed will result in a total failure in the nature of causality, -and the spontaneous existence-failure of the universe. Do not do -this. +and the spontaneous existence-failure of the universe. Try to avoid +doing this too often. =cut @@ -238,7 +251,9 @@ sub search_pqf { my($pqf) = @_; foreach my $i (0..@{ $this->{conn} }-1) { - $this->{rs}->[$i] = $this->{conn}->[$i]->search_pqf($pqf); + my $conn = $this->{conn}->[$i]; + $this->{rs}->[$i] = $conn->search_pqf($pqf) + if !$conn->option("pod_omit"); } } @@ -283,16 +298,17 @@ sub wait { foreach my $i (0 .. @{ $this->{conn} }-1) { my $conn = $this->{conn}->[$i]; if ($conn->option("pod_omit")) { - ZOOM::Log::log("pod", "connection $i omitted (", - $conn->option("host"), ")"); + #ZOOM::Log::log("pod", "connection $i omitted (", + #$conn->option("host"), ")"); } else { push @conn, $conn; push @idxmap, $i; - ZOOM::Log::log("pod", "connection $i included (", - $conn->option("host"), ")"); + #ZOOM::Log::log("pod", "connection $i included (", + #$conn->option("host"), ")"); } } + last if @conn == 0; my $i0 = ZOOM::event(\@conn); last if $i0 == 0; my $i = 1+$idxmap[$i0-1];