From 00896b6fc762031f36aeb5b37fefce433559649a Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 17 Dec 2004 13:44:47 +0000 Subject: [PATCH] Move PQF.pm to lib/Net/Z3950/PQF.pm --- MANIFEST | 4 +- Makefile.PL | 4 +- PQF.pm | 120 -------------------------------------------------- lib/Net/Z3950/PQF.pm | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 124 insertions(+), 124 deletions(-) delete mode 100644 PQF.pm create mode 100644 lib/Net/Z3950/PQF.pm diff --git a/MANIFEST b/MANIFEST index 9b7507e..2db140a 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,7 +1,7 @@ Changes -Makefile.PL MANIFEST MANIFEST.SKIP -PQF.pm +Makefile.PL README +lib/Net/Z3950/PQF.pm t/1.t diff --git a/Makefile.PL b/Makefile.PL index 5adc5a8..0f3a550 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,4 @@ -# $Id: Makefile.PL,v 1.2 2004-12-17 12:58:35 mike Exp $ +# $Id: Makefile.PL,v 1.3 2004-12-17 13:44:47 mike Exp $ use 5.006; use ExtUtils::MakeMaker; @@ -7,7 +7,7 @@ use ExtUtils::MakeMaker; # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Net::Z3950::PQF', - 'VERSION_FROM' => 'PQF.pm', # finds $VERSION + 'VERSION_FROM' => 'lib/Net/Z3950/PQF.pm', # finds $VERSION 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (AUTHOR => 'Mike Taylor ') : ()), diff --git a/PQF.pm b/PQF.pm deleted file mode 100644 index c1690e8..0000000 --- a/PQF.pm +++ /dev/null @@ -1,120 +0,0 @@ -# $Id: PQF.pm,v 1.2 2004-12-17 12:58:51 mike Exp $ - -package Net::Z3950::PQF; - -use 5.006; -use strict; -use warnings; - -#use Net::Z3950::PQF::Node; - -our $VERSION = '0.02'; - - -=head1 NAME - -Net::Z3950::PQF - Perl extension for parsing PQF (Prefix Query Format) - -=head1 SYNOPSIS - - use Net::Z3950::PQF; - $parser = new Net::Z3950::PQF(); - $node = $parser->parse('@and @attr 1=1003 kernighan @attr 1=4 unix'); - print $node->render(); - -=head1 DESCRIPTION - -This library provides a parser for PQF (Prefix Query Format), an ugly -but precise string format for expressing Z39.50 Type-1 queries. This -format is widely used behind the scenes of Z39.50 applications, and is -also used extensively with test-harness programs such as the YAZ -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 -C to visualise the structure of the returned -parse-trees. - -What is a PQF parse-tree good for? Not much. You can render a -human-readable version by invoking the top node's C method, -which is probably useful only for debugging. If you want to do -anything useful, such as implementing an actual query server that -understands PQF, you'll have to walk the tree. - -=head1 METHODS - -=head2 new() - - $parser = new Net::Z3950::PQF(); - -Creates a new parser object. - -=cut - -sub new { - my $class = shift(); - - return bless { - errmsg => undef, - }, $class; -} - - -=head2 parse() - - $query = '@and @attr 1=1003 kernighan @attr 1=4 unix'; - $node = $parser->parse($query); - if (!defined $node) - die "parse($query) failed: " . $parser->errmsg(); - } - -Parses the PQF string provided as its argument. If an error occurs, -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. - -=cut - -sub parse { - my $this = shift(); - - die "parse($this) not yet implemented"; -} - - -=head2 errmsg() - - print $parser->errmsg(); - -=cut - -sub errmsg { - my $this = shift(); - return $this->{errmsg}; -} - - -=head1 SEE ALSO - -The definition of the Type-1 query in the Z39.50 standard, the -relevant section of which is on-line at -http://www.loc.gov/z3950/agency/markup/09.html#3.7 - -The documentation of Prefix Query Format in the YAZ Manual, the -relevant section of which is on-line at -http://indexdata.com/yaz/doc/tools.tkl#PQF - -=head1 AUTHOR - -Mike Taylor, Emike@indexdata.comE - -=head1 COPYRIGHT AND LICENSE - -Copyright 2004 by Index Data ApS. - -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut diff --git a/lib/Net/Z3950/PQF.pm b/lib/Net/Z3950/PQF.pm new file mode 100644 index 0000000..e5e9d6f --- /dev/null +++ b/lib/Net/Z3950/PQF.pm @@ -0,0 +1,120 @@ +# $Id: PQF.pm,v 1.1 2004-12-17 13:44:47 mike Exp $ + +package Net::Z3950::PQF; + +use 5.006; +use strict; +use warnings; + +#use Net::Z3950::PQF::Node; + +our $VERSION = '0.02'; + + +=head1 NAME + +Net::Z3950::PQF - Perl extension for parsing PQF (Prefix Query Format) + +=head1 SYNOPSIS + + use Net::Z3950::PQF; + $parser = new Net::Z3950::PQF(); + $node = $parser->parse('@and @attr 1=1003 kernighan @attr 1=4 unix'); + print $node->render(); + +=head1 DESCRIPTION + +This library provides a parser for PQF (Prefix Query Format), an ugly +but precise string format for expressing Z39.50 Type-1 queries. This +format is widely used behind the scenes of Z39.50 applications, and is +also used extensively with test-harness programs such as the YAZ +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 +C to visualise the structure of the returned +parse-trees. + +What is a PQF parse-tree good for? Not much. You can render a +human-readable version by invoking the top node's C method, +which is probably useful only for debugging. If you want to do +anything useful, such as implementing an actual query server that +understands PQF, you'll have to walk the tree. + +=head1 METHODS + +=head2 new() + + $parser = new Net::Z3950::PQF(); + +Creates a new parser object. + +=cut + +sub new { + my $class = shift(); + + return bless { + errmsg => undef, + }, $class; +} + + +=head2 parse() + + $query = '@and @attr 1=1003 kernighan @attr 1=4 unix'; + $node = $parser->parse($query); + if (!defined $node) + die "parse($query) failed: " . $parser->errmsg(); + } + +Parses the PQF string provided as its argument. If an error occurs, +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. + +=cut + +sub parse { + my $this = shift(); + + die "parse($this) not yet implemented"; +} + + +=head2 errmsg() + + print $parser->errmsg(); + +=cut + +sub errmsg { + my $this = shift(); + return $this->{errmsg}; +} + + +=head1 SEE ALSO + +The definition of the Type-1 query in the Z39.50 standard, the +relevant section of which is on-line at +http://www.loc.gov/z3950/agency/markup/09.html#3.7 + +The documentation of Prefix Query Format in the YAZ Manual, the +relevant section of which is on-line at +http://indexdata.com/yaz/doc/tools.tkl#PQF + +=head1 AUTHOR + +Mike Taylor, Emike@indexdata.comE + +=head1 COPYRIGHT AND LICENSE + +Copyright 2004 by Index Data ApS. + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut -- 1.7.10.4