File Coverage

blib/lib/Chess/Opening/ECO/Entry.pm
Criterion Covered Total %
statement 19 19 100.0
branch 3 6 50.0
condition n/a
subroutine 7 7 100.0
pod 4 4 100.0
total 33 36 91.6


line stmt bran cond sub pod time code
1             #! /bin/false
2              
3             # Copyright (C) 2019 Guido Flohr ,
4             # all rights reserved.
5              
6             # This program is free software. It comes without any warranty, to
7             # the extent permitted by applicable law. You can redistribute it
8             # and/or modify it under the terms of the Do What the Fuck You Want
9             # to Public License, Version 2, as published by Sam Hocevar. See
10             # http://www.wtfpl.net/ for more details.
11              
12             package Chess::Opening::ECO::Entry;
13             $Chess::Opening::ECO::Entry::VERSION = '0.3';
14 1     1   7 use common::sense;
  1         2  
  1         5  
15              
16 1     1   617 use Locale::TextDomain 'com.cantanea.Chess-Opening';
  1         18398  
  1         5  
17              
18 1     1   28155 use base 'Chess::Opening::Book::Entry';
  1         2  
  1         452  
19              
20             sub new {
21 2     2 1 25 my ($class, $fen, %args) = @_;
22              
23 2         42 my $self = $class->SUPER::new($fen);
24 2 50       14 $self->{__parent} = $args{parent} if exists $args{parent};
25 2 50       19 $self->{__eco} = $args{eco} if exists $args{eco};
26 2 50       9 $self->{__variation} = $args{variation} if exists $args{variation};
27              
28 2         12 return $self;
29             }
30              
31             sub eco {
32 2     2 1 8 my ($self) = @_;
33              
34 2         12 return substr $self->xeco, 0, 3;
35             }
36              
37             sub xeco {
38 4     4 1 29 shift->{__eco};
39             }
40              
41             sub variation {
42 2     2 1 16 __(shift->{__variation});
43             }
44              
45             1;