NetHack::Logfile - reading and writing NetHack's logfiles
Version 0.01 released 04 Aug 07
use NetHack::Logfile ':all'; my @scores = read_logfile("logfile"); @scores = sort { $b->{points} <=> $a->{points} } @scores; $#scores = 1999; write_logfile(\@scores, "high-scores"); my $game = parse_logline($scores[0]); $game->{death} = 'ascended'; print make_logline($game), "\n";
Takes a file and parses it as a logfile. If any IO error occurs in reading the file, an exception is thrown. If any error occurs in parsing a logline, then an empty hash will be returned in its place.
The default value for the filename is "logfile".
Takes a string and attempts to parse it as a logline. If a parse error occurs, undef is returned. It's easy to fool this module with bogus role, race, gender, and alignment names, since these are not checked.
undef
Writes an logfile to FILENAME. If any IO error occurs, it will throw an exception. If any game is missing required keys, it will throw an exception.
Returns no useful value.
Takes a hashref and turns it into a logline. If not all keys are present (they must simply pass through defined), then an exception will be thrown.
defined
The field names are chosen for compatibility with the xlogfile format. I personally dislike many of them. C'est la vie.
The version of NetHack. Current version is 3.4.3.
The score when the game ended.
The dungeon branch number where the game ended.
The Dungeons of Doom
Gehennom
The Gnomish Mines
The Quest
Sokoban
Fort Ludios
Vlad's Tower
Elemental Planes
The dungeon level the game ended on.
The deepest dungeon level the character explored.
The character's current HP when the game ended.
The character's maximum HP when the game ended.
The number of times the character died. Ascension doesn't count as a death. Using up an amulet of life saving does.
The day (yyyymmdd) the game ended.
The day (yyyymmdd) the game began.
The user ID of the player.
The character's role (three-letter form, so Wiz not Wizard).
The character's race (three-letter form, so Dwa not Dwarf).
The character's ending gender (three-letter form, so Fem not Female).
The character's ending align (three-letter form, so Cha not Chaotic).
The name of the character.
The way the character died. One hopes it is "ascension".
Shawn M Moore, <sartak at gmail.com>
<sartak at gmail.com>
No known bugs.
Please report any bugs through RT: email bug-nethack-logfile at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=NetHack-Logfile.
bug-nethack-logfile at rt.cpan.org
You can find this documentation for this module with the perldoc command.
perldoc NetHack::Logfile
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/NetHack-Logfile
CPAN Ratings
http://cpanratings.perl.org/d/NetHack-Logfile
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=NetHack-Logfile
Search CPAN
http://search.cpan.org/dist/NetHack-Logfile
Thanks to the NetHack DevTeam for all their hard work.
Thanks NetHack, for kicking oh-so-much ass. Happy twentieth birthday!
Copyright 2007 Shawn M Moore.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
7 POD Errors
The following errors were encountered while parsing the POD:
Expected text after =item, not a number
To install NetHack::Logfile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NetHack::Logfile
CPAN shell
perl -MCPAN -e shell install NetHack::Logfile
For more information on module installation, please visit the detailed CPAN module installation guide.