NewsML_G2/AnyItem.pm

filter: Statementstmt 98.0% 50 / 51 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.8% 13 / 14 Podpod 0.0% 0 / 2 totaltotal 94.2% 65 / 69 CC 2 SCAR 1.8
CC
2
Cov
98%
_build_guid
2.0
_attr_zombie_lifter
2.0
BEGIN
1.0
CRAP 1.2
« NewsML_G2/Types.pm ↑ Summary NewsML_G2/Package_Item.pm »
1 package XML::NewsML_G2::AnyItem;
2  
3 31 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 31 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 31 ▶use UUID::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 31 ▶use XML::NewsML_G2::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 31 ▶use XML::NewsML_G2::Link;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 31 has 'guid', isa => 'Str', is => 'ro', lazy => 1, builder => '_build_guid';
11 31 has 'doc_version', isa => 'Int', is => 'ro', default => '1';
12 31 has 'language', isa => 'Str', is => 'ro', required => 1;
13 31 has 'nature',
14 isa => 'XML::NewsML_G2::Types::Nature',
15 is => 'ro',
16 required => 1;
17 31 has 'provider', isa => 'XML::NewsML_G2::Provider', is => 'ro', required => 1;
18 31 has 'copyright_holder', isa => 'XML::NewsML_G2::Copyright_Holder', is => 'ro';
19 31 has 'usage_terms', isa => 'Str', is => 'rw';
20  
21 31 has 'service',
22 isa => 'XML::NewsML_G2::Service',
23 is => 'ro',
24 predicate => 'has_service';
25 31 has 'doc_status', isa => 'Str', is => 'ro', default => 'usable';
26  
27 31 has 'note', isa => 'Str', is => 'rw';
28 31 has 'closing', isa => 'Str', is => 'rw';
29  
30 has 'see_alsos',
31 isa => 'XML::NewsML_G2::ArrayRefOfLinks',
32 is => 'rw',
33 38 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
34 31 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 38 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
41 31 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 38 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
48 31 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 38 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
55 31 coerce => 1,
56 traits => ['Array'],
57 handles => { add_evolved_from => 'push' };
58  
59 31 has 'embargo', isa => 'DateTime', is => 'rw';
60 31 has 'embargo_text', isa => 'Str', is => 'rw';
61  
62 has 'indicators',
63 isa => 'ArrayRef[Str]',
64 is => 'rw',
65 38 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
66 31 traits => ['Array'],
67 handles => { add_indicator => 'push' };
68  
69 31 has 'timezone', is => 'ro', isa => 'Str', default => 'local';
70  
71 0 ▶sub _build_guid {
Subroutine _build_guid: not called CC=1 SCAR=6.9
72 0 return UUID::Tiny::create_uuid_as_string();
73 }
74  
75 4 ▶sub _attr_zombie_lifter {
Subroutine _attr_zombie_lifter: called CC=2 SCAR=6.9
76 4 my ( $self, $attr, $value ) = @_;
77  
78 4 my $adder = "add_$attr";
79 4 my $getter = $attr . 's';
80 4 warnings::warnif( 'deprecated',
81 "$attr is deprecated - use $adder / $getter instead" );
82  
83 4 ▶ return defined $value ? $self->$adder($value) : $self->$getter->[0];
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 2 2 4
84 }
85  
86 2 ▶sub see_also {
Subroutine see_also: called CC=1 SCAR=0.0
Pod undocumented
87 2 my ( $self, $value ) = @_;
88 2 return $self->_attr_zombie_lifter( 'see_also', $value );
89 }
90  
91 2 ▶sub derived_from {
Subroutine derived_from: called CC=1 SCAR=0.0
Pod undocumented
92 2 my ( $self, $value ) = @_;
93 2 return $self->_attr_zombie_lifter( 'derived_from', $value );
94 }
95  
96 31 __PACKAGE__->meta->make_immutable;
97  
98 31 1;
99 __END__
« NewsML_G2/Types.pm ↑ Summary NewsML_G2/Package_Item.pm »