| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::OAI::Record::OAI_DC; |
|
2
|
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
73
|
use strict; |
|
|
14
|
|
|
|
|
28
|
|
|
|
14
|
|
|
|
|
490
|
|
|
4
|
14
|
|
|
14
|
|
70
|
use base qw( XML::SAX::Base ); |
|
|
14
|
|
|
|
|
25
|
|
|
|
14
|
|
|
|
|
9194
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 'v1.00.0'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @OAI_DC_ELEMENTS = qw( |
|
8
|
|
|
|
|
|
|
title |
|
9
|
|
|
|
|
|
|
creator |
|
10
|
|
|
|
|
|
|
subject |
|
11
|
|
|
|
|
|
|
description |
|
12
|
|
|
|
|
|
|
publisher |
|
13
|
|
|
|
|
|
|
contributor |
|
14
|
|
|
|
|
|
|
date |
|
15
|
|
|
|
|
|
|
type |
|
16
|
|
|
|
|
|
|
format |
|
17
|
|
|
|
|
|
|
identifier |
|
18
|
|
|
|
|
|
|
source |
|
19
|
|
|
|
|
|
|
language |
|
20
|
|
|
|
|
|
|
relation |
|
21
|
|
|
|
|
|
|
coverage |
|
22
|
|
|
|
|
|
|
rights |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Net::OAI::Record::OAI_DC - class for baseline Dublin Core support |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The accessor methods are aware of their calling context (list,scalar) and |
|
38
|
|
|
|
|
|
|
will respond appropriately. For example an item may have multiple creators, |
|
39
|
|
|
|
|
|
|
so a call to creator() in a scalar context returns only the first creator; |
|
40
|
|
|
|
|
|
|
and in a list context all creators are returned. |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# scalar context |
|
43
|
|
|
|
|
|
|
my $creator = $metadata->creator(); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# list context |
|
46
|
|
|
|
|
|
|
my @creators = $metadata->creator(); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 new() |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new { |
|
53
|
602
|
|
|
602
|
1
|
1518
|
my ( $class, %opts ) = @_; |
|
54
|
602
|
|
33
|
|
|
5462
|
my $self = bless \%opts, ref( $class ) || $class; |
|
55
|
602
|
|
|
|
|
2128
|
foreach ( @OAI_DC_ELEMENTS ) { $self->{ $_ } = []; } |
|
|
9030
|
|
|
|
|
20877
|
|
|
56
|
602
|
|
|
|
|
4091
|
return( $self ); |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 title() |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 creator() |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 subject() |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 description() |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 publisher() |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 contributor() |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head2 date() |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 type() |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 format() |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 identifier() |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 source() |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 language() |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 relation() |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 coverage() |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 rights() |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
## rather than right all the accessors we use AUTOLOAD to catch calls |
|
92
|
|
|
|
|
|
|
## valid element names as methods, and return appropriately as a list |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
95
|
402
|
|
|
402
|
|
100967
|
my $self = shift; |
|
96
|
402
|
|
|
|
|
905
|
my $sub = lc( $AUTOLOAD ); |
|
97
|
402
|
|
|
|
|
2567
|
$sub =~ s/.*:://; |
|
98
|
402
|
50
|
|
|
|
4801
|
if ( grep /$sub/, @OAI_DC_ELEMENTS ) { |
|
99
|
402
|
50
|
|
|
|
854
|
if ( wantarray() ) { |
|
100
|
0
|
|
|
|
|
0
|
return( @{ $self->{ $sub } } ); |
|
|
0
|
|
|
|
|
0
|
|
|
101
|
|
|
|
|
|
|
} else { |
|
102
|
402
|
|
|
|
|
2525
|
return( $self->{ $sub }[0] ); |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
} |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
## generic output method |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub asString { |
|
110
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
111
|
0
|
|
|
|
|
0
|
my @result; |
|
112
|
0
|
|
|
|
|
0
|
foreach my $element ( @OAI_DC_ELEMENTS ) { |
|
113
|
0
|
0
|
|
|
|
0
|
next unless $self->{ $element }; |
|
114
|
0
|
|
|
|
|
0
|
foreach ( @{ $self->{ $element } } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
115
|
0
|
|
|
|
|
0
|
push(@result, "$element => $_"); |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
} |
|
118
|
0
|
|
|
|
|
0
|
return join("\n", @result); |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
## SAX handlers |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub start_element { |
|
124
|
14915
|
|
|
14915
|
1
|
104695
|
my ( $self, $element ) = @_; |
|
125
|
14915
|
100
|
|
|
|
44326
|
if ( $element->{ Name } eq 'metadata' ) { |
|
126
|
601
|
|
|
|
|
1353
|
$self->{ insideMetadata } = 1; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
14915
|
|
|
|
|
49303
|
$self->{ chars } = ''; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub end_element { |
|
132
|
14915
|
|
|
14915
|
1
|
98304
|
my ( $self, $element ) = @_; |
|
133
|
|
|
|
|
|
|
## strip namespace from element name |
|
134
|
14915
|
|
|
|
|
83988
|
my ( $elementName ) = ( $element->{ Name } =~ /^(?:.*:)?(.*)$/ ); |
|
135
|
14915
|
100
|
|
|
|
35707
|
if ( $elementName eq 'metadata' ) { |
|
136
|
601
|
|
|
|
|
1315
|
$self->{ insideMetadata } = undef; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
14915
|
100
|
|
|
|
38168
|
if ( $self->{ insideMetadata } ) { |
|
139
|
12500
|
|
|
|
|
14210
|
push( @{ $self->{ $elementName } }, $self->{ chars } ); |
|
|
12500
|
|
|
|
|
72761
|
|
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub characters { |
|
144
|
30126
|
|
|
30126
|
1
|
209986
|
my ( $self, $characters ) = @_; |
|
145
|
30126
|
|
|
|
|
167941
|
$self->{ chars } .= $characters->{ Data }; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
1; |
|
149
|
|
|
|
|
|
|
|