/tags/3.1/misc/Login.pl

http://perlwikipedia.googlecode.com/ · Perl · 45 lines · 22 code · 21 blank · 2 comment · 0 complexity · 0311b377eb746069ffd796d2616ce91f MD5 · raw file

  1. #!/usr/bin/perl -w
  2. use Term::ReadKey;
  3. use Perlwikipedia;
  4. print "\nPlease enter the username of the account you are logging in: ";
  5. my $username=<STDIN>;
  6. chomp $username;
  7. print "\nPlease enter the password of the account: ";
  8. ReadMode('noecho');
  9. my $password=ReadLine(0);
  10. chomp $password;
  11. ReadMode('normal');
  12. my $perlwikipedia=Perlwikipedia->new($username);
  13. # Turn debugging on, to see what the bot is doing
  14. $perlwikipedia->{debug} = 1;
  15. print "\nPlease enter the host of the wiki, such as \'en.wikipedia.org\': ";
  16. my $host=<STDIN>;
  17. chomp $host;
  18. print "\nPlease enter the path to index.php, such as \'w\' on Wikipedia: ";
  19. my $path=<STDIN>;
  20. chomp $path;
  21. $perlwikipedia->set_wiki($host, $path);
  22. print "\nTrying to log in...";
  23. my $login_status=$perlwikipedia->login($username, $password);
  24. print "\nLogin returned \'$login_status\'\n";