Gruntmaster::Opener - Populate opens table from NCSA access logs
use Gruntmaster::Opener; open my $fh, '<', '/var/log/apache2/access.log'; handle_line $_ while <$fh>;
Gruntmaster::Opener is the backend of the gruntmaster-opener script that reads NCSA-style access logs, finds lines that represent successful requests to problems during contests, extracts data from them and inserts it into the database.
handle_line($line)
The only function in this module. Exported by default. Takes a single parameter, a line from a logfile in NCSA common/combined format.
If the request described in the given line:
Is successful (response code is 2xx)
Targets a problem (/pb/something)
/pb/something
Has a query parameter named contest
contest
Happened during the contest named in the contest query parameter (this restriction is enforced by the open_problem function).
an entry is added to the opens table, using the open_problem function from Gruntmaster::Data.
opens
gruntmaster-opener
Marius Gavrilescu <marius@ieval.ro>
Copyright (C) 2014-2016 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.20.1 or, at your option, any later version of Perl 5 you may have available.
To install Gruntmaster::Data, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gruntmaster::Data
CPAN shell
perl -MCPAN -e shell install Gruntmaster::Data
For more information on module installation, please visit the detailed CPAN module installation guide.