guiwp has asked for the wisdom of the Perl Monks concerning the following question:

Some days ago I was interested in learning perl (as its name suggests: Practical Extraction and Report Language) with some library of my interest and I found libraries to deal with the MediaWiki API. I've tried the MediaWiki::Bot and MediaWiki::API but no one seems to pass tests with login function.

The function that login in the server is basically simple:

$mw->login( { lgname => $settings->{username}, lgpassword => $settings->{password} }) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; I've even run the syntax checker perl -c -T sample.pl but everything was fine. Remember that I would like to learn perl using some library to access wikipedia etc. (want to do some tasks on Wikipedia), some one could suggest another library or maybe teach me how to use these libraries that I cited?

Replies are listed 'Best First'.
Re: Library to access MediaWiki
by stevieb (Canon) on Jun 13, 2016 at 13:47 UTC

    Welcome to the Monastery, guiwp!

    Can you please tell us what error message you're getting? Also, try printing out the username and password to STDOUT to ensure they contain what you think they do. In the below example, I've put > and < immediately before and after each entry. This helps spot any erroneous whitespace characters:

    print "un: >$settings->{username}<, pw: >$settings->{password}<\n";

      Thank you @stevieb, Btw I discovered how to use the debugger and its nice! (was able to type p $settings->{username} and the settings was fine!) =)

      Now I've tested and seems that only the MediaWiki::Bot is not working. The MediaWiki::API login func is ok (the only problem yesterday was an 500 https code over 443 on pt.wikipedia.org). Today I could login the server normally.

      Hey if anyone of you guys want to help fixing this issue with MediaWiki::Bot it should be very simple to you guys (see here https://github.com/MediaWiki-Bot/MediaWiki-Bot/issues/77). I would like to help https://github.com/doherty but I don't have the skills for it, unfortunately now now =(