remove stale $Id$
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Task / Retrieve.pm
1
2 package ZOOM::IRSpy::Task::Retrieve;
3
4 use 5.008;
5 use strict;
6 use warnings;
7
8 use ZOOM::IRSpy::Task;
9 our @ISA = qw(ZOOM::IRSpy::Task);
10
11 =head1 NAME
12
13 ZOOM::IRSpy::Task::Retrieve - a searching task for IRSpy
14
15 =head1 SYNOPSIS
16
17  ## to follow
18
19 =head1 DESCRIPTION
20
21  ## to follow
22
23 =cut
24
25 sub new {
26     my $class = shift();
27     my($rs) = shift();
28     my($index0) = shift();
29
30     my $this = $class->SUPER::new(@_);
31     $this->{rs} = $rs;
32     $this->{index0} = $index0;
33     # Save initial record-syntax for render()'s benefit
34     $this->{syntax} = $this->{options}->{preferredRecordSyntax};
35
36     return $this;
37 }
38
39 sub run {
40     my $this = shift();
41
42     $this->set_options();
43
44     my $conn = $this->conn();
45     $conn->connect($conn->option("host"));
46
47     my $rs = $this->{rs};
48     my $index0 = $this->{index0};
49     $this->irspy()->log("irspy_task", $conn->option("host"),
50                         " retrieving record $index0 from $rs");
51     $rs->records($index0, 1, 0); # requests record
52     warn "no ZOOM-C level events queued by $this"
53         if $conn->is_idle();
54
55     $this->set_options();
56 }
57
58 sub render {
59     my $this = shift();
60     my $syntax = $this->{syntax};
61     $syntax = defined $syntax ? "'$syntax'" : "undef";
62     return ref($this) . "(" . $this->{index0} . ", $syntax)";
63 }
64
65 use overload '""' => \&render;
66
67
68 =head1 SEE ALSO
69
70 ZOOM::IRSpy
71
72 =head1 AUTHOR
73
74 Mike Taylor, E<lt>mike@indexdata.comE<gt>
75
76 =head1 COPYRIGHT AND LICENSE
77
78 Copyright (C) 2006 by Index Data ApS.
79
80 This library is free software; you can redistribute it and/or modify
81 it under the same terms as Perl itself, either Perl version 5.8.7 or,
82 at your option, any later version of Perl 5 you may have available.
83
84 =cut
85
86 1;