Koha-clms/Koha/QueryParser/Driver/PQF/Util.pm

23 lines
556 B
Perl

package Koha::QueryParser::Driver::PQF::Util;
use Scalar::Util qw(looks_like_number);
use strict;
use warnings;
sub attributes_to_attr_string {
my ($attributes) = @_;
my $attr_string = '';
my $key;
my $value;
while (($key, $value) = each(%$attributes)) {
next unless looks_like_number($key);
$attr_string .= ' @attr ' . $key . '=' . $value . ' ';
}
$attr_string =~ s/^\s*//;
$attr_string =~ s/\s*$//;
$attr_string .= ' ' . $attributes->{''} if defined $attributes->{''};
return $attr_string;
}
1;