From: Mike Taylor Date: Fri, 17 Dec 2004 15:28:30 +0000 (+0000) Subject: Use Net::Z3950::PQF::Node X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=5ae638fbecafdb1b5443301516c446f0a12fc04d;p=perl-pqf.git Use Net::Z3950::PQF::Node Synopsis's use of render() has a "level" argument. Note that all node types are subclasses of Net::Z3950::PQF::Node Document optional default-attrset argument to parse() "1;" at end of file. --- diff --git a/lib/Net/Z3950/PQF.pm b/lib/Net/Z3950/PQF.pm index e5e9d6f..92aae90 100644 --- a/lib/Net/Z3950/PQF.pm +++ b/lib/Net/Z3950/PQF.pm @@ -1,4 +1,4 @@ -# $Id: PQF.pm,v 1.1 2004-12-17 13:44:47 mike Exp $ +# $Id: PQF.pm,v 1.2 2004-12-17 15:28:30 mike Exp $ package Net::Z3950::PQF; @@ -6,7 +6,7 @@ use 5.006; use strict; use warnings; -#use Net::Z3950::PQF::Node; +use Net::Z3950::PQF::Node; our $VERSION = '0.02'; @@ -20,7 +20,7 @@ Net::Z3950::PQF - Perl extension for parsing PQF (Prefix Query Format) use Net::Z3950::PQF; $parser = new Net::Z3950::PQF(); $node = $parser->parse('@and @attr 1=1003 kernighan @attr 1=4 unix'); - print $node->render(); + print $node->render(0); =head1 DESCRIPTION @@ -32,8 +32,10 @@ command-line client, C. It is simple to use. Create a parser object, then pass PQF strings into its C method to yield parse-trees. The trees are made -up of nodes whose types are all of the form -C. You may find it helpful to use +up of nodes whose types are subclasses of +C. +and have names of the form +C. You may find it helpful to use C to visualise the structure of the returned parse-trees. @@ -75,10 +77,21 @@ then an undefined value is returned, and the error message can be obtained by calling the C method. Otherwise, the top node of the parse tree is returned. + $node2 = $parser->parse($query, "zthes"); + $node3 = $parser->parse($query, "1.2.840.10003.3.13"); + +A second argument may be provided, after the query itself. If it is +provided, then it is taken to be either the name or the OID of a +default attribute set, which attributes specified in the query belong +to if no alternative attribute set is explicitly specified. When this +second argument is absent, the default attribute set is BIB-1. + =cut sub parse { my $this = shift(); + my($attrset) = @_; + $attrset = "bib-1" if !defined $attrset; die "parse($this) not yet implemented"; } @@ -118,3 +131,6 @@ This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut + + +1;