Chess::FIDE is a Perl extension for FIDE Rating List.
my $fide = Chess::FIDE->new(-file=>'filename');
$fide->fideSearch("surname eq 'Kasparov'");
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 list from April 2004 is provided under filename APR04FRL.TXT The following methods are available:
$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.
@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.