line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::WolframAlpha::Pod; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
17
|
use 5.008008; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
514
|
use WWW::WolframAlpha::Subpod; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
10
|
1
|
|
|
1
|
|
569
|
use WWW::WolframAlpha::States; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
98
|
|
11
|
1
|
|
|
1
|
|
515
|
use WWW::WolframAlpha::Infos; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
12
|
1
|
|
|
1
|
|
604
|
use WWW::WolframAlpha::Sounds; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
13
|
1
|
|
|
1
|
|
6
|
use WWW::WolframAlpha::Error; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
766
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
18
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
19
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# This allows declaration use WWW::WolframAlpha ':all'; |
22
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
23
|
|
|
|
|
|
|
# will save memory. |
24
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
25
|
|
|
|
|
|
|
) ] ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT = qw( |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new { |
35
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
36
|
0
|
|
|
|
|
|
my $xmlo = shift; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $self = {}; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
@{$self->{'subpods'}} = (); |
|
0
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my ($title,$scanner,$position,$error,$numsubpods,$subpods,$states,$infos,$markup,$sounds,$async); |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->{'error'} = 1; |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ($xmlo) { |
47
|
0
|
|
0
|
|
|
|
$title = $xmlo->{'title'} || undef; |
48
|
0
|
|
0
|
|
|
|
$scanner = $xmlo->{'scanner'} || undef; |
49
|
0
|
|
0
|
|
|
|
$position = $xmlo->{'position'} || undef; |
50
|
0
|
|
0
|
|
|
|
$error = $xmlo->{'error'} || undef; |
51
|
0
|
|
0
|
|
|
|
$numsubpods = $xmlo->{'numsubpods'} || undef; |
52
|
0
|
|
0
|
|
|
|
$subpods = $xmlo->{'subpod'} || undef; |
53
|
0
|
|
0
|
|
|
|
$states = $xmlo->{'states'} || undef; |
54
|
0
|
|
0
|
|
|
|
$sounds = $xmlo->{'sounds'} || undef; |
55
|
0
|
|
0
|
|
|
|
$infos = $xmlo->{'infos'} || undef; |
56
|
0
|
|
0
|
|
|
|
$markup = $xmlo->{'markup'} || undef; |
57
|
0
|
|
0
|
|
|
|
$async = $xmlo->{'async'} || undef; |
58
|
|
|
|
|
|
|
|
59
|
0
|
0
|
|
|
|
|
$self->{'title'} = $title if defined $title; |
60
|
0
|
0
|
|
|
|
|
$self->{'scanner'} = $scanner if defined $scanner; |
61
|
0
|
0
|
|
|
|
|
$self->{'position'} = $position if defined $position; |
62
|
0
|
0
|
|
|
|
|
$self->{'numsubpods'} = $numsubpods if defined $numsubpods; |
63
|
0
|
0
|
|
|
|
|
$self->{'markup'} = $markup if defined $markup; |
64
|
0
|
0
|
|
|
|
|
$self->{'async'} = $async if defined $async; |
65
|
|
|
|
|
|
|
|
66
|
0
|
0
|
0
|
|
|
|
if (defined $error && $error eq 'false') { |
|
|
0
|
0
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->{'error'} = 0; |
68
|
|
|
|
|
|
|
} elsif (defined $error && $error ne 'false') { |
69
|
0
|
|
|
|
|
|
$self->{'error'} = WWW::WolframAlpha::Error->new($error); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if (defined $subpods) { |
73
|
0
|
|
|
|
|
|
foreach my $subpod (@{$subpods}) { |
|
0
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
push(@{$self->{'subpods'}}, WWW::WolframAlpha::Subpod->new($subpod)); |
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$self->{'states'} = WWW::WolframAlpha::States->new($states); |
80
|
0
|
|
|
|
|
|
$self->{'infos'} = WWW::WolframAlpha::Infos->new($infos); |
81
|
0
|
|
|
|
|
|
$self->{'sounds'} = WWW::WolframAlpha::Sounds->new($sounds); |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return(bless($self, $class)); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
0
|
0
|
|
sub title {shift->{'title'};} |
87
|
0
|
|
|
0
|
0
|
|
sub scanner {shift->{'scanner'};} |
88
|
0
|
|
|
0
|
0
|
|
sub position {shift->{'position'};} |
89
|
0
|
|
|
0
|
0
|
|
sub error {shift->{'error'};} |
90
|
0
|
|
|
0
|
0
|
|
sub numsubpods {shift->{'numsubpods'};} |
91
|
0
|
|
|
0
|
0
|
|
sub subpods {shift->{'subpods'};} |
92
|
0
|
|
|
0
|
0
|
|
sub states {shift->{'states'};} |
93
|
0
|
|
|
0
|
0
|
|
sub infos {shift->{'infos'};} |
94
|
0
|
|
|
0
|
0
|
|
sub markup {shift->{'markup'};} |
95
|
0
|
|
|
0
|
0
|
|
sub sounds {shift->{'sounds'};} |
96
|
0
|
|
|
0
|
0
|
|
sub async {shift->{'async'};} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Preloaded methods go here. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=pod |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 NAME |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
WWW::WolframAlpha::Pod |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 VERSION |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
version 1.10 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 SYNOPSIS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
foreach my $subpod (@{$pod->subpods}) { |
117
|
|
|
|
|
|
|
... |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
if ($pod->sounds->count) { |
121
|
|
|
|
|
|
|
... |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 DESCRIPTION |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 SUCCESS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
$pod->error - 0 or L, tells whether there was an error or not |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$pod->title |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$pod->scanner |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
$pod->position |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$pod->markup |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
$pod->async |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$pod->numsubpods |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 SECTOINS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
$pod->subpods - array of L elements |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
$pod->states - L object |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
$pod->sounds - L object |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$pod->infos - L object |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 EXPORT |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
None by default. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 NAME |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
WWW::WolframAlpha::Pod - Perl objects accessed via $query->pods |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SEE ALSO |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
L |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Gabriel Weinberg, Eyegg@alum.mit.eduE |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Copyright (C) 2009 by Gabriel Weinberg |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
175
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.8 or, |
176
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 AUTHOR |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Gabriel Weinberg |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This software is copyright (c) 2009 by Gabriel Weinberg. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
187
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=cut |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
__END__ |