FB2/Description/PublishInfo.pm

filter: Statementstmt 29.0% 9 / 31 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 0.0% 0 / 1 totaltotal 23.9% 11 / 46 CC 7 SCAR 36.8
CC
7
Cov
22%
load
56.0
__ANON__
2.0
BEGIN
1.0
CRAP 39.6
« FB2/Description.pm ↑ Summary FB2/Binary.pm »
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::PublishInfo;
26 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 1 ▶use EBook::FB2::Description::Sequence;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 1 has [qw/book_name publisher city year isbn/] => (isa => 'Str', is => 'rw');
31  
32 has _sequences => (
33 isa => 'ArrayRef',
34 is => 'ro',
35 traits => ['Array'],
36 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
37 1 handles => {
38 sequences => 'elements',
39 add_sequence => 'push',
40 },
41 );
42  
43 sub load
44 0 ▶{
Subroutine load: not called CC=7 SCAR=40.3
Pod undocumented
45 0 my ($self, $node) = @_;
46  
47 0 my @nodes = $node->findnodes('book-name');
48 0 ▶ if (@nodes) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes) 0 0 0
49 0 $self->book_name($nodes[0]->string_value());
50 }
51  
52 0 @nodes = $node->findnodes('publisher');
53 0 ▶ if (@nodes) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes) 0 0 0
54 0 $self->publisher($nodes[0]->string_value());
55 }
56  
57 0 @nodes = $node->findnodes('city');
58 0 ▶ if (@nodes) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes) 0 0 0
59 0 $self->city($nodes[0]->string_value());
60 }
61  
62 0 @nodes = $node->findnodes('year');
63 0 ▶ if (@nodes) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes) 0 0 0
64 0 $self->year($nodes[0]->string_value());
65 }
66  
67 0 @nodes = $node->findnodes('isbn');
68 0 ▶ if (@nodes) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes) 0 0 0
69 0 $self->isbn($nodes[0]->string_value());
70 }
71  
72 0 @nodes = $node->findnodes('sequence');
73 0 foreach my $node (@nodes) {
74 0 my $seq = EBook::FB2::Description::Sequence->new();
75 0 $seq->load($node);
76 0 $self->add_sequence($seq);
77 }
78 }
79  
80 1 1;
81  
82 __END__
« FB2/Description.pm ↑ Summary FB2/Binary.pm »