ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Games-Go-SGF-Grove/Grove.pm
(Generate patch)

Comparing Games-Go-SGF-Grove/Grove.pm (file contents):
Revision 1.6 by root, Sun Jul 20 22:21:26 2008 UTC vs.
Revision 1.7 by root, Sun Jul 20 22:23:08 2008 UTC

29 29
30=cut 30=cut
31 31
32package Games::Go::SGF::Grove; 32package Games::Go::SGF::Grove;
33 33
34use base Exporter;
35
36use strict; 34use strict;
37no warnings; 35no warnings;
36
37use Carp;
38
39use base Exporter;
38 40
39our $VERSION = 0.1; 41our $VERSION = 0.1;
40our @EXPORT = qw(load_sgf save_sgf encode_sgf decode_sgf); 42our @EXPORT = qw(load_sgf save_sgf encode_sgf decode_sgf);
41 43
42=item $game = load_sgf $path 44=item $game = load_sgf $path
74 76
75sub load_sgf($) { 77sub load_sgf($) {
76 my ($path) = @_; 78 my ($path) = @_;
77 79
78 open my $fh, "<:perlio", $path 80 open my $fh, "<:perlio", $path
79 or die "$path: $!"; 81 or Carp::croak "$path: $!";
80 82
81 local $/; 83 local $/;
82 decode_sgf <$fh> 84 decode_sgf <$fh>
83} 85}
84 86
85sub save_sgf($$) { 87sub save_sgf($$) {
86 my ($path, $game) = @_; 88 my ($path, $game) = @_;
87 89
88 open my $fh, ">:perlio", $path 90 open my $fh, ">:perlio", $path
89 or die "$path: $!"; 91 or Carp::croak "$path: $!";
90 92
91 print $fh encode_sgf $game; 93 print $fh encode_sgf $game;
92} 94}
93 95
94=back 96=back

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines