line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2009, 2010 Oleksandr Tymoshenko <gonzo@bluezbox.com> |
2
|
|
|
|
|
|
|
# All rights reserved. |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# Redistribution and use in source and binary forms, with or without |
5
|
|
|
|
|
|
|
# modification, are permitted provided that the following conditions |
6
|
|
|
|
|
|
|
# are met: |
7
|
|
|
|
|
|
|
# 1. Redistributions of source code must retain the above copyright |
8
|
|
|
|
|
|
|
# notice, this list of conditions and the following disclaimer. |
9
|
|
|
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright |
10
|
|
|
|
|
|
|
# notice, this list of conditions and the following disclaimer in the |
11
|
|
|
|
|
|
|
# documentation and/or other materials provided with the distribution. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
14
|
|
|
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15
|
|
|
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
16
|
|
|
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
17
|
|
|
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18
|
|
|
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
19
|
|
|
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
20
|
|
|
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
21
|
|
|
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
22
|
|
|
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
23
|
|
|
|
|
|
|
# SUCH DAMAGE. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
package EBook::FB2::Description::DocumentInfo; |
26
|
1
|
|
|
1
|
|
2047
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use EBook::FB2::Description::Author; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has [qw/program_used date src_ocr id version history/] => (isa => 'Str', is => 'rw'); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has _authors => ( |
33
|
|
|
|
|
|
|
isa => 'ArrayRef', |
34
|
|
|
|
|
|
|
is => 'ro', |
35
|
|
|
|
|
|
|
traits => ['Array'], |
36
|
|
|
|
|
|
|
default => sub { [] }, |
37
|
|
|
|
|
|
|
handles => { |
38
|
|
|
|
|
|
|
authors => 'elements', |
39
|
|
|
|
|
|
|
add_author => 'push', |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has _src_urls => ( |
44
|
|
|
|
|
|
|
isa => 'ArrayRef', |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
traits => ['Array'], |
47
|
|
|
|
|
|
|
default => sub { [] }, |
48
|
|
|
|
|
|
|
handles => { |
49
|
|
|
|
|
|
|
src_urls => 'elements', |
50
|
|
|
|
|
|
|
add_src_url => 'push', |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has _publishers => ( |
55
|
|
|
|
|
|
|
isa => 'ArrayRef', |
56
|
|
|
|
|
|
|
is => 'ro', |
57
|
|
|
|
|
|
|
traits => ['Array'], |
58
|
|
|
|
|
|
|
default => sub { [] }, |
59
|
|
|
|
|
|
|
handles => { |
60
|
|
|
|
|
|
|
publishers => 'elements', |
61
|
|
|
|
|
|
|
add_publisher => 'push', |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub load |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
my ($self, $node) = @_; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my @nodes = $node->findnodes('author'); |
71
|
|
|
|
|
|
|
foreach my $author_node (@nodes) { |
72
|
|
|
|
|
|
|
my $author = EBook::FB2::Description::Author->new; |
73
|
|
|
|
|
|
|
$author->load($author_node); |
74
|
|
|
|
|
|
|
$self->add_author($author); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
@nodes = $node->findnodes('program-used'); |
78
|
|
|
|
|
|
|
if (@nodes) { |
79
|
|
|
|
|
|
|
$self->program_used($nodes[0]->string_value()); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
@nodes = $node->findnodes('date'); |
83
|
|
|
|
|
|
|
if (@nodes == 0) { |
84
|
|
|
|
|
|
|
warn "Wrong number of <date> elements in <document-info>"; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
if (@nodes) { |
87
|
|
|
|
|
|
|
$self->date($nodes[0]->string_value()); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
@nodes = $node->findnodes('id'); |
91
|
|
|
|
|
|
|
if (@nodes == 0) { |
92
|
|
|
|
|
|
|
warn "Wrong number of <id> elements in <document-info>"; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
if (@nodes) { |
95
|
|
|
|
|
|
|
$self->id($nodes[0]->string_value()); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
@nodes = $node->findnodes('src-url'); |
99
|
|
|
|
|
|
|
foreach my $src_url_node (@nodes) { |
100
|
|
|
|
|
|
|
$self->add_src_url($src_url_node->string_value()); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
@nodes = $node->findnodes('src-ocr'); |
104
|
|
|
|
|
|
|
if (@nodes) { |
105
|
|
|
|
|
|
|
$self->src_ocr($nodes[0]->string_value()); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
@nodes = $node->findnodes('history'); |
109
|
|
|
|
|
|
|
if (@nodes) { |
110
|
|
|
|
|
|
|
$self->history($nodes[0]->string_value()); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
@nodes = $node->findnodes('version'); |
114
|
|
|
|
|
|
|
if (@nodes) { |
115
|
|
|
|
|
|
|
$self->version($nodes[0]->string_value()); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
@nodes = $node->findnodes('publisher'); |
121
|
|
|
|
|
|
|
foreach my $publisher_node (@nodes) { |
122
|
|
|
|
|
|
|
$self->add_publisher($publisher_node->string_value()); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |
129
|
|
|
|
|
|
|
=head1 NAME |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
EBook::FB2::Description::DocumentInfo |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SYNOPSIS |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
EBook::FB2::Description::DocumentInfo - document metadata |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over 4 |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item authors() |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Returns creators, list of references to L<EBook::FB2::Description::Author> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item date() |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Returns document creation/modification date |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=item history() |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns document history |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item id() |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Returns document id |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item program_used() |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Returns program that has been used for generating this document |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item publishers() |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Returns list of publishers |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item src_ocr() |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns author of original OCR |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item src_urls() |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Return list of URLs |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item version() |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Returns document version |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=back |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 AUTHOR |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Oleksandr Tymoshenko, E<lt>gonzo@bluezbox.comE<gt> |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 BUGS |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Please report any bugs or feature requests to E<lt>gonzo@bluezbox.comE<gt> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Copyright 2009, 2010 Oleksandr Tymoshenko. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
L<http://bluezbox.com> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This module is free software; you can redistribute it and/or |
194
|
|
|
|
|
|
|
modify it under the terms of the BSD license. See the F<LICENSE> file |
195
|
|
|
|
|
|
|
included with this distribution. |