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.6';
14 1     1   7 use common::sense;
  1         3  
  1         5  
15              
16 1     1   692 use Locale::TextDomain 'com.cantanea.Chess-Opening';
  1         19109  
  1         6  
17              
18 1     1   28646 use base 'Chess::Opening::Book::Entry';
  1         3  
  1         561  
19              
20             sub new {
21 3     3 1 47 my ($class, $fen, %args) = @_;
22              
23 3         46 my $self = $class->SUPER::new($fen, %args);
24 3 50       22 $self->{__parent} = $args{parent} if exists $args{parent};
25 3 50       18 $self->{__eco} = $args{eco} if exists $args{eco};
26 3 50       23 $self->{__variation} = $args{variation} if exists $args{variation};
27              
28 3         13 return $self;
29             }
30              
31             sub eco {
32 3     3 1 3892 my ($self) = @_;
33              
34 3         18 return substr $self->xeco, 0, 3;
35             }
36              
37             sub xeco {
38 6     6 1 54 shift->{__eco};
39             }
40              
41             sub variation {
42 3     3 1 26 __(shift->{__variation});
43             }
44              
45             1;