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