NAME

Chess::PGN::Extract::Stream - File stream for reading PGN files

SYNOPSIS

my $stream = Chess::PGN::Extract->new ("filename.pgn");
while ( my $game = $stream->read_game ) {
  # You can read games one by one
}

# ... or a chunk of games you want
my @game = $stream->read_games (10);

DESCRIPTION

Chess::PGN::Extract::Stream provides a simple class of file stream by which you can extract chess records one by one or chunk by chunk from Portable Game Notation (PGN) files.

ATTRIBUTES AND METHODS

$class->new ($pgn_file)

Create a stream instance from the $pgn_file.

$self->pgn_file

PGN file name from which the stream reads games.

$self->read_game ()

Read a game from the stream.

$self->read_games ($limit)

Read a number of games at once and return an ARRAY of them. If $limit is a positive number, it reads games until the number of them reaches the $limit. If $limit is undef or negative, it slurps the PGN file and returns all the games contained.

SEE ALSO

Chess::PGN::Extract

BUGS

Please report any bugs to https://bitbucket.org/mnacamura/chess-pgn-extract/issues.

AUTHOR

Mitsuhiro Nakamura <m.nacamura@gmail.com>

Many thanks to David J. Barnes for his original development of pgn-extract and basicer at Bitbucket for his work on JSON enhancement.

LICENSE

Copyright (C) 2014 Mitsuhiro Nakamura.

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