File Coverage

blib/lib/WWW/WolframAlpha/States.pm
Criterion Covered Total %
statement 15 43 34.8
branch 0 8 0.0
condition 0 6 0.0
subroutine 5 9 55.5
pod 0 4 0.0
total 20 70 28.5


line stmt bran cond sub pod time code
1             package WWW::WolframAlpha::States;
2              
3 1     1   18 use 5.008008;
  1         4  
  1         43  
4 1     1   6 use strict;
  1         1  
  1         33  
5 1     1   5 use warnings;
  1         2  
  1         36  
6              
7             require Exporter;
8              
9 1     1   638 use WWW::WolframAlpha::State;
  1         3  
  1         45  
10 1     1   583 use WWW::WolframAlpha::StateList;
  1         2  
  1         387  
11              
12             our @ISA = qw(Exporter);
13              
14             # Items to export into callers namespace by default. Note: do not export
15             # names by default without a very good reason. Use EXPORT_OK instead.
16             # Do not simply export all your public functions/methods/constants.
17              
18             # This allows declaration use WWW::WolframAlpha ':all';
19             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20             # will save memory.
21             our %EXPORT_TAGS = ( 'all' => [ qw(
22             ) ] );
23              
24             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25              
26             our @EXPORT = qw(
27             );
28              
29             our $VERSION = '1.0';
30              
31             sub new {
32 0     0 0   my $class = shift;
33 0           my $xmlo = shift;
34              
35 0           my $self = {};
36              
37 0           $self->{'count'} = 0;
38              
39 0           my ($count,$states,$statelists);
40              
41 0           @{$self->{'state'}} = ();
  0            
42 0           @{$self->{'statelist'}} = ();
  0            
43              
44 0 0         if ($xmlo) {
45 0   0       $count = $xmlo->{'count'} || undef;
46 0   0       $states = $xmlo->{'state'} || undef;
47 0   0       $statelists = $xmlo->{'statelist'} || undef;
48              
49 0 0         $self->{'count'} = $count if defined $count;
50              
51 0 0         if (defined $states) {
52 0           foreach my $state (@{$states}) {
  0            
53 0           push(@{$self->{'state'}}, WWW::WolframAlpha::State->new($state));
  0            
54             }
55             }
56              
57 0 0         if (defined $statelists) {
58 0           foreach my $statelist (@{$statelists}) {
  0            
59 0           push(@{$self->{'statelist'}}, WWW::WolframAlpha::StateList->new($statelist));
  0            
60             }
61             }
62             }
63              
64              
65 0           return(bless($self, $class));
66             }
67              
68 0     0 0   sub count {shift->{'count'};}
69 0     0 0   sub state {shift->{'state'};}
70 0     0 0   sub statelist {shift->{'statelist'};}
71              
72             # Preloaded methods go here.
73              
74             1;
75              
76              
77             =pod
78              
79             =head1 NAME
80              
81             WWW::WolframAlpha::States
82              
83             =head1 VERSION
84              
85             version 1.10
86              
87             =head1 SYNOPSIS
88              
89             if ($pod->states->count) {
90             foreach my $state (@{$pod->states->state}) {
91             ...
92             }
93              
94             foreach my $statelist (@{$pod->states->statelist}) {
95             ...
96              
97             }
98             }
99              
100             =head1 DESCRIPTION
101              
102             =head2 ATTRIBUTES
103              
104             $states->count
105              
106             =head2 SECTOINS
107              
108             $states->state - array of L elements
109              
110             $states->statelist - array of L elements
111              
112             =head2 EXPORT
113              
114             None by default.
115              
116             =head1 NAME
117              
118             WWW::WolframAlpha::States - Perl object returned via $pod->states
119              
120             =head1 SEE ALSO
121              
122             L
123              
124             =head1 AUTHOR
125              
126             Gabriel Weinberg, Eyegg@alum.mit.eduE
127              
128             =head1 COPYRIGHT AND LICENSE
129              
130             Copyright (C) 2009 by Gabriel Weinberg
131              
132             This library is free software; you can redistribute it and/or modify
133             it under the same terms as Perl itself, either Perl version 5.8.8 or,
134             at your option, any later version of Perl 5 you may have available.
135              
136             =head1 AUTHOR
137              
138             Gabriel Weinberg
139              
140             =head1 COPYRIGHT AND LICENSE
141              
142             This software is copyright (c) 2009 by Gabriel Weinberg.
143              
144             This is free software; you can redistribute it and/or modify it under
145             the same terms as the Perl 5 programming language system itself.
146              
147             =cut
148              
149              
150             __END__