Net::StackExchange - Access Stack Exchange API from Perl
version 0.102740
use Net::StackExchange; my $se = Net::StackExchange->new( { 'network' => 'stackoverflow.com', 'version' => '1.0', } ); my $answers_route = $se->route('answers'); my $answers_request = $answers_route->prepare_request( { 'id' => '1036353' } ); $answers_request->body(1); my $answers_response = $answers_request ->execute( ); my $answer = $answers_response->answers(0); print "__Answer__\n"; print "Title: ", $answer->title(), "\n"; print "Body: ", $answer->body (), "\n";
new
Accepts a hash reference with network and version as keys. Returns a Net::StackExchange object.
network
version
Sets the network to which API requests should be sent. Valid values are:
stackoverflow.com serverfault.com meta.stackoverflow.com superuser.com stackapps.com webapps.stackexchange.com gaming.stackexchange.com webmasters.stackexchange.com cooking.stackexchange.com gamedev.stackexchange.com gadgets.stackexchange.com photo.stackexchange.com stats.stackexchange.com math.stackexchange.com diy.stackexchange.com gis.stackexchange.com tex.stackexchange.com ubuntu.stackexchange.com money.stackexchange.com english.stackexchange.com ui.stackexchange.com unix.stackexchange.com wordpress.stackexchange.com cstheory.stackexchange.com apple.stackexchange.com rpg.stackexchange.com
Sets the API version. Defaults to 1.0.
1.0
route
Returns a Net::StackExchange::Route object depending on the route that is passed to it. Valid routes are:
answers
Incomplete implementation. Interface may change.
Alan Haggai Alavi <alanhaggai@alanhaggai.org>
This software is copyright (c) 2010 by Alan Haggai Alavi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::StackExchange, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::StackExchange
CPAN shell
perl -MCPAN -e shell install Net::StackExchange
For more information on module installation, please visit the detailed CPAN module installation guide.