bc82ad4ce94fa59d9e4e7127fb86d455c08cbdcc
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy.pm
1 # $Id: IRSpy.pm,v 1.84 2007-04-30 11:28:37 mike Exp $
2
3 package ZOOM::IRSpy;
4
5 use 5.008;
6 use strict;
7 use warnings;
8
9 use Data::Dumper;               # For debugging only
10 use File::Basename;
11 use XML::LibXSLT;
12 use XML::LibXML;
13 use XML::LibXML::XPathContext;
14 use ZOOM;
15 use Net::Z3950::ZOOM 1.13;      # For the ZOOM version-check only
16 use ZOOM::IRSpy::Node;
17 use ZOOM::IRSpy::Connection;
18 use ZOOM::IRSpy::Stats;
19 use ZOOM::IRSpy::Utils qw(cql_target render_record
20                           irspy_xpath_context irspy_make_identifier
21                           irspy_record2identifier);
22
23 our @ISA = qw();
24 our $VERSION = '0.02';
25 our $irspy_to_zeerex_xsl = dirname(__FILE__) . '/../../xsl/irspy2zeerex.xsl';
26
27
28 # Enumeration for callback functions to return
29 package ZOOM::IRSpy::Status;
30 sub OK { 29 }                   # No problems, task is still progressing
31 sub TASK_DONE { 18 }            # Task is complete, next task should begin
32 sub TEST_GOOD { 8 }             # Whole test is complete, and succeeded
33 sub TEST_BAD { 31 }             # Whole test is complete, and failed
34 sub TEST_SKIPPED { 12 }         # Test couldn't be run
35 package ZOOM::IRSpy;
36
37
38 =head1 NAME
39
40 ZOOM::IRSpy - Perl extension for discovering and analysing IR services
41
42 =head1 SYNOPSIS
43
44  use ZOOM::IRSpy;
45  $spy = new ZOOM::IRSpy("target/string/for/irspy/database");
46  $spy->targets(@targets);
47  $spy->initialise("Main");
48  $res = $spy->check();
49
50 =head1 DESCRIPTION
51
52 This module exists to implement the IRspy program, which discovers,
53 analyses and monitors IR servers implementing the Z39.50 and SRU/W
54 protocols.  It is a successor to the ZSpy program.
55
56 =cut
57
58 BEGIN {
59     ZOOM::Log::mask_str("irspy");
60     ZOOM::Log::mask_str("irspy_debug");
61     ZOOM::Log::mask_str("irspy_event");
62     ZOOM::Log::mask_str("irspy_unhandled");
63     ZOOM::Log::mask_str("irspy_test");
64     ZOOM::Log::mask_str("irspy_task");
65 }
66
67 sub new {
68     my $class = shift();
69     my($dbname, $user, $password, $activeSetSize) = @_;
70
71     my @options;
72     push @options, (user => $user, password => $password)
73         if defined $user;
74
75     my $conn = new ZOOM::Connection($dbname, 0, @options)
76         or die "$0: can't connection to IRSpy database 'dbname'";
77
78     my $xslt = new XML::LibXSLT;
79
80     $xslt->register_function($ZOOM::IRSpy::Utils::IRSPY_NS, 'strcmp',
81                              \&ZOOM::IRSpy::Utils::xslt_strcmp);
82
83     my $libxml = new XML::LibXML;
84     my $xsl_doc = $libxml->parse_file($irspy_to_zeerex_xsl);
85     my $irspy_to_zeerex_style = $xslt->parse_stylesheet($xsl_doc);
86
87     my $this = bless {
88         conn => $conn,
89         query => "cql.allRecords=1", # unless overridden
90         targets => undef,       # Filled in later if targets() is
91                                 # called; used only to keep state from
92                                 # targets() until initialise() is
93                                 # called.
94         connections => undef,   # Filled in by initialise()
95         queue => undef,         # Filled in by initialise()
96         libxml => $libxml,
97         irspy_to_zeerex_style => $irspy_to_zeerex_style,
98         test => undef,          # Filled in by initialise()
99         tests => undef,         # Tree of tests to be executed
100         activeSetSize => defined $activeSetSize ? $activeSetSize : 10,
101     }, $class;
102     $this->log("irspy", "starting up with database '$dbname'");
103
104     return $this;
105 }
106
107
108 sub log {
109     my $this = shift();
110     ZOOM::Log::log(@_);
111 }
112
113
114 sub find_targets {
115     my $this = shift();
116     my($query) = @_;
117
118     $this->{query} = $query;
119 }
120
121
122 # Explicitly nominate a set of targets to check, overriding the
123 # default which is to re-check everything in the database.  Each
124 # target already in the database results in the existing record being
125 # updated; each new target causes a new record to be added.
126 #
127 sub targets {
128     my $this = shift();
129     my(@targets) = @_;
130
131     $this->log("irspy", "setting explicit list of targets ",
132                join(", ", map { "'$_'" } @targets));
133     my @qlist;
134     foreach my $target (@targets) {
135         my($protocol, $host, $port, $db, $newtarget) =
136             _parse_target_string($target);
137         if ($newtarget ne $target) {
138             $this->log("irspy_debug", "rewriting '$target' to '$newtarget'");
139             $target = $newtarget; # This is written through the ref
140         }
141         push @qlist, cql_target($protocol, $host, $port, $db);
142     }
143
144     $this->{targets} = \@targets;
145     $this->{query} = join(" or ", @qlist);
146 }
147
148
149 # Also used by ZOOM::IRSpy::Record
150 sub _parse_target_string {
151     my($target) = @_;
152
153     my($protocol, $host, $port, $db) = ($target =~ /(.*?):(.*?):(.*?)\/(.*)/);
154     if (!defined $host) {
155         $port = 210;
156         ($protocol, $host, $db) = ($target =~ /(.*?):(.*?)\/(.*)/);
157         $target = irspy_make_identifier($protocol, $host, $port, $db);
158     }
159     die "$0: invalid target string '$target'"
160         if !defined $host;
161
162     return ($protocol, $host, $port, $db, $target);
163 }
164
165
166 # Records must be fetched for all records satisfying $this->{query} If
167 # $this->{targets} is already set (i.e. a specific list of targets to
168 # check was specified by a call to targets()), then new, empty records
169 # will be made for any targets that are not already in the database.
170 #
171 sub initialise {
172     my $this = shift();
173     my($tname) = @_;
174
175     $tname = "Main" if !defined $tname;
176     $this->{test} = $tname;
177     $this->{tree} = $this->_gather_tests($tname)
178         or die "No tests defined for '$tname'";
179     $this->{tree}->resolve();
180     #$this->{tree}->print(0);
181
182     my $timeout = "ZOOM::IRSpy::Test::$tname"->timeout();
183
184     my @targets;
185     my $targets = $this->{targets};
186     if (defined $targets) {
187         @targets = @$targets;
188         delete $this->{targets};
189     } else {
190         my $rs = $this->{conn}->search(new ZOOM::Query::CQL($this->{query}));
191         $this->log("irspy", "'", $this->{query}, "' found ",
192                    $rs->size(), " target records");
193         delete $this->{query};
194
195         foreach my $i (1 .. $rs->size()) {
196             push @targets, render_record($rs, $i-1, "id");
197         }
198     }
199
200     my $n = $this->{activeSetSize};
201     $n = @targets if $n == 0 || $n > @targets;
202
203     my @connections;
204     foreach my $i (1..$n) {
205         push @connections, create ZOOM::IRSpy::Connection($this,
206                                                           shift @targets,
207                                                           async => 1,
208                                                           timeout => $timeout);
209     }
210
211     $this->{connections} = \@connections;
212     $this->{queue} = \@targets;
213 }
214
215
216 sub _irspy_to_zeerex {
217     my $this = shift();
218     my($conn, $save_xml) = @_;
219     my $irspy_doc = $conn->record()->{zeerex}->ownerDocument;
220
221     if ($save_xml) {
222         unlink('/tmp/irspy_orig.xml');
223         open FH, '>/tmp/irspy_orig.xml'
224             or die "can't write irspy_orig.xml: $!";
225         print FH $irspy_doc->toString();
226         close FH;
227     }
228     my %params = ();
229     my $result = $this->{irspy_to_zeerex_style}->transform($irspy_doc, %params);
230     if ($save_xml) {
231         unlink('/tmp/irspy_transformed.xml');
232         open FH, '>/tmp/irspy_transformed.xml'
233             or die "can't write irspy_transformed.xml: $!";
234         print FH $result->toString();
235         close FH;
236     }
237
238     return $result->documentElement();
239 }
240
241
242 sub _rewrite_record {
243     my $this = shift();
244     my($conn) = @_;
245
246     $conn->log("irspy", "rewriting XML record");
247     my $rec = $this->_irspy_to_zeerex($conn, $ENV{IRSPY_SAVE_XML});
248
249     # Since IRSpy can run for a long time between writes back to the
250     # database, it's quite possible for the server to have closed the
251     # connection as idle.  So re-establish it if necessary.
252     $this->{conn}->connect($conn->option("host"));
253
254     _really_rewrite_record($this->{conn}, $rec);
255     $conn->log("irspy", "rewrote XML record");
256 }
257
258
259 sub _really_rewrite_record {
260     my($conn, $rec, $oldid) = @_;
261
262     my $p = $conn->package();
263     $p->option(action => "specialUpdate");
264     my $xml = $rec->toString();
265     $p->option(record => $xml);
266     $p->send("update");
267     $p->destroy();
268
269     # This is the expression in the ID-making stylesheet
270     # ../../zebra/zeerex2id.xsl
271     my $xc = irspy_xpath_context($rec);
272     my $id = irspy_record2identifier($xc);
273     if (defined $oldid && $id ne $oldid) {
274         warn "IDs differ (old='$oldid' new='$id')";
275         # Delete old record;
276         ### Should use same mechanism as delete.mc
277         my $p = $conn->package();
278         $p->option(action => "recordDelete");
279         $p->option(recordIdOpaque => $oldid);
280         $p->option(record => "<dummy/>"); # Work around Zebra bug
281         $p->send("update");
282         $p->destroy();
283     }
284
285     $p = $conn->package();
286     $p->send("commit");
287     $p->destroy();
288     if (0) {
289         $xml =~ s/&/&amp/g;
290         $xml =~ s/</&lt;/g;
291         $xml =~ s/>/&gt;/g;
292         print "Updated $conn with xml=<br/>\n<pre>$xml</pre>\n";
293     }
294 }
295
296
297 # The approach: gather declarative information about test hierarchy,
298 # then go into a loop.  In the loop, we ensure that each connection is
299 # running a test, and within that test a task, until its list of tests
300 # is exhausted.  No individual test ever calls wait(): tests just queue
301 # up tasks and return immediately.  When the tasks are run (one at a
302 # time on each connection) they generate events, and it is these that
303 # are harvested by ZOOM::event().  Since each connection knows what
304 # task it is running, it can invoke the appropriate callbacks.
305 # Callbacks return a ZOOM::IRSpy::Status value which tells the main
306 # loop how to continue.
307 #
308 # Invariants:
309 #       While a connection is running a task, its current_task()
310 #       points at the task structure.  When it finishes its task, 
311 #       next_task() is pointed at the next task to execute (if there
312 #       is one), and its current_task() is set to zero.  When the next
313 #       task is executed, the connection's next_task() is set to zero
314 #       and its current_task() pointed to the task structure.
315 #       current_task() and next_task() are both zero only when there
316 #       are no more queued tasks, which is when a new test is
317 #       started.
318 #
319 #       Each connection's current test is stored in its
320 #       "current_test_address" option.  The next test to execute is
321 #       calculated by walking the declarative tree of tests.  This
322 #       option begins empty; the "next test" after this is of course
323 #       the root test.
324 #
325 sub check {
326     my $this = shift();
327
328     my $topname = $this->{tree}->name();
329     my $timeout = "ZOOM::IRSpy::Test::$topname"->timeout();
330     $this->log("irspy", "beginnning with test '$topname' (timeout $timeout)");
331
332     my $nskipped = 0;
333     my @conn = @{ $this->{connections} };
334
335     my $nruns = 0;
336   ROUND_AND_ROUND_WE_GO:
337     while (1) {
338         my @copy_conn = @conn;  # avoid alias problems after splice()
339         my $nconn = scalar(@copy_conn);
340         foreach my $i0 (0 .. $#copy_conn) {
341             my $conn = $copy_conn[$i0];
342             #print "connection $i0 of $nconn/", scalar(@conn), " is $conn\n";
343             next if !defined $conn;
344             if (!$conn->current_task()) {
345                 if (!$conn->next_task()) {
346                     # Out of tasks: we need a new test
347                   NEXT_TEST:
348                     my $address = $conn->option("current_test_address");
349                     my $nextaddr;
350                     if (!defined $address) {
351                         $nextaddr = "";
352                     } else {
353                         $conn->log("irspy_test",
354                                    "checking for next test after '$address'");
355                         $nextaddr = $this->_next_test($address);
356                     }
357                     if (!defined $nextaddr) {
358                         $conn->log("irspy", "has no more tests: removing");
359                         $this->_rewrite_record($conn);
360                         $conn->option(rewrote_record => 1);
361                         if (@{ $this->{queue} } == 0) {
362                             # Do not destroy: we need this for later sanity checks
363                             splice @conn, $i0, 1;
364                         } else {
365                             $conn->destroy();
366                             $conn[$i0] = create
367                                 ZOOM::IRSpy::Connection($this,
368                                         shift @{ $this->{queue} }, async => 1,
369                                                         timeout => $timeout);
370                             $conn[$i0]->option(current_test_address => "");
371                             $conn[$i0]->log("irspy", "entering active pool - ",
372                                             scalar(@{ $this->{queue} }),
373                                             " targets remain in queue");
374                         }
375                         next;
376                     }
377
378                     my $node = $this->{tree}->select($nextaddr)
379                         or die "invalid nextaddr '$nextaddr'";
380                     $conn->option(current_test_address => $nextaddr);
381                     my $tname = $node->name();
382                     $conn->log("irspy_test",
383                                "starting test '$nextaddr' = $tname");
384                     my $tasks = $conn->tasks();
385                     my $oldcount = @$tasks;
386                     "ZOOM::IRSpy::Test::$tname"->start($conn);
387                     $tasks = $conn->tasks();
388                     if (@$tasks > $oldcount) {
389                         # Prepare to start the first of the newly added tasks
390                         $conn->next_task($tasks->[$oldcount]);
391                     } else {
392                         $conn->log("irspy_task",
393                                    "no tasks added by new test $tname");
394                         goto NEXT_TEST;
395                     }
396                 }
397
398                 my $task = $conn->next_task();
399                 die "no next task queued for $conn" if !defined $task;
400                 $conn->log("irspy_task", "preparing task $task");
401                 $conn->next_task(0);
402                 $conn->current_task($task);
403                 $task->run();
404             }
405         }
406
407       NEXT_EVENT:
408         my $i0 = ZOOM::event(\@conn);
409         $this->log("irspy_event",
410                    "ZOOM_event(", scalar(@conn), " connections) = $i0");
411         if ($i0 < 1) {
412             my %messages = (
413                             0 => "no events remain",
414                             -1 => "ZOOM::event() argument not a reference",
415                             -2 => "ZOOM::event() reference not an array",
416                             -3 => "no connections remain",
417                             -4 => "too many connections for ZOOM::event()",
418                             );
419             my $message = $messages{$i0} || "ZOOM::event() returned $i0";
420             $this->log("irspy", $message);
421             last;
422         }
423
424         my $conn = $conn[$i0-1];
425         my $ev = $conn->last_event();
426         my $evstr = ZOOM::event_str($ev);
427         $conn->log("irspy_event", "event $ev ($evstr)");
428         goto NEXT_EVENT if $ev != ZOOM::Event::ZEND;
429
430         my $task = $conn->current_task();
431         die "$conn has no current task for event $ev ($evstr)" if !$task;
432
433         my $res;
434         eval { $conn->check() };
435         if ($@ && ref $@ && $@->isa("ZOOM::Exception")) {
436             my $sub = $task->{cb}->{exception};
437             die $@ if !defined $sub;
438             $res = &$sub($conn, $task, $task->udata(), $@);
439         } elsif ($@) {
440             die "Unexpected non-ZOOM exception: " . ref($@) . " ($@)";
441         } else {
442             my $sub = $task->{cb}->{$ev};
443             if (!defined $sub) {
444                 $conn->log("irspy_unhandled", "event $ev ($evstr)");
445                 next;
446             }
447
448             $res = &$sub($conn, $task, $task->udata(), $ev);
449         }
450
451         if ($res == ZOOM::IRSpy::Status::OK) {
452             # Nothing to do -- life continues
453
454         } elsif ($res == ZOOM::IRSpy::Status::TASK_DONE) {
455             my $task = $conn->current_task();
456             die "no task for TASK_DONE on $conn" if !$task;
457             die "next task already defined for $conn" if $conn->next_task();
458             $conn->log("irspy_task", "completed task $task");
459             $conn->next_task($task->{next});
460             $conn->current_task(0);
461
462         } elsif ($res == ZOOM::IRSpy::Status::TEST_GOOD ||
463                  $res == ZOOM::IRSpy::Status::TEST_BAD) {
464             my $x = ($res == ZOOM::IRSpy::Status::TEST_GOOD) ? "good" : "bad";
465             $conn->log("irspy_task", "test ended during task $task ($x)");
466             $conn->log("irspy_test", "test completed ($x)");
467             $conn->current_task(0);
468             $conn->next_task(0);
469             if ($res == ZOOM::IRSpy::Status::TEST_BAD) {
470                 my $address = $conn->option('current_test_address');
471                 $conn->log("irspy", "top-level test failed!")
472                     if $address eq "";
473                 my $node = $this->{tree}->select($address);
474                 my $skipcount = 0;
475                 while (defined $node->next() &&
476                        length($node->next()->address()) >= length($address)) {
477                     $conn->log("irspy_debug", "skipping from '",
478                                $node->address(), "' to '",
479                                $node->next()->address(), "'");
480                     $node = $node->next();
481                     $skipcount++;
482                 }
483
484                 $conn->option(current_test_address => $node->address());
485                 $conn->log("irspy_test", "skipped $skipcount tests");
486                 $nskipped += $skipcount;
487             }
488
489         } elsif ($res == ZOOM::IRSpy::Status::TEST_SKIPPED) {
490             $conn->log("irspy_test", "test skipped during task $task");
491             $conn->current_task(0);
492             $conn->next_task(0);
493             $nskipped++;
494
495         } else {
496             die "unknown callback return-value '$res'";
497         }
498     }
499
500     $this->log("irspy", "exiting main loop");
501
502     # Sanity checks: none of the following should ever happen
503     my $finished = 1;
504     $this->log("irspy", "performing end-of-run sanity-checks");
505     foreach my $conn (@conn) {
506         my $test = $conn->option("current_test_address");
507         my $next = $this->_next_test($test);
508         if (defined $next) {
509             $this->log("irspy",
510                        "$conn (in test '$test') has queued test '$next'");
511             $finished = 0;
512         }
513         if (my $task = $conn->current_task()) {
514             $this->log("irspy", "$conn still has an active task $task");
515             $finished = 0;
516         }
517         if (my $task = $conn->next_task()) {
518             $this->log("irspy", "$conn still has a queued task $task");
519             $finished = 0;
520         }
521         if (!$conn->is_idle()) {
522             $this->log("irspy",
523                        "$conn still has ZOOM-C level tasks queued: see below");
524             $finished = 0;
525         }
526         my $ev = $conn->peek_event();
527         if ($ev != 0 && $ev != ZOOM::Event::ZEND) {
528             my $evstr = ZOOM::event_str($ev);
529             $this->log("irspy", "$conn has event $ev ($evstr) waiting");
530             $finished = 0;
531         }
532         if (!$conn->option("rewrote_record")) {
533             $this->log("irspy", "$conn did not rewrite its ZeeRex record");
534             $finished = 0;
535         }
536     }
537
538     # This really shouldn't be necessary, and in practice it rarely
539     # helps, but it's belt and braces.  (For now, we don't do this
540     # hence the zero in the $nruns check).
541     if (!$finished) {
542         if (++$nruns < 0) {
543             $this->log("irspy", "back into main loop, ${nruns}th time");
544             goto ROUND_AND_ROUND_WE_GO;
545         } else {
546             $this->log("irspy", "bailing after $nruns main-loop runs");
547         }
548     }
549
550     # This shouldn't happen emit anything either:
551     while ((my $i1 = ZOOM::event(\@conn)) > 0) {
552         my $conn = $conn[$i1-1];
553         my $ev = $conn->last_event();
554         my $evstr = ZOOM::event_str($ev);
555         $this->log("irspy",
556                    "$conn still has ZOOM-C level task queued: $ev ($evstr)")
557             if $ev != ZOOM::Event::ZEND;
558     }
559
560     return $nskipped;
561 }
562
563
564 # Exactly equivalent to ZOOM::event() except that it is tolerant to
565 # undefined values in the array being passed in.
566 #
567 sub __UNUSED_tolerant_ZOOM_event {
568     my($connref) = @_;
569
570     my(@conn, @map);
571     foreach my $i (0 .. @$connref-1) {
572         my $conn = $connref->[$i];
573         if (defined $conn) {
574             push @conn, $conn;
575             push @map, $i;
576         }
577     }
578
579     my $res = ZOOM::event(\@conn);
580     return $res if $res <= 0;
581     my $res2 = $map[$res-1] + 1;
582     print STDERR "*** tolerant_ZOOM_event() returns $res->$res2\n";
583     return $res2;
584 }
585
586
587 sub _gather_tests {
588     my $this = shift();
589     my($tname, @ancestors) = @_;
590
591     die("$0: test-hierarchy loop detected: " .
592         join(" -> ", @ancestors, $tname))
593         if grep { $_ eq $tname } @ancestors;
594
595     my $slashSeperatedTname = $tname;
596     $slashSeperatedTname =~ s/::/\//g;
597     my $fullName = "ZOOM/IRSpy/Test/$slashSeperatedTname.pm";
598
599     eval {
600         require $fullName;
601     }; if ($@) {
602         $this->log("irspy", "couldn't require '$fullName': $@");
603         $this->log("warn", "can't load test '$tname': skipping",
604                    $@ =~ /^Can.t locate/ ? () : " ($@)");
605         return undef;
606     }
607
608     $this->log("irspy", "adding test '$tname'");
609     my @subnodes;
610     foreach my $subtname ("ZOOM::IRSpy::Test::$tname"->subtests($this)) {
611         my $subtest = $this->_gather_tests($subtname, @ancestors, $tname);
612         push @subnodes, $subtest if defined $subtest;
613     }
614
615     return new ZOOM::IRSpy::Node($tname, @subnodes);
616 }
617
618
619 # These next three should arguably be Node methods
620 sub _next_test {
621     my $this = shift();
622     my($address, $omit_child) = @_;
623
624     # Try first child
625     if (!$omit_child) {
626         my $maybe = $address eq "" ? "0" : "$address:0";
627         return $maybe if $this->{tree}->select($maybe);
628     }
629
630     # The top-level node has no successor or parent
631     return undef if $address eq "";
632
633     # Try next sibling child
634     my @components = split /:/, $address;
635     my $last = pop @components;
636     my $maybe = join(":", @components, $last+1);
637     return $maybe if $this->{tree}->select($maybe);
638
639     # This node is exhausted: try the parent's successor
640     return $this->_next_test(join(":", @components), 1)
641 }
642
643
644 sub _last_sibling_test {
645     my $this = shift();
646     my($address) = @_;
647
648     return undef
649         if !defined $this->_next_sibling_test($address);
650
651     my $nskipped = 0;
652     while (1) {
653         my $maybe = $this->_next_sibling_test($address);
654         last if !defined $maybe;
655         $nskipped++;
656         $address = $maybe;
657         $this->log("irspy", "skipping $nskipped tests to '$address'");
658     }
659
660     return ($address, $nskipped);
661 }
662
663
664 sub _next_sibling_test {
665     my $this = shift();
666     my($address) = @_;
667
668     my @components = split /:/, $address;
669     my $last = pop @components;
670     my $maybe = join(":", @components, $last+1);
671     return $maybe if $this->{tree}->select($maybe);
672     return undef;
673 }
674
675
676 =head1 SEE ALSO
677
678 ZOOM::IRSpy::Record,
679 ZOOM::IRSpy::Web,
680 ZOOM::IRSpy::Test,
681 ZOOM::IRSpy::Maintenance.
682
683 The ZOOM-Perl module,
684 http://search.cpan.org/~mirk/Net-Z3950-ZOOM/
685
686 The Zebra Database,
687 http://indexdata.com/zebra/
688
689 =head1 AUTHOR
690
691 Mike Taylor, E<lt>mike@indexdata.comE<gt>
692
693 =head1 COPYRIGHT AND LICENSE
694
695 Copyright (C) 2006 by Index Data ApS.
696
697 This library is free software; you can redistribute it and/or modify
698 it under the same terms as Perl itself, either Perl version 5.8.7 or,
699 at your option, any later version of Perl 5 you may have available.
700
701 =cut
702
703
704 1;