7 use Data::Dumper; # For debugging only
11 use XML::LibXML::XPathContext;
13 use Net::Z3950::ZOOM 1.13; # For the ZOOM version-check only
14 use ZOOM::IRSpy::Node;
15 use ZOOM::IRSpy::Connection;
16 use ZOOM::IRSpy::Stats;
17 use ZOOM::IRSpy::Utils qw(cql_target render_record
18 irspy_xpath_context irspy_make_identifier
19 irspy_record2identifier calc_reliability_stats
23 our $VERSION = '1.02';
24 our $irspy_to_zeerex_xsl = dirname(__FILE__) . '/../../xsl/irspy2zeerex.xsl';
26 our $xslt_max_depth = 250;
27 our $max_timeout_errors = 3;
30 # Enumeration for callback functions to return
31 package ZOOM::IRSpy::Status;
32 sub OK { 29 } # No problems, task is still progressing
33 sub TASK_DONE { 18 } # Task is complete, next task should begin
34 sub TEST_GOOD { 8 } # Whole test is complete, and succeeded
35 sub TEST_BAD { 31 } # Whole test is complete, and failed
36 sub TEST_SKIPPED { 12 } # Test couldn't be run
42 ZOOM::IRSpy - Perl extension for discovering and analysing IR services
47 $spy = new ZOOM::IRSpy("target/string/for/irspy/database");
48 $spy->targets(@targets);
49 $spy->initialise("Main");
54 This module exists to implement the IRspy program, which discovers,
55 analyses and monitors IR servers implementing the Z39.50 and SRU/W
56 protocols. It is a successor to the ZSpy program.
61 ZOOM::Log::mask_str("irspy");
62 ZOOM::Log::mask_str("irspy_debug");
63 ZOOM::Log::mask_str("irspy_event");
64 ZOOM::Log::mask_str("irspy_unhandled");
65 ZOOM::Log::mask_str("irspy_test");
66 ZOOM::Log::mask_str("irspy_task");
67 ZOOM::Log::mask_str("irspy_data");
72 my($dbname, $user, $password, $activeSetSize) = @_;
76 push @options, (user => $user, password => $password)
79 my $conn = new ZOOM::Connection($dbname, 0, @options)
80 or die "$0: can't connection to IRSpy database 'dbname'";
82 my $xslt = new XML::LibXSLT;
84 # raise the maximum number of nested template calls and variables/params (default 250)
85 warn "raise the maximum number of nested template calls: $xslt_max_depth\n" if $debug;
86 $xslt->max_depth($xslt_max_depth);
88 $xslt->register_function($ZOOM::IRSpy::Utils::IRSPY_NS, 'strcmp',
89 \&ZOOM::IRSpy::Utils::xslt_strcmp);
91 my $libxml = new XML::LibXML;
92 warn "use irspy_to_zeerex_xsl xslt sheet: $irspy_to_zeerex_xsl\n" if $debug;
93 my $xsl_doc = $libxml->parse_file($irspy_to_zeerex_xsl);
94 my $irspy_to_zeerex_style = $xslt->parse_stylesheet($xsl_doc);
98 query => "cql.allRecords=1", # unless overridden
99 modn => undef, # Filled in by restrict_modulo()
100 modi => undef, # Filled in by restrict_modulo()
101 targets => undef, # Filled in later if targets() is
102 # called; used only to keep state from
103 # targets() until initialise() is
105 connections => undef, # Filled in by initialise()
106 queue => undef, # Filled in by initialise()
108 irspy_to_zeerex_style => $irspy_to_zeerex_style,
109 test => undef, # Filled in by initialise()
110 timeout => undef, # Filled in by initialise()
111 tests => undef, # Tree of tests to be executed
112 activeSetSize => defined $activeSetSize ? $activeSetSize : 10,
113 rules => [], # Can be filled by apply_rules()
114 vars => {}, # Will contain name, id, version, etc.
115 # May be written into by tests (mostly
116 # Ping, which gets the Init response)
117 # and read by tests for rules.
119 $this->log("irspy", "starting up with database '$dbname'");
124 # Read from and write to the set of vars
127 my($key, $newval) = @_;
129 if (defined $newval) {
130 $this->{vars}->{$key} = $newval;
131 #warn "$this: set '$key'='$newval'";
133 my $oldval = $this->{vars}->{$key};
134 $oldval = "" if !defined $oldval;
135 #warn "$this: got '$key'='$oldval'";
140 # wrapper to read the IRSpy database name from environment variable / apache config
141 sub connect_to_registry {
144 # XXX: we could also handle her: user, password, elementSetName
146 my $database = $ENV{IRSpyDbName} || "localhost:8018/IR-Explain---1";
161 $this->{query} = $query;
165 # Explicitly nominate a set of targets to check, overriding the
166 # default which is to re-check everything in the database. Each
167 # target already in the database results in the existing record being
168 # updated; each new target causes a new record to be added.
174 $this->log("irspy", "setting explicit list of targets ",
175 join(", ", map { "'$_'" } @targets));
177 foreach my $target (@targets) {
178 my($protocol, $host, $port, $db, $newtarget) =
179 _parse_target_string($target);
180 if ($newtarget ne $target) {
181 $this->log("irspy_debug", "rewriting '$target' to '$newtarget'");
182 $target = $newtarget; # This is written through the ref
184 push @qlist, cql_target($protocol, $host, $port, $db);
187 $this->{targets} = \@targets;
188 $this->{query} = join(" or ", @qlist);
192 # Also used by ZOOM::IRSpy::Record
193 sub _parse_target_string {
196 my($protocol, $host, $port, $db) = ($target =~ /(.*?):(.*?):(.*?)\/(.*)/);
197 if (!defined $host) {
199 ($protocol, $host, $db) = ($target =~ /(.*?):(.*?)\/(.*)/);
200 $target = irspy_make_identifier($protocol, $host, $port, $db);
202 die "$0: invalid target string '$target'"
205 return ($protocol, $host, $port, $db, $target);
209 sub restrict_modulo {
222 my $f = new IO::File("<$fileName")
223 or die "$0: can't open rules file '$fileName': $!";
225 while (my $line = <$f>) {
230 my(@fields) = split /\s+/, $line;
231 my($name, $op, $val, $rule, @params) = @fields;
232 #warn "parsed name='$name', op='$op', val='$val', rule='$rule', params='@params'\n";
233 push @{ $this->{rules} }, [ @fields ];
238 # Records must be fetched for all records satisfying $this->{query} If
239 # $this->{targets} is already set (i.e. a specific list of targets to
240 # check was specified by a call to targets()), then new, empty records
241 # will be made for any targets that are not already in the database.
247 $tname = "Main" if !defined $tname;
248 $this->{test} = $tname;
249 $this->{tree} = $this->_gather_tests($tname)
250 or die "No tests defined for '$tname'";
251 $this->{tree}->resolve();
252 #$this->{tree}->print(0);
254 $this->{timeout} = "ZOOM::IRSpy::Test::$tname"->timeout();
257 my $targets = $this->{targets};
258 if (defined $targets) {
259 @targets = @$targets;
260 delete $this->{targets};
262 my $rs = $this->{conn}->search(new ZOOM::Query::CQL($this->{query}));
263 $this->log("irspy", "'", $this->{query}, "' found ",
264 $rs->size(), " target records");
265 delete $this->{query};
267 foreach my $i (1 .. $rs->size()) {
268 push @targets, render_record($rs, $i-1, "id");
272 my $n = $this->{activeSetSize};
273 $n = @targets if $n == 0 || $n > @targets;
275 $this->{queue} = \@targets;
276 $this->{connections} = [];
277 while (@{ $this->{connections} } < $n) {
278 my $conn = $this->_next_connection();
279 last if !defined $conn;
280 push @{ $this->{connections} }, $conn;
285 sub _next_connection {
289 my $n = $this->{modn};
290 my $i = $this->{modi};
292 $target = shift @{ $this->{queue} };
293 return undef if !defined $target;
296 $target = shift @{ $this->{queue} };
297 return undef if !defined $target;
298 my $h = _hash($target);
300 last if $hmodn == $i;
301 #$this->log("irspy", "'$target' hash $h % $n = $hmodn != $i");
305 die "oops -- target is undefined" if !defined $target;
306 return create ZOOM::IRSpy::Connection($this, $target, async => 1,
307 timeout => $this->{timeout});
315 foreach my $s (split //, $target) {
323 sub _irspy_to_zeerex {
327 my $save_xml = $ENV{IRSPY_SAVE_XML};
328 my $irspy_doc = $conn->record()->{zeerex}->ownerDocument;
331 unlink('/tmp/irspy_orig.xml');
332 open FH, '>/tmp/irspy_orig.xml'
333 or die "can't write irspy_orig.xml: $!";
334 print FH $irspy_doc->toString();
338 my $result = $this->{irspy_to_zeerex_style}->transform($irspy_doc, %params);
340 unlink('/tmp/irspy_transformed.xml');
341 open FH, '>/tmp/irspy_transformed.xml'
342 or die "can't write irspy_transformed.xml: $!";
343 print FH $result->toString();
347 return $result->documentElement();
351 sub _rewrite_irspy_record {
355 $conn->log("irspy", "rewriting XML record");
356 my $rec = $this->_irspy_to_zeerex($conn);
358 # Since IRSpy can run for a long time between writes back to the
359 # database, it's quite possible for the server to have closed the
360 # connection as idle. So re-establish it if necessary.
361 $this->{conn}->connect($conn->option("host"));
363 _rewrite_zeerex_record($this->{conn}, $rec);
364 $conn->log("irspy", "rewrote XML record");
368 my $_specialFields = {
369 reliability => [ reliability => 0,
370 "Calculated reliability of server",
371 "e:serverInfo/e:reliability" ],
373 "Access Name (Unique DB)",
374 "e:databaseInfo/i:udb" ],
377 sub _rewrite_zeerex_record {
378 my($conn, $rec, $oldid) = @_;
380 # Add reliability score
381 my $xc = irspy_xpath_context($rec);
382 my($nok, $nall, $percent) = calc_reliability_stats($xc);
383 modify_xml_document($xc, $_specialFields, { reliability => $percent });
385 if (!defined $oldid) {
386 # New record: generate a UDB for it.
387 modify_xml_document($xc, $_specialFields, { udb => _next_udb() });
390 my $p = $conn->package();
391 $p->option(action => "specialUpdate");
392 my $xml = $rec->toString();
393 $p->option(record => $xml);
397 # This is the expression in the ID-making stylesheet
398 # ../../zebra/zeerex2id.xsl
399 my $id = irspy_record2identifier($xc);
400 if (defined $oldid && $id ne $oldid) {
401 warn "IDs differ (old='$oldid' new='$id')";
402 _delete_record($conn, $oldid);
405 $p = $conn->package();
412 print "Updated $conn with xml=<br/>\n<pre>$xml</pre>\n";
418 use IndexData::Utils::PersistentCounter;
420 my $file = $ENV{IRSPY_COUNTER_FILE}
421 or die "no IRSPY_COUNTER_FILE in environment";
422 my $counter = new IndexData::Utils::PersistentCounter($file)
423 or die "can't open counter file '$file': $!";
424 my $val = $counter->next()
425 or die "can't get counter value from '$file': $!";
433 # We can't delete records using recordIdOpaque, since character
434 # sets are handled differently here in extended services from how
435 # they are used in the Alvis filter's record-parsing, and so
436 # non-ASCII characters come out differently in the two contexts.
437 # Instead, we must send a record whose contents indicate the ID of
438 # that which we wish to delete. There are two ways, both
439 # unsatisfactory: we could either fetch the actual record them
440 # resubmit it in the deletion request (which wastes a search and a
441 # fetch) or we could build a record by hand from the parsed-out
442 # components (which is error-prone and which I am not 100% certain
443 # will work since the other contents of the record will be
444 # different). The former evil seems to be the lesser.
446 warn "$conn deleting record '$id'";
448 my $rs = $conn->search(new ZOOM::Query::CQL(cql_target($id)));
449 die "no such ID '$id'" if $rs->size() == 0;
450 my $rec = $rs->record(0);
451 my $xml = $rec->render();
453 my $p = $conn->package();
454 $p->option(action => "recordDelete");
455 $p->option(record => $xml);
459 $p = $conn->package();
465 # The approach: gather declarative information about test hierarchy,
466 # then go into a loop. In the loop, we ensure that each connection is
467 # running a test, and within that test a task, until its list of tests
468 # is exhausted. No individual test ever calls wait(): tests just queue
469 # up tasks and return immediately. When the tasks are run (one at a
470 # time on each connection) they generate events, and it is these that
471 # are harvested by ZOOM::event(). Since each connection knows what
472 # task it is running, it can invoke the appropriate callbacks.
473 # Callbacks return a ZOOM::IRSpy::Status value which tells the main
474 # loop how to continue.
477 # While a connection is running a task, its current_task()
478 # points at the task structure. When it finishes its task,
479 # next_task() is pointed at the next task to execute (if there
480 # is one), and its current_task() is set to zero. When the next
481 # task is executed, the connection's next_task() is set to zero
482 # and its current_task() pointed to the task structure.
483 # current_task() and next_task() are both zero only when there
484 # are no more queued tasks, which is when a new test is
487 # Each connection's current test is stored in its
488 # "current_test_address" option. The next test to execute is
489 # calculated by walking the declarative tree of tests. This
490 # option begins empty; the "next test" after this is of course
496 my $topname = $this->{tree}->name();
497 my $timeout = $this->{timeout};
498 $this->log("irspy", "beginnning with test '$topname' (timeout $timeout)");
501 my @conn = @{ $this->{connections} };
504 ROUND_AND_ROUND_WE_GO:
506 my @copy_conn = @conn; # avoid alias problems after splice()
507 my $nconn = scalar(@copy_conn);
509 foreach my $i0 (0 .. $#copy_conn) {
510 my $conn = $copy_conn[$i0];
511 #print "connection $i0 of $nconn/", scalar(@conn), " is $conn\n";
512 next if !defined $conn;
514 if (!$conn->current_task()) {
515 if (!$conn->next_task()) {
516 # Out of tasks: we need a new test
518 my $address = $conn->option("current_test_address");
520 if (!defined $address) {
523 $conn->log("irspy_test",
524 "checking for next test after '$address'");
525 $nextaddr = $this->_next_test($address);
528 if (ZOOM::IRSpy::Test::zoom_error_timeout_check($conn)) {
529 $conn->log("irspy", "Got to many timeouts, stop testing");
533 if (!defined $nextaddr) {
534 $conn->log("irspy", "has no more tests: removing");
535 $this->_rewrite_irspy_record($conn);
536 $conn->option(rewrote_record => 1);
537 my $newconn = $this->_next_connection();
538 if (!defined $newconn) {
539 # Do not destroy: needed for later sanity checks
540 splice @conn, $i0, 1;
543 $conn[$i0] = $newconn;
544 $conn[$i0]->option(current_test_address => "");
545 $conn[$i0]->log("irspy", "entering active pool - ",
546 scalar(@{ $this->{queue} }),
547 " targets remain in queue");
552 my $node = $this->{tree}->select($nextaddr)
553 or die "invalid nextaddr '$nextaddr'";
554 $conn->option(current_test_address => $nextaddr);
555 my $tname = $node->name();
556 if ($this->should_skip_test($tname)) {
557 $conn->log("irspy_test",
558 "skipping test '$nextaddr' = $tname due to rule");
563 $conn->log("irspy_test",
564 "starting test '$nextaddr' = $tname");
565 my $tasks = $conn->tasks();
566 my $oldcount = @$tasks;
567 "ZOOM::IRSpy::Test::$tname"->start($conn);
568 $tasks = $conn->tasks();
569 if (@$tasks > $oldcount) {
570 # Prepare to start the first of the newly added tasks
571 $conn->next_task($tasks->[$oldcount]);
573 $conn->log("irspy_task",
574 "no tasks added by new test $tname");
579 my $task = $conn->next_task();
580 die "no next task queued for $conn" if !defined $task;
582 # do not run the next task if we got too many timeouts
583 if (ZOOM::IRSpy::Test::zoom_error_timeout_check($conn)) {
584 $conn->log("irspy_task", "Got too many timeouts for this target, do not start a new task");
588 $conn->log("irspy_task", "preparing task $task");
590 $conn->current_task($task);
596 my $i0 = ZOOM::event(\@conn);
597 $this->log("irspy_event",
598 "ZOOM_event(", scalar(@conn), " connections) = $i0");
601 0 => "no events remain",
602 -1 => "ZOOM::event() argument not a reference",
603 -2 => "ZOOM::event() reference not an array",
604 -3 => "no connections remain",
605 -4 => "too many connections for ZOOM::event()",
607 my $message = $messages{$i0} || "ZOOM::event() returned $i0";
608 $this->log("irspy", $message);
612 my $conn = $conn[$i0-1];
613 my $ev = $conn->last_event();
614 my $evstr = ZOOM::event_str($ev);
615 $conn->log("irspy_event", "event $ev ($evstr)");
616 goto NEXT_EVENT if $ev != ZOOM::Event::ZEND;
618 my $task = $conn->current_task();
619 die "$conn has no current task for event $ev ($evstr)" if !$task;
622 eval { $conn->check() };
623 if ($@ && ref $@ && $@->isa("ZOOM::Exception")) {
624 my $sub = $task->{cb}->{exception};
625 die $@ if !defined $sub;
626 $res = &$sub($conn, $task, $task->udata(), $@);
628 die "Unexpected non-ZOOM exception: " . ref($@) . " ($@)";
630 my $sub = $task->{cb}->{$ev};
632 $conn->log("irspy_unhandled", "event $ev ($evstr)");
636 $res = &$sub($conn, $task, $task->udata(), $ev);
639 if ($res == ZOOM::IRSpy::Status::OK) {
640 # Nothing to do -- life continues
642 } elsif ($res == ZOOM::IRSpy::Status::TASK_DONE) {
643 my $task = $conn->current_task();
644 die "no task for TASK_DONE on $conn" if !$task;
645 die "next task already defined for $conn" if $conn->next_task();
646 $conn->log("irspy_task", "completed task $task");
647 $conn->next_task($task->{next});
648 $conn->current_task(0);
650 } elsif ($res == ZOOM::IRSpy::Status::TEST_GOOD ||
651 $res == ZOOM::IRSpy::Status::TEST_BAD) {
652 my $x = ($res == ZOOM::IRSpy::Status::TEST_GOOD) ? "good" : "bad";
653 $conn->log("irspy_task", "test ended during task $task ($x)");
654 $conn->log("irspy_test", "test completed ($x)");
655 $conn->current_task(0);
657 if ($res == ZOOM::IRSpy::Status::TEST_BAD) {
658 my $address = $conn->option('current_test_address');
659 $conn->log("irspy", "top-level test failed!")
661 my $node = $this->{tree}->select($address);
663 while (defined $node->next() &&
664 length($node->next()->address()) >= length($address)) {
665 $conn->log("irspy_test", "skipping from '",
666 $node->address(), "' to '",
667 $node->next()->address(), "' (", $node->next()->name(), ")");
668 $node = $node->next();
672 $conn->option(current_test_address => $node->address());
673 $conn->log("irspy_test", "skipped $skipcount tests");
674 $nskipped += $skipcount;
677 } elsif ($res == ZOOM::IRSpy::Status::TEST_SKIPPED) {
678 $conn->log("irspy_test", "test skipped during task $task");
679 $conn->current_task(0);
684 die "unknown callback return-value '$res'";
688 $this->log("irspy", "exiting main loop");
690 # Sanity checks: none of the following should ever happen
692 $this->log("irspy", "performing end-of-run sanity-checks");
693 foreach my $conn (@conn) {
694 my $test = $conn->option("current_test_address");
695 my $next = $this->_next_test($test);
698 "$conn (in test '$test') has queued test '$next'");
701 if (my $task = $conn->current_task()) {
702 $this->log("irspy", "$conn still has an active task $task");
705 if (my $task = $conn->next_task()) {
706 $this->log("irspy", "$conn still has a queued task $task");
709 if (!$conn->is_idle()) {
711 "$conn still has ZOOM-C level tasks queued: see below");
714 my $ev = $conn->peek_event();
715 if ($ev != 0 && $ev != ZOOM::Event::ZEND) {
716 my $evstr = ZOOM::event_str($ev);
717 $this->log("irspy", "$conn has event $ev ($evstr) waiting");
720 if (!$conn->option("rewrote_record")) {
721 $this->log("irspy", "$conn did not rewrite its ZeeRex record");
726 # This really shouldn't be necessary, and in practice it rarely
727 # helps, but it's belt and braces. (For now, we don't do this
728 # hence the zero in the $nruns check).
731 $this->log("irspy", "back into main loop, ${nruns}th time");
732 goto ROUND_AND_ROUND_WE_GO;
734 $this->log("irspy", "bailing after $nruns main-loop runs");
738 # This shouldn't happen emit anything either:
739 while ((my $i1 = ZOOM::event(\@conn)) > 0) {
740 my $conn = $conn[$i1-1];
741 my $ev = $conn->last_event();
742 my $evstr = ZOOM::event_str($ev);
744 "$conn still has ZOOM-C level task queued: $ev ($evstr)")
745 if $ev != ZOOM::Event::ZEND;
752 ### This could of course call a much more general looping evaluator
753 sub should_skip_test {
757 foreach my $rule (@{ $this->{rules} }) {
758 my($name, $op, $val, $rule, @params) = @$rule;
759 #warn "using name='$name', op='$op', val='$val', rule='$rule', params='@params'\n";
762 $params[0] eq $tname) {
764 $re =~ s/^\/(.*)\/$/$1/;
765 if ($this->var($name) =~ $re) {
766 #warn "$name '", $this->var($name), "' matches /$re/ -- skipping '$tname'";
776 # Exactly equivalent to ZOOM::event() except that it is tolerant to
777 # undefined values in the array being passed in.
779 sub __UNUSED_tolerant_ZOOM_event {
783 foreach my $i (0 .. @$connref-1) {
784 my $conn = $connref->[$i];
791 my $res = ZOOM::event(\@conn);
792 return $res if $res <= 0;
793 my $res2 = $map[$res-1] + 1;
794 print STDERR "*** tolerant_ZOOM_event() returns $res->$res2\n";
801 my($tname, @ancestors) = @_;
803 die("$0: test-hierarchy loop detected: " .
804 join(" -> ", @ancestors, $tname))
805 if grep { $_ eq $tname } @ancestors;
807 my $slashSeperatedTname = $tname;
808 $slashSeperatedTname =~ s/::/\//g;
809 my $fullName = "ZOOM/IRSpy/Test/$slashSeperatedTname.pm";
814 $this->log("irspy", "couldn't require '$fullName': $@");
815 $this->log("warn", "can't load test '$tname': skipping",
816 $@ =~ /^Can.t locate/ ? () : " ($@)");
820 $this->log("irspy", "adding test '$tname'");
822 foreach my $subtname ("ZOOM::IRSpy::Test::$tname"->subtests($this)) {
823 my $subtest = $this->_gather_tests($subtname, @ancestors, $tname);
824 push @subnodes, $subtest if defined $subtest;
827 return new ZOOM::IRSpy::Node($tname, @subnodes);
831 # These next three should arguably be Node methods
834 my($address, $omit_child) = @_;
838 my $maybe = $address eq "" ? "0" : "$address:0";
839 return $maybe if $this->{tree}->select($maybe);
842 # The top-level node has no successor or parent
843 return undef if $address eq "";
845 # Try next sibling child
846 # The use of a regexp in split() is to avoid confusing Emacs's
847 # Perl mode; the third colon is to avoid looking like a POSIX
848 # named character class ... *sigh*
849 my @components = split /[:::]/, $address;
850 my $last = pop @components;
851 my $maybe = join(":", @components, $last+1);
852 return $maybe if $this->{tree}->select($maybe);
854 # This node is exhausted: try the parent's successor
855 return $this->_next_test(join(":", @components), 1)
859 sub _last_sibling_test {
860 die "_last_sibling_test() called -- I thought that never happened?";
865 if !defined $this->_next_sibling_test($address);
869 my $maybe = $this->_next_sibling_test($address);
870 last if !defined $maybe;
873 $this->log("irspy", "skipping $nskipped tests to '$address'");
876 return ($address, $nskipped);
880 sub _next_sibling_test {
881 die "_next_sibling_test() called -- I thought that never happened?";
885 my @components = split /[:::]/, $address;
886 my $last = pop @components;
887 my $maybe = join(":", @components, $last+1);
888 return $maybe if $this->{tree}->select($maybe);
898 ZOOM::IRSpy::Maintenance.
900 The ZOOM-Perl module,
901 http://search.cpan.org/~mirk/Net-Z3950-ZOOM/
904 http://indexdata.com/zebra/
908 Mike Taylor, E<lt>mike@indexdata.comE<gt>
910 =head1 COPYRIGHT AND LICENSE
912 Copyright (C) 2006 by Index Data ApS.
914 This library is free software; you can redistribute it and/or modify
915 it under the same terms as Perl itself, either Perl version 5.8.7 or,
916 at your option, any later version of Perl 5 you may have available.