NAME
Games::Golf - Utilities to handle Perl Golf courses
SYNOPSIS
use Games::Golf;
my $golf = new Games::Golf( "tpr.glf" );
$golf->read( "entries.dat" );
$golf->test;
$golf->dump( "entries.dat" );
DESCRIPTION
The game of Perl golf is becoming increasingly popular. Holes frequently appear on Perl Monks, the Perl Review has an ongoing Perl Golf column and a monthly tournament, the Fun with Perl mailing-list has run several very successful courses in the last few months, with great success. So much success, in fact, that the golf@perl.org mailing-list has been resurrected.
Until now, judges have had to write extensive test programs to check and score the players' entries along with compiling the leaderboard by hand. On the other hand, golfers have to check their entries, and submit their entries themselves.
This module aims at facilitating the administration of Perl golf courses by writing a simple configuration file for the referees, and providing scripts for both the referee and the player side.
The included golfer script will test a player's individual entries (doing all the hard scoring and testing), as well as submitting the entries.
The Games::Golf
object will handle a list of Games::Golf::Entry
objects, as well as a list of Games::Golf::TestSuite.pm
objects.
Constructor
- new( $file )
-
Creates a new
Games::Golf
object. You are to provide the name of a configuration file that will describe the course (see "CONFIG FILE" for details about this file).
Accessors
- file()
-
The configuration file of the course.
- hole_names()
-
Return the list of the course's holes names.
The following accessors are autoloaded.
None yet.
Public methods
- FIXME_extract( "/path/to/mbox", ... )
-
Extracts solutions from a unix-style mbox. A cache mechanism allows the
Games::Golf
object not to extract already extracted entries. - add( $entry )
-
Store an entry in the
Games::Golf
object. The paramater is aGames::Golf::Entry
object.Return the entry (either the new one, or the old one if the same entry was already in the cache).
- test( [ @holes ] )
-
Tests the entries stored in the object. A cache mechanism (implemented in
Games::Golf::TestSuite::run()
) allows theGames::Golf
object not to re-check already tested entries.You can pass a list of holes to test, and the object will test the solutions of these holes only.
If no hole is given, then all holes are tested.
- dump( $file )
-
Dump all entries in a single file.
- load( $path )
-
Read a file with all previously recorded entries. See the
dump
method. This initiates the cache mechanism.
PRIVATE METHODS
- _parse_config_file()
-
Parse the config file, and fetch all attributes of the course. Create the
Games::Golf::TestSuite
objects for each of the holes.
CONFIG FILE
Once the course is launched, the referees are to provide a file which will describe the course.
ENVIRONMENT VARIABLES
!!FIXME!! Shouldn't environment variables be handled by the player/referee scripts?
PERL_GOLF_NICK
Specifies the name to be printed on the leaderboard instead of the mail adress of the golfer.
PERL_GOLF_CATEGORY
This one can be set to indicate whether golfer is experienced (default, "veteran") or a newcomer ("beginner").
FILES
tests/*.t
The test suite for a golf course.
!!FIXME!! "tests/*" or "t/*"? t/* will already be taken by the module...
extracted/*
The directory where to store extracted entries.
!!FIXME!! Should we allow an environment variable to overwrite this?
DEPENDENCIES
Date::Manip
to handle dates the smart way.Data::Dumper
to easily dump and fetch our entries.MD5
to implement our cache mechanism.
TODO
Lots of stuff.
BUGS
Please report all bugs to:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Games-Golf
AUTHORS
- Philippe 'BooK' Bruhat <book@cpan.org>
- Amir Karger <akarger@cpan.org>
- Steffen Müller <games-golf@steffen-mueller.net>
- Jonathan E. Paton <jonathanpaton@yahoo.com>
- Jérôme Quelin <jquelin@cpan.org>
- Eugène Van der Pijll <E.C.vanderPijll@phys.uu.nl>
COPYRIGHT
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
SEE ALSO
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 492:
You forgot a '=back' before '=head1'
- Around line 564:
Non-ASCII character seen before =encoding in 'Müller'. Assuming CP1252