Rosetta Code:Village Pump/Lang-tag bot/Source: Difference between revisions
Rosetta Code:Village Pump/Lang-tag bot/Source (view source)
Revision as of 13:40, 16 November 2009
, 14 years agoChanged to persistently keep track of which pages have been edited and to tag APL. Added to Category:Perl.
Underscore (talk | contribs) (Implemented kill switch.) |
Underscore (talk | contribs) (Changed to persistently keep track of which pages have been edited and to tag APL. Added to Category:Perl.) |
||
Line 4:
use List::Util '&minstr';
use HTML::Entities '&decode_entities';
use YAML::XS qw(&DumpFile &LoadFile);
use MediaWiki::API;
Line 14 ⟶ 15:
my $kill_switch_trigger = qr/stopediting/;
my $
my %langtags = (
Line 24 ⟶ 25:
'algol 68' => 'algol68',
'amigae' => 'amigae',
'applescript' => 'applescript',
'assembly' => 'asm',
Line 193 ⟶ 194:
# ------------------------------------------------------------
local *tasks = LoadFile $tasks_path;
local *todo = $tasks{todo};
my $mw = new MediaWiki::API({api_url => 'http://rosettacode.org/mw/api.php'});
Line 202 ⟶ 203:
or die q(Couldn't log in.);
while (@
{my $pagetitle = shift @
say "TITLE: $pagetitle";
Line 307 ⟶ 308:
if ($success)
{say 'Committed!';
push @done, $pagetitle;}
else
# Probably an edit conflict.
{say "Couldn't commit; I'll try again later.";
push @
DumpFile $tasks_path, \%tasks;
sleep DELAY_BETWEEN_EDITS;}</lang>
[[Category:Perl]]
|