File Coverage

blib/lib/WWW/WolframAlpha/Assumption.pm
Criterion Covered Total %
statement 12 36 33.3
branch 0 10 0.0
condition 0 8 0.0
subroutine 4 9 44.4
pod 0 5 0.0
total 16 68 23.5


line stmt bran cond sub pod time code
1             package WWW::WolframAlpha::Assumption;
2              
3 1     1   16 use 5.008008;
  1         3  
  1         40  
4 1     1   5 use strict;
  1         3  
  1         28  
5 1     1   4 use warnings;
  1         2  
  1         46  
6              
7             require Exporter;
8              
9 1     1   588 use WWW::WolframAlpha::AssumptionValue;
  1         3  
  1         411  
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           my ($count,$word,$type,$value);
37              
38 0 0         if ($xmlo) {
39 0   0       $count = $xmlo->{'count'} || undef;
40 0   0       $word = $xmlo->{'word'} || undef;
41 0   0       $type = $xmlo->{'type'} || undef;
42 0   0       $value = $xmlo->{'value'} || undef;
43              
44 0 0         $self->{'count'} = $count if defined $count;
45 0 0         $self->{'word'} = $word if defined $word;
46 0 0         $self->{'type'} = $type if defined $type;
47              
48 0 0         if (defined $value) {
49 0           @{$self->{'value'}} = ();
  0            
50 0           foreach my $val (@{$value}) {
  0            
51 0           push(@{$self->{'value'}}, WWW::WolframAlpha::AssumptionValue->new($val));
  0            
52             }
53             }
54             }
55              
56 0           return(bless($self, $class));
57             }
58              
59 0     0 0   sub count {shift->{'count'};}
60 0     0 0   sub word {shift->{'word'};}
61 0     0 0   sub type {shift->{'type'};}
62 0     0 0   sub value {shift->{'value'};}
63              
64              
65             # Preloaded methods go here.
66              
67             1;
68              
69              
70             =pod
71              
72             =head1 NAME
73              
74             WWW::WolframAlpha::Assumption
75              
76             =head1 VERSION
77              
78             version 1.10
79              
80             =head1 SYNOPSIS
81              
82             foreach my $assumption (@{$query->assumptions->assumption}) {
83             print "\n type: ", $assumption->type, "\n";
84             print " word: ", $assumption->word, "\n" if $assumption->word;
85             foreach my $value (@{$assumption->value}) {
86             ...
87             }
88             }
89              
90             =head1 DESCRIPTION
91              
92             =head2 ATTRIBUTES
93              
94             $assumption->type
95              
96             $assumption->word
97              
98             =head2 SECTOINS
99              
100             $assumption->value - array of L elements
101              
102             =head2 EXPORT
103              
104             None by default.
105              
106             =head1 NAME
107              
108             WWW::WolframAlpha::Assumption - Perl objects returned via $(?:validate|)query->assumption->assumption
109              
110             =head1 SEE ALSO
111              
112             L
113              
114             =head1 AUTHOR
115              
116             Gabriel Weinberg, Eyegg@alum.mit.eduE
117              
118             =head1 COPYRIGHT AND LICENSE
119              
120             Copyright (C) 2009 by Gabriel Weinberg
121              
122             This library is free software; you can redistribute it and/or modify
123             it under the same terms as Perl itself, either Perl version 5.8.8 or,
124             at your option, any later version of Perl 5 you may have available.
125              
126             =head1 AUTHOR
127              
128             Gabriel Weinberg
129              
130             =head1 COPYRIGHT AND LICENSE
131              
132             This software is copyright (c) 2009 by Gabriel Weinberg.
133              
134             This is free software; you can redistribute it and/or modify it under
135             the same terms as the Perl 5 programming language system itself.
136              
137             =cut
138              
139              
140             __END__