1 package Koha::QueryParser::Driver::PQF::Util;
2 use Scalar::Util qw(looks_like_number);
9 Koha::QueryParser::Driver::PQF::Util - Utility module for PQF QueryParser driver
13 =head2 attributes_to_attr_string
15 Koha::QueryParser::Driver::PQF::Util(%attributes);
17 Koha::QueryParser::Driver::PQF::Util({ '1' => '1003', '4' => '6' });
19 Convert a hashref with a Bib-1 mapping into its PQF string representation.
23 sub attributes_to_attr_string {
24 my ($attributes) = @_;
28 while (($key, $value) = each(%$attributes)) {
29 next unless looks_like_number($key);
30 $attr_string .= ' @attr ' . $key . '=' . $value . ' ';
32 $attr_string =~ s/^\s*//;
33 $attr_string =~ s/\s*$//;
34 $attr_string .= ' ' . $attributes->{''} if defined $attributes->{''};