Songkick/Event.pm

filter: Statementstmt 96.0% 49 / 51 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 86.4% 64 / 74 CC 7 SCAR 14.5
CC
7
Cov
87%
__ANON__
8.4
BEGIN
1.0
BEGIN
1.0
CRAP 4.2
« Songkick.pm ↑ Summary Songkick/Artist.pm »
1 =head1 NAME
2  
3 Net::Songkick::Event - Models an event in the Songkick API
4  
5 =cut
6  
7 package Net::Songkick::Event;
8  
9 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶use Net::Songkick::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶use Net::Songkick::Location;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 6 ▶use Net::Songkick::Performance;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 6 ▶use Net::Songkick::Venue;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 has $_ => (
21 is => 'ro',
22 isa => 'Str|Undef',
23 6 ) for qw(type status uri displayName popularity id ageRestriction);
24  
25 6 has location => (
26 is => 'ro',
27 isa => 'Net::Songkick::Location',
28 coerce => 1,
29 );
30  
31 6 has performance => (
32 is => 'ro',
33 isa => 'ArrayRef[Net::Songkick::Performance]',
34 );
35  
36 6 has start => (
37 is => 'ro',
38 isa => 'Net::Songkick::DateTime',
39 coerce => 1,
40 );
41  
42 6 has end => (
43 is => 'ro',
44 isa => 'Net::Songkick::DateTime',
45 coerce => 1,
46 );
47  
48 6 has venue => (
49 is => 'ro',
50 isa => 'Net::Songkick::Venue',
51 coerce => 1,
52 );
53  
54 3 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=7 SCAR=21.3
55 3 my $orig = shift;
56 3 my $class = shift;
57  
58 3 my %args;
59  
60 3 ▶ if (@_ == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 3 0 3
61 3 %args = %{$_[0]};
62 } else {
63 0 %args = @_;
64 }
65  
66 3 ▶ if (exists $args{start} and not $args{start}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"start"} and not $args{"start"}) 0 3 3
Condition33%1/3
exists $args{"start"} and not $args{"start"}
!ll&&!rl&&r
030
MC/DC0%0/2
exists $args{"start"} and not $args{"start"}
exists $args{"start"} not $args{"start"}
Truth table33%1/3
A and not(B)
A= exists $args{"start"}B= not $args{"start"}
ABresult
0X0
100
111
67 0 $args{start} = DateTime->new_from_epoch(epoch => 0);
68 }
69  
70 3 ▶ if (exists $args{performance}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"performance"}) 3 0 3
71 3 foreach (@{$args{performance}}) {
72 3 ▶ if (ref $_ ne 'Net::Songkick::Performance') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_ ne "Net::Songkick::Performance") 3 0 3
73 3 $_ = Net::Songkick::Performance->new($_);
74 }
75 }
76 }
77
78 3 $class->$orig(\%args);
79 6 };
80  
81 6 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 6 __PACKAGE__->meta->make_immutable;
83  
84 =head1 AUTHOR
85  
86 Dave Cross <dave@perlhacks.com>
87  
88 =head1 SEE ALSO
89  
90 perl(1), L<http://www.songkick.com/>, L<http://developer.songkick.com/>
91  
92 =head1 COPYRIGHT AND LICENSE
93  
94 Copyright (C) 2010, Magnum Solutions Ltd. All Rights Reserved.
95  
96 This script is free software; you can redistribute it and/or modify it
97 under the same terms as Perl itself.
98  
99 =cut
100  
101 6 1;
« Songkick.pm ↑ Summary Songkick/Artist.pm »