SHARE
TWEET

report_questions

a guest Feb 27th, 2011 114 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /usr/bin/env perl
  2.  
  3. ## Usage: $0 http://stackoverflow.com/ questions.json ...
  4.  
  5. use strict;
  6. use warnings;
  7. use File::Slurp qw(slurp);
  8. use JSON;
  9.  
  10. my $root = $ARGV[0]; shift; $root =~ s!/$!!;
  11.  
  12. my @questions =
  13.   sort {$a->{question_id} <=> $b->{question_id}}
  14.   map {@{$_->{questions}}}
  15.   map {from_json(slurp($_))} @ARGV;
  16.  
  17. foreach my $q (@questions) {
  18.     my $title = $q->{title}; $title =~ s/([*<>\[\]\`\\])/\\$1/g;
  19.     my $url = "$root/questions/" . $q->{question_id};
  20.     my $answers = $q->{answer_count};
  21.     print "* [$title]($url) ($answers)\n";
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top