Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

About

This library is a little labour of love for two things dear to me : StackOverflow, a place where I've learned just so much, and Perl a cryptic language that's giving me perspective. I happen to be a long time C# developer so the whole thing was a -learn a language by building stuff- exercise. Any feedback and kind-insults are welcome. Please file them as issues on the github repository.

Examples

The API is designed to be a one to one mapping with the methods in the documentation. It also has some conventions to make the interface intuitive. See the documentation on metacpan, I've written examples and some design notes.

use Net::StackExchange2;
#For read-only methods.
my $se = Net::StackExchange2->new({site => 'stackoverflow'});

#OR

#for methods that require auth.
my $se = Net::StackExchange2->new(
    {site=>"stackoverflow", 
     access_token => '<THE ACCESS TOKEN>', 
     key => '<YOUR APP KEY>'
    }
);

my $ret =  $se->answers->answers_all({ order=> "desc", sort=>"votes" });
my $ret = $se->answers->answers(14586834);#pass one single ID
#or pass many in an array ref
my $ret = $se->answers->answers([4449779, 4477003]);

my $ret  = $se->search->search({tagged=>"perl"});

my $ret = $se->tags->tags_top_askers("perl", "month");

#filters are also supported. 

#This method gets comments from one user to another 
#and only retrives the body of the comment
my $ret = $se->users->
       users_comments_toid(368070,22656, {filter => '!mRNaB_KjjP'});

License

The library is licensed under the Bsd 3-clause. See this for a quick english TL:DR about it.

Download

Ideally you don't need to download anything to use it with perl. It's on CPAN here. You just install it with cpan. Note it's Net:StackExchange2 (2 at the end). Net:StackExchange is an older distribution for the 1.x API.

sudo cpan
>install Net::StackExchange2

Contact

Contact me at gideon [at] cpan [dot] org for any issues with this distribution.

Code

All of it is written in perl of course. Since I'm a beginner it might not be the best perl you've seen, I would be very happy to hear any suggestions/feedback.

The project is on github here: https://github.com/gideondsouza/perl-net-stackexchange

Please file any issues/bugs/features on the github page.

Road Map

  • Write some test cases.
  • Implement better core abstractions with a test seam, so I can write unit tests to see whether each method generates the right url.
share|improve this question
    
Finally I can add a Perl entry on this page! Good job. –  Nathan Osman Feb 5 '13 at 0:08
    
Thanks! :) I plan to write a couple updates for this api, to make it more fluent/intuitive, also plan to write a perl app that uses this wrapper :D –  gideon Feb 5 '13 at 17:53

You must log in to answer this question.

Browse other questions tagged .