Open/Resource.pm

filter: Statementstmt 100% 56 / 56 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod n/a totaltotal 100% 76 / 76 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Open/MediaResource.pm ↑ Summary Open/Result.pm »
1 # -*- cperl; cperl-indent-level: 4 -*-
2 # Copyright (C) 2011-2021, Roland van Ipenburg
3 package WWW::NOS::Open::Resource v1.0.5;
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use 5.014000;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use Moose qw/has/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Moose::Util::TypeConstraints qw/enum/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use MooseX::Types::Moose qw/Undef/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 ▶use namespace::autoclean '-also' => qr/^__/sxm;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 4 ▶use WWW::NOS::Open::TypeDef qw(NOSDateTime NOSURI);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 Readonly::Scalar my $UNDER => q{_};
19 4 Readonly::Scalar my $GETTER => q{get};
20 4 Readonly::Scalar my $THUMB => q{thumbnail};
21 4 Readonly::Array my @THUMBS => qw(xs s m);
22 4 Readonly::Array my @RESOURCE_TYPES => qw(article video audio);
23  
24 4 has '_id' => (
25 'is' => 'ro',
26 'isa' => 'Int',
27 'reader' => 'get_id',
28 'init_arg' => 'id',
29 );
30  
31 4 my @types = qw(type);
32 4 ▶while ( my $type = shift @types ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $type = shift @types) 4 4 8
33 4 has $UNDER
34 . $type => (
35 'is' => 'ro',
36 'isa' => enum( [@RESOURCE_TYPES] ),
37 'reader' => $GETTER . $UNDER . $type,
38 'init_arg' => $type,
39 );
40 }
41  
42 4 my @strings = qw(title description);
43 4 ▶while ( my $string = shift @strings ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $string = shift @strings) 8 4 12
44 8 has $UNDER
45 . $string => (
46 'is' => 'ro',
47 'isa' => 'Str',
48 'reader' => $GETTER . $UNDER . $string,
49 'init_arg' => $string,
50 );
51 }
52  
53 4 my @dates = qw(published last_update);
54 4 ▶while ( my $date = shift @dates ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $date = shift @dates) 8 4 12
55 8 has $UNDER
56 . $date => (
57 'is' => 'ro',
58 'isa' => 'WWW::NOS::Open::TypeDef::NOSDateTime',
59 'coerce' => 1,
60 'reader' => $GETTER . $UNDER . $date,
61 'init_arg' => $date,
62 );
63 }
64  
65 4 my @uris = map { $THUMB . $UNDER . $_ } @THUMBS;
66 4 push @uris, q{link};
67 4 ▶while ( my $uri = shift @uris ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $uri = shift @uris) 16 4 20
68 16 has $UNDER
69 . $uri => (
70 'is' => 'ro',
71 'isa' => 'WWW::NOS::Open::TypeDef::NOSURI | Undef',
72 'coerce' => 1,
73 'reader' => $GETTER . $UNDER . $uri,
74 'init_arg' => $uri,
75 );
76 }
77  
78 has '_keywords' => (
79 'traits' => ['Array'],
80 'is' => 'ro',
81 'isa' => 'ArrayRef[Str]',
82 10 ▶ 'default' => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
83 4 'reader' => 'get_keywords',
84 'init_arg' => 'keywords',
85 );
86  
87 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
88  
89 4 __PACKAGE__->meta->make_immutable;
90  
91 4 1;
92  
93 __END__
« Open/MediaResource.pm ↑ Summary Open/Result.pm »