1 package Koha
::Biblio
::Metadata
;
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 use Koha
::Exceptions
::Metadata
;
26 use base
qw(Koha::Object);
30 Koha::Metadata - Koha Metadata Object class
40 my $record = $metadata->record;
42 Returns an object representing the metadata record. The expected record type
43 corresponds to this table:
45 -------------------------------
46 | format | object type |
47 -------------------------------
48 | marcxml | MARC::Record |
49 -------------------------------
55 =item If an unsupported format is found, it throws a I<Koha::Exceptions::Metadata> exception.
57 =item If it fails to create the record object, it throws a I<Koha::Exceptions::Metadata::Invalid> exception.
69 if ( $self->format eq 'marcxml' ) {
70 $record = eval { MARC
::Record
::new_from_xml
( $self->metadata, 'UTF-8', $self->schema ); };
71 my $marcxml_error = $@
;
74 Koha
::Exceptions
::Metadata
::Invalid
->throw(
76 format
=> $self->format,
77 schema
=> $self->schema,
78 decoding_error
=> $marcxml_error,
83 Koha
::Exceptions
::Metadata
->throw(
84 'Koha::Biblio::Metadata->record called on unhandled format: ' . $self->format );
90 =head2 Internal methods
97 return 'BiblioMetadata';