| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Chess::PGN::Parse::FileHandle; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
43071
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
59
|
|
|
4
|
2
|
|
|
2
|
|
9
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
60
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2159
|
use Chess::PGN::Parse; |
|
|
2
|
|
|
|
|
53187
|
|
|
|
2
|
|
|
|
|
377
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Chess::PGN::Parse::FileHandle - Parse PGN from a FileHandle |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.02 |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
19
|
|
|
|
|
|
|
our @ISA = qw(Chess::PGN::Parse); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Chess::PGN::Parse::FileHandle; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# read from a gzip'ed file with gunzipping first |
|
26
|
|
|
|
|
|
|
open my $pgn_gz, "<:gzip", "my_pgns.pgn.gz" or die $!; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my $pgn = Chess::PGN::Parse::FileHandle->new($pgn_gz); |
|
29
|
|
|
|
|
|
|
while ($pgn->read_game()) { |
|
30
|
|
|
|
|
|
|
# Process the file like you would with Chess::PGN::Parse |
|
31
|
|
|
|
|
|
|
... |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
After getting tired of having to repeatedly C and C PGN |
|
37
|
|
|
|
|
|
|
files to process through C, I decided there had to |
|
38
|
|
|
|
|
|
|
be an easier way. Well, this is it. This module is simple subclass |
|
39
|
|
|
|
|
|
|
of C that allows Cs as a parameter. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 new FILEHANDLE |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Returns a new C object, ready to read from |
|
46
|
|
|
|
|
|
|
C. |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
The remaining methods of this class are inherited directly from |
|
49
|
|
|
|
|
|
|
C. |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub new { |
|
54
|
1
|
|
|
1
|
1
|
18
|
my ($class, $fh) = @_; |
|
55
|
1
|
|
|
|
|
11
|
my $self = $class->SUPER::new(''); |
|
56
|
1
|
|
|
|
|
102
|
$self->{fh} = \$fh; |
|
57
|
1
|
|
|
|
|
5
|
return bless $self, $class; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NOTES |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This is a naughty module that peeks at the internals of another module. |
|
63
|
|
|
|
|
|
|
It could easily break if changes are made to C. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Steve Peters, C<< >> |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 BUGS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
|
72
|
|
|
|
|
|
|
C, or through the web interface at |
|
73
|
|
|
|
|
|
|
L. |
|
74
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
|
75
|
|
|
|
|
|
|
your bug as I make changes. |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 ACKNOWLEDGMENTS |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Giuseppe Maxia for C |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Copyright 2005 Steve Peters, All Rights Reserved. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
86
|
|
|
|
|
|
|
under the same terms as Perl itself. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; # End of Chess::PGN::Parse::FileHandle |