DBIServer/SUTRS.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 22 CC 2 SCAR 15.4
CC
2
Cov
0%
format
6.0
BEGIN
2.0
CRAP 4.7
1 # $Id: SUTRS.pm,v 1.2 2005-04-11 18:48:20 mike Exp $
2  
3 package Net::Z3950::DBIServer::SUTRS;
4 use strict;
5  
6 =head1 NAME
7  
8 Net::Z3950::DBIServer::SUTRS - build SUTRS records for DBIServer
9  
10 =head1 SYNOPSIS
11  
12 $rec = Net::Z3950::DBIServer::SUTRS::format(
13 { title=>'Mr', forename=>'Eric', surname=>'1/2 Bee' },
14 $config);
15  
16 =head1 DESCRIPTION
17  
18 This non-OO module exists only to provide a single function which
19 formats a set of fields as a SUTRS record.
20  
21 =head1 METHODS
22  
23 =head2 format()
24  
25 $rec = Net::Z3950::DBIServer::SUTRS::format($hashref, $config);
26  
27 Creates and returns, as an unblessed string, a new SUTRS record
28 containing the specified fields according to the configuration
29 specified in the database-and-record-syntax-specific configuration
30 segment I<$config>, of type C<Net::Z3950::DBIServer::Config::XMLSpec>.
31  
32 =cut
33  
34 sub format {
35 my($hashref, $config) = @_;
36  
37 my $rec = '';
38 foreach my $field ($config->fields()) {
39 my $fieldName = $field->tagname();
40 my $sqlField = $field->columnName();
41 my $data = Net::Z3950::DBIServer::XML::make_data($sqlField, $hashref);
42 next if !defined $data || $data eq "";
43 $rec .= "$fieldName: $data\n";
44 }
45  
46 return $rec;
47 }
48  
49  
50 =head1 AUTHOR
51  
52 Mike Taylor E<lt>mike@miketaylor.org.ukE<gt>
53  
54 First version Sunday 10th April 2005.
55  
56 =head1 SEE ALSO
57  
58 C<Net::Z3950::DBIServer>
59 is the module that uses this.
60  
61 =cut
62  
63  
64 1;