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