| line | stmt | bran | cond | sub | pod | time | code | 
| 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 | 5 |  |  | 5 |  | 38 | use strict; | 
|  | 5 |  |  |  |  | 11 |  | 
|  | 5 |  |  |  |  | 155 |  | 
| 10 | 5 |  |  | 5 |  | 65 | use warnings; | 
|  | 5 |  |  |  |  | 14 |  | 
|  | 5 |  |  |  |  | 145 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 5 |  |  | 5 |  | 28 | use Moose; | 
|  | 5 |  |  |  |  | 12 |  | 
|  | 5 |  |  |  |  | 42 |  | 
| 13 | 5 |  |  | 5 |  | 39542 | use DateTime; | 
|  | 5 |  |  |  |  | 2199361 |  | 
|  | 5 |  |  |  |  | 276 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 5 |  |  | 5 |  | 2823 | use Net::Songkick::Types; | 
|  | 5 |  |  |  |  | 23 |  | 
|  | 5 |  |  |  |  | 232 |  | 
| 16 | 5 |  |  | 5 |  | 2911 | use Net::Songkick::Location; | 
|  | 5 |  |  |  |  | 18 |  | 
|  | 5 |  |  |  |  | 206 |  | 
| 17 | 5 |  |  | 5 |  | 2567 | use Net::Songkick::Performance; | 
|  | 5 |  |  |  |  | 18 |  | 
|  | 5 |  |  |  |  | 226 |  | 
| 18 | 5 |  |  | 5 |  | 2931 | use Net::Songkick::Venue; | 
|  | 5 |  |  |  |  | 23 |  | 
|  | 5 |  |  |  |  | 1351 |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | has $_ => ( | 
| 21 |  |  |  |  |  |  | is => 'ro', | 
| 22 |  |  |  |  |  |  | isa => 'Str|Undef', | 
| 23 |  |  |  |  |  |  | ) for qw(type status uri displayName popularity id ageRestriction); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | has location => ( | 
| 26 |  |  |  |  |  |  | is => 'ro', | 
| 27 |  |  |  |  |  |  | isa => 'Net::Songkick::Location', | 
| 28 |  |  |  |  |  |  | coerce => 1, | 
| 29 |  |  |  |  |  |  | ); | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | has performance => ( | 
| 32 |  |  |  |  |  |  | is => 'ro', | 
| 33 |  |  |  |  |  |  | isa => 'ArrayRef[Net::Songkick::Performance]', | 
| 34 |  |  |  |  |  |  | ); | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | has start => ( | 
| 37 |  |  |  |  |  |  | is => 'ro', | 
| 38 |  |  |  |  |  |  | isa => 'Net::Songkick::DateTime', | 
| 39 |  |  |  |  |  |  | coerce => 1, | 
| 40 |  |  |  |  |  |  | ); | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | has end => ( | 
| 43 |  |  |  |  |  |  | is => 'ro', | 
| 44 |  |  |  |  |  |  | isa => 'Net::Songkick::DateTime', | 
| 45 |  |  |  |  |  |  | coerce => 1, | 
| 46 |  |  |  |  |  |  | ); | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | has venue => ( | 
| 49 |  |  |  |  |  |  | is => 'ro', | 
| 50 |  |  |  |  |  |  | isa => 'Net::Songkick::Venue', | 
| 51 |  |  |  |  |  |  | coerce => 1, | 
| 52 |  |  |  |  |  |  | ); | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | around BUILDARGS => sub { | 
| 55 |  |  |  |  |  |  | my $orig  = shift; | 
| 56 |  |  |  |  |  |  | my $class = shift; | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | my %args; | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | if (@_ == 1) { | 
| 61 |  |  |  |  |  |  | %args = %{$_[0]}; | 
| 62 |  |  |  |  |  |  | } else { | 
| 63 |  |  |  |  |  |  | %args = @_; | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | if (exists $args{start} and not $args{start}) { | 
| 67 |  |  |  |  |  |  | $args{start} = DateTime->new_from_epoch(epoch => 0); | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | if (exists $args{performance}) { | 
| 71 |  |  |  |  |  |  | foreach (@{$args{performance}}) { | 
| 72 |  |  |  |  |  |  | if (ref $_ ne 'Net::Songkick::Performance') { | 
| 73 |  |  |  |  |  |  | $_ = Net::Songkick::Performance->new($_); | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  | } | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | $class->$orig(\%args); | 
| 79 |  |  |  |  |  |  | }; | 
| 80 |  |  |  |  |  |  |  | 
| 81 | 5 |  |  | 5 |  | 54 | no Moose; | 
|  | 5 |  |  |  |  | 14 |  | 
|  | 5 |  |  |  |  | 35 |  | 
| 82 |  |  |  |  |  |  | __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 |  |  |  |  |  |  | 1; |