User:MilHistBot/reviews.pl


 * 1) !/usr/bin/perl -w
 * 2) reviews.pl -- Count reviews per user
 * 3) Usage: reviews.pl
 * 4)   18 Oct 18 Created

use English; use strict; use utf8; use warnings;

use DateTime; use Data::Dumper;

use Cred; use MilHist::Bot; use MilHist::Parser; use MilHist::Table; use MilHist::Template;

binmode (STDERR, ':utf8'); binmode (STDOUT, ':utf8');

my $cred = new Cred ; my $editor = MilHist::Bot->new ($cred) or die "new MediaWiki::Bot failed";

sub bold ($) { return "". $ARG[0]. ""; }

sub dates { my $today = DateTime->now ; my $last_of_month = $today->clone ; $last_of_month->subtract ('months' => 1) until $last_of_month->month % 3 == 1; $last_of_month = $last_of_month->subtract (days => $today->day ); my $first_of_month = DateTime->new ('day' => 1, 'month' => $last_of_month->month, 'year' => $last_of_month->year )->subtract ('months' => 2); my $start = $first_of_month->strftime ("%Y-%m-%d"); my $end = $last_of_month->strftime ("%Y-%m-%d"); my $display_start = $first_of_month->strftime ("%B"); my $display_end = $last_of_month->strftime ("%B %Y"); return ($start, $end, $display_start, $display_end); }

sub list_to_hash ($) { my ($list) = @ARG; my %a = $list =~ /\[\[(.+?)\