File Coverage

blib/lib/WWW/WolframAlpha/StateList.pm
Criterion Covered Total %
statement 12 34 35.2
branch 0 8 0.0
condition 0 6 0.0
subroutine 4 8 50.0
pod 0 4 0.0
total 16 60 26.6


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