line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EVDB::API::REST; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2941
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
73
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
405
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
EVDB::API::REST - Use the REST flavor of the Eventful API |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $evdb = EVDB::API->new(app_key => $app_key); |
13
|
|
|
|
|
|
|
my $results = $evdb->call('events/get', { id => 'E0-001-001336058-5' }); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Parses XML from the Eventful API. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 flavor |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Return the flavor name. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
4
|
1
|
29
|
sub flavor { 'rest' } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 ctype |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Return a checkstring for the expected return content type. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
1
|
4
|
sub ctype { 'xml' } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 parse |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Parse XML data from the Eventful API using L or |
40
|
|
|
|
|
|
|
L. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub parse { |
45
|
1
|
|
|
1
|
1
|
4
|
my ($class, $data, $force_array) = @_; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
3
|
eval { require XML::Twig }; |
|
1
|
|
|
|
|
463
|
|
48
|
1
|
50
|
|
|
|
7
|
if ($@) { |
49
|
1
|
|
|
|
|
800
|
require XML::Simple; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $xs = XML::Simple->new( |
52
|
|
|
|
|
|
|
KeyAttr => [], |
53
|
|
|
|
|
|
|
SuppressEmpty => '', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $xs->XMLin($data, ForceArray => $force_array); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else { |
59
|
0
|
|
|
|
|
|
my $twig = XML::Twig->new; |
60
|
0
|
|
|
|
|
|
$twig->parse($data); |
61
|
0
|
|
|
|
|
|
my $parsed = $twig->simplify(keyattr => [], forcearray => $force_array); |
62
|
0
|
|
|
|
|
|
$twig->purge; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return $parsed; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 AUTHORS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over 4 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * Daniel Westermann-Clark Edanieltwc@cpan.orgE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=back |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
79
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE ALSO |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * L |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * L |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=back |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |