The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chess::ELO::FEDA - Download FEDA ELO (http://www.feda.org) into differents backends (SQLite)

VERSION

version 0.04

SYNOPSIS

   my $elo = Chess::ELO::FEDA->new(
      -url      => 'http://feda.org/feda2k16/wp-content/uploads/2017_11.zip'
      -folder   => './elo/feda',
      -target   => '2017_11.sqlite',
      -callback => sub { my $player = shift; },
      -verbose  => 1
   );

DESCRIPTION

The main idea of this module consists on build a SQL format from the XLS downloaded from the URL provided. All players information are loaded into "elo_feda" table, according this script:

   CREATE TABLE elo_feda(
      feda_id integer primary key, 
      surname varchar(32) not null,
      name    varchar(32), 
      fed     varchar(8), 
      rating  integer, 
      games   integer, 
      birth   integer, 
      title   varchar(16), 
      flag    varchar(8)
   );

METHODS

new (%OPTS)

Constructor. It accepts a hash with these options:

-callback

This callback sub will be called on each record found. It receives a hash reference with the player data: feda_id, surname, name, fed, rating, games, birth, title, flag

-folder

Working folder of the overall process. It is not created if it doesn't exists.

-target

Target file where the parser stores the ELO information. According the file extension, it selects the proper backend: .sqlite for SQLite dabase or .csv for a CSV file format. An empty value means that no backend is built.

-url

The URL direction (http://) used by the downloader to search the ZIP file. The main file expected into the package is the XLS

-verbose

0 by default. If set, shows useful debug messages

cleanup

Unlink the files dowloaded for this downloader (the XLS file)

download

Download the ZIP file from the -url parameter. Extract the XLS file to the target_folder (which must exists).

parse

Parse and transform the XLS input file to the proper backend, according the -target parameter. It relies on DBD::* in order to build the file.

run

Integrates download, parse and cleanup in a single call.

AUTHOR

Miguel Prz <niceperl@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Miguel Prz.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.