Roman M. Parparov > Chess-FIDE > Chess::FIDE

Download:
Chess-FIDE-1.12.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.12   Source  

NAME ^

Chess::FIDE - Perl extension for FIDE Rating List

SYNOPSIS ^

  use Chess::FIDE;
  my $fide = Chess::FIDE->new(-file=>'filename');
  $fide->fideSearch("surname eq 'Kasparov'");

DESCRIPTION ^

Chess::FIDE - Perl extension for FIDE Rating List. FIDE is the International Chess Federation that every quarter of the year releases a list of its rated members. The list contains about fifty thousand entries. This module is designed to parse its contents and to search across it using perl expressions. A sample from an up-to-date FIDE list is provided in t/data/test-list.txt The following methods are available:

Constructor

$fide = new Chess::FIDE(-file=>'localfile'); $fide = new Chess::FIDE(-www=>1,[-proxy=>proxyaddress]);

There are two types of constructors - one takes a local file and another one retrieves the up-to-date zip file from the FIDE site, unzips it on the fly and parses the output immediately. In case of the second constructor no files are created. Also usage of an optional proxy is possible in the second case.

Each player entry in the file is scanned against a regexp and then there is a post-parsing as well which is implemented in function parseLine. The entry is then stored in an object defined by the module Chess::FIDE::Player (see its documentation). Every new object is inserted as a hash member where the FIDE ID of the player is the key. A sparse array could be used instead, though.

fideSearch

@result = $fide->fideSearch("perl conditional");

Example: @result = $fide->fideSearch("surname eq 'Kasparov'");

Searches the fide object for entries satisfying the conditional specified as the argument. The conditional MUST be a PERL expression within double quotes. All constant strings should be expressed within single quotes because the conditional is 'eval'ed against each entry. Any conditional including a regexp match that may be eval-ed is valid. For the fields to use in conditionals see Chess::FIDE::Player documentation.

CAVEATS ^

The only unique entry is the id field. There are, for example, two "Sokolov, Andrei" entries, so a search by name might be ambigious.

Please note that the files are available only for the year 2001 and later.

SEE ALSO ^

Chess::FIDE::Player http://www.fide.com/ Archive::Zip LWP::UserAgent

AUTHOR ^

Roman M. Parparov, <roman@parparov.com>

COPYRIGHT AND LICENSE ^

Copyright (C) 2004 by Roman M. Parparov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.

Fide Rating List is Copyright (C) by International Chess Federation http://www.fide.com

syntax highlighting: