Gabriel Weinberg > WWW-WolframAlpha > WWW::WolframAlpha

Download:
WWW-WolframAlpha-1.10.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.10   Source  

NAME ^

WWW::WolframAlpha

VERSION ^

version 1.10

SYNOPSIS ^

  use WWW::WolframAlpha;

  my $wa = WWW::WolframAlpha->new (
    appid => 'XXX',
  );

  my $query = $wa->query(
    input => 'Pi',
  );

  if ($query->success) {
    foreach my $pod (@{$query->pods}) {     
      ...
    }
  }

DESCRIPTION ^

See the included example.*.pl files for full working examples.

Access to this module is strictly OO. Pass your appid to the constructor, which is the only parameter needed.

There are three functions available, query, validatequery and asyncPod, which match the API calls.

Pass any desired input paramters to the function calls. The 'input' parameter is required.

Each function call returns objects, of the forms WWW::WolframAlpha::Query, WWW::WolframAlpha::ValidateQuery and WWW::WolframAlpha::Pod, respectively.

See the WolframAlpha API docs for details on the overall API, what parameters you can input and what you can expect in response.

All the attributes and elements detailed in the API docs are available via the returned objects. See the documentation in WWW::WolframAlpha::Query, WWW::WolframAlpha::ValidateQuery, WWW::WolframAlpha::Pod and other sub-packages for details on what methods are available for particular objects.

ERROR HANDLING

If there are errors contacting WA, $wa->error will be set to 1 and $wa->errmsg should give you some indication of what is going on.

Errors returned by WA are handled within the objects themselves via success and error methods (see example.*.pl files).

DEBUGGING

For debugging, the raw XML output and the internal Perl object used (via XML::Simple) are available via the xml and xmlo methods. However, please don't rely on these, i.e. only use them for debugging.

EXPORT

None by default.

NAME ^

WWW::WolframAlpha - Perl extension for the WolframAlpha API

SEE ALSO ^

WWW::WolframAlpha requires XML::Simple, LWP::UserAgent, URI::Escape and HTTP::Request::Common.

http://www.wolframalpha.com/

AUTHOR ^

Gabriel Weinberg, <yegg@alum.mit.edu>

COPYRIGHT AND LICENSE ^

Copyright (C) 2009 by Gabriel Weinberg

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

AUTHOR ^

Gabriel Weinberg <yegg@alum.mit.edu>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2009 by Gabriel Weinberg.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: