blib/lib/XML/NewsML_G2/AnyItem.pm

filter: Statementstmt 98.0% 49 / 50 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.8% 13 / 14 Podpod 0.0% 0 / 2 totaltotal 94.1% 64 / 68 CC 2 SCAR 1.8
CC
2
Cov
98%
_build_guid
2.0
_attr_zombie_lifter
2.0
BEGIN
1.0
CRAP 1.2
« blib/lib/XML/NewsML_G2/Role/Writer_2_12.pm ↑ Summary blib/lib/XML/NewsML_G2/Package_Item.pm »
1 package XML::NewsML_G2::AnyItem;
2  
3 27 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 27 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 27 ▶use UUID::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 27 ▶use XML::NewsML_G2::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 27 ▶use XML::NewsML_G2::Link;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 27 has 'guid', isa => 'Str', is => 'ro', lazy => 1, builder => '_build_guid';
11 27 has 'doc_version', isa => 'Int', is => 'ro', default => '1';
12 27 has 'language', isa => 'Str', is => 'ro', required => 1;
13 27 has 'nature',
14 isa => 'XML::NewsML_G2::Types::Nature',
15 is => 'ro',
16 required => 1;
17 27 has 'provider', isa => 'XML::NewsML_G2::Provider', is => 'ro', required => 1;
18 27 has 'copyright_holder', isa => 'XML::NewsML_G2::Copyright_Holder', is => 'ro';
19 27 has 'usage_terms', isa => 'Str', is => 'rw';
20  
21 27 has 'service',
22 isa => 'XML::NewsML_G2::Service',
23 is => 'ro',
24 predicate => 'has_service';
25 27 has 'doc_status', isa => 'Str', is => 'ro', default => 'usable';
26  
27 27 has 'note', isa => 'Str', is => 'rw';
28 27 has 'closing', isa => 'Str', is => 'rw';
29  
30 has 'see_alsos',
31 isa => 'XML::NewsML_G2::ArrayRefOfLinks',
32 is => 'rw',
33 19 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
34 27 coerce => 1,
35 traits => ['Array'],
36 handles => { add_see_also => 'push' };
37 has 'derived_froms',
38 isa => 'XML::NewsML_G2::ArrayRefOfLinks',
39 is => 'rw',
40 19 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
41 27 coerce => 1,
42 traits => ['Array'],
43 handles => { add_derived_from => 'push' };
44 has 'processed_froms',
45 isa => 'XML::NewsML_G2::ArrayRefOfLinks',
46 is => 'rw',
47 19 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
48 27 coerce => 1,
49 traits => ['Array'],
50 handles => { add_processed_from => 'push' };
51 has 'evolved_froms',
52 isa => 'XML::NewsML_G2::ArrayRefOfLinks',
53 is => 'rw',
54 19 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
55 27 coerce => 1,
56 traits => ['Array'],
57 handles => { add_evolved_from => 'push' };
58  
59 27 has 'embargo', isa => 'DateTime', is => 'rw';
60 27 has 'embargo_text', isa => 'Str', is => 'rw';
61  
62 has 'indicators',
63 isa => 'ArrayRef[Str]',
64 is => 'rw',
65 19 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
66 27 traits => ['Array'],
67 handles => { add_indicator => 'push' };
68  
69 sub _build_guid {
70 0 ▶ return UUID::Tiny::create_uuid_as_string();
Subroutine _build_guid: not called CC=1 SCAR=6.9
71 }
72  
73 sub _attr_zombie_lifter {
74 4 ▶ my ( $self, $attr, $value ) = @_;
Subroutine _attr_zombie_lifter: called CC=2 SCAR=6.9
75  
76 4 my $adder = "add_$attr";
77 4 my $getter = $attr . 's';
78 4 warnings::warnif( 'deprecated',
79 "$attr is deprecated - use $adder / $getter instead" );
80  
81 4 ▶ return defined $value ? $self->$adder($value) : $self->$getter->[0];
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 2 2 4
82 }
83  
84 sub see_also {
85 2 ▶ my ( $self, $value ) = @_;
Subroutine see_also: called CC=1 SCAR=0.0
Pod undocumented
86 2 return $self->_attr_zombie_lifter( 'see_also', $value );
87 }
88  
89 sub derived_from {
90 2 ▶ my ( $self, $value ) = @_;
Subroutine derived_from: called CC=1 SCAR=0.0
Pod undocumented
91 2 return $self->_attr_zombie_lifter( 'derived_from', $value );
92 }
93  
94 27 __PACKAGE__->meta->make_immutable;
95  
96 27 1;
97 __END__
98  
99 =head1 NAME
100  
101 XML::NewsML_G2::AnyItem - base class for news and package items
102  
103 =head1 DESCRIPTION
104  
105 This module acts as a base class for NewsML-G2 news items and package
106 items. For a documentation of the attributes it provides, please see
107 L<XML::NewsML_G2::News_Item>.
108  
109  
110 =head1 AUTHOR
111  
112 Philipp Gortan C<< <philipp.gortan@apa.at> >>
113  
114 =head1 LICENCE AND COPYRIGHT
115  
116 Copyright (c) 2014-2015, APA-IT. All rights reserved.
117  
118 See L<XML::NewsML_G2> for the license.
« blib/lib/XML/NewsML_G2/Role/Writer_2_12.pm ↑ Summary blib/lib/XML/NewsML_G2/Package_Item.pm »