File Coverage

blib/lib/WebService/ClinicalTrialsdotGov/Parser.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package WebService::ClinicalTrialsdotGov::Parser;
2              
3 3     3   17 use strict;
  3         7  
  3         98  
4 3     3   16 use warnings;
  3         6  
  3         75  
5              
6 3     3   59 use Data::Dumper;
  3         6  
  3         156  
7 3     3   1653 use XML::Simple;
  0            
  0            
8             use Carp qw( cluck );
9              
10             =head1 NAME
11              
12             WebService::ClinicalTrialsdotGov::Parser - Wrapper around the clinicaltrials.gov API
13              
14             =head1 FUNCTIONS
15              
16             =head2 new
17              
18             Creates new instance of the parser object.
19             Do not use this function directly.
20              
21             =cut
22              
23             sub new {
24             my $class = shift;
25             my $self = { };
26            
27             bless $self, $class;
28            
29             $self->{xs} = XML::Simple->new();
30            
31             return $self;
32            
33             }
34              
35             =head2 parse
36              
37             Parses raw XML returned from the API.
38             Do not use this function directly.
39              
40             =cut
41              
42             sub parse {
43             my $self = shift;
44             my $raw = shift;
45            
46             return undef
47             unless ( defined $raw );
48            
49             return $self->{xs}->XMLin( $ raw );
50            
51             }
52              
53             =head1 AUTHOR
54              
55             Spiros Denaxas, C<< >>
56              
57             =head1 BUGS
58              
59             Please report any bugs or feature requests to C, or through
60             the web interface at L. I will be notified, and then you'll
61             automatically be notified of progress on your bug as I make changes.
62              
63              
64             =head1 SUPPORT
65              
66             You can find documentation for this module with the perldoc command.
67              
68             perldoc WebService::ClinicalTrialsdotGov
69              
70             You can also look for information at:
71              
72             =over 4
73              
74             =item * RT: CPAN's request tracker
75              
76             L
77              
78             =item * AnnoCPAN: Annotated CPAN documentation
79              
80             L
81              
82             =item * CPAN Ratings
83              
84             L
85              
86             =item * Search CPAN
87              
88             L
89              
90             =back
91              
92             =head1 COPYRIGHT & LICENSE
93              
94             Copyright 2010 Spiros Denaxas, all rights reserved.
95              
96             This program is free software; you can redistribute it and/or modify it
97             under the same terms as Perl itself.
98              
99              
100             =cut
101              
102             1;