| 1 | package Games::Solitaire::Verify::LinesIter; | ||||||||||
| 2 | 4 | $Games::Solitaire::Verify::LinesIter::VERSION = '0.2601'; | |||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use autodie; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | sub new | ||||||||||
| 8 | 6 | ▶ | { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 9 | 6 | my $class = shift; | |||||||||
| 10 | |||||||||||
| 11 | 6 | my $self = bless {}, $class; | |||||||||
| 12 | |||||||||||
| 13 | 6 | $self->_init(@_); | |||||||||
| 14 | |||||||||||
| 15 | 6 | return $self; | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub _init | ||||||||||
| 19 | 6 | ▶ | { | ||||||||
|
Subroutine
_init: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 6 | my ( $self, $args ) = @_; | |||||||||
| 21 | |||||||||||
| 22 | 6 | $self->{_get} = $args->{_get}; | |||||||||
| 23 | 6 | $self->{_line_num} = 0; | |||||||||
| 24 | |||||||||||
| 25 | 6 | return; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | sub _get_line | ||||||||||
| 29 | 3814 | ▶ | { | ||||||||
|
Subroutine
_get_line: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 3814 | my ( $self, ) = @_; | |||||||||
| 31 | |||||||||||
| 32 | 3814 | my $ret = $self->{_get}->(); | |||||||||
| 33 | 3814 | return ( $ret, ++$self->{_line_num} ); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub _assert_empty_line | ||||||||||
| 37 | 1156 | ▶ | { | ||||||||
|
Subroutine
_assert_empty_line: called CC=2 SCAR=7.4
| |||||||||||
| 38 | 1156 | my ( $self, ) = @_; | |||||||||
| 39 | |||||||||||
| 40 | 1156 | my ( $s, $line_idx ) = $self->_get_line; | |||||||||
| 41 | |||||||||||
| 42 | 1156 | ▶ | if ( $s ne '' ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | { | ||||||||||
| 44 | 0 | Carp::confess("Line '$line_idx' is not empty, but '$s'"); | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 1156 | return; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | sub _compare_line | ||||||||||
| 51 | 1842 | ▶ | { | ||||||||
|
Subroutine
_compare_line: called CC=2 SCAR=7.4
| |||||||||||
| 52 | 1842 | my ( $self, $wanted_line, $title, ) = @_; | |||||||||
| 53 | |||||||||||
| 54 | 1842 | my ( $line, $line_idx ) = $self->_get_line; | |||||||||
| 55 | 1842 | ▶ | if ( $line ne $wanted_line ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | { | ||||||||||
| 57 | 0 | Carp::confess( | |||||||||
| 58 | "$title string is '$line' vs. '$wanted_line' at line no. $line_idx" | ||||||||||
| 59 | ); | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 1842 | return; | |||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 4 | 1; | |||||||||
| 66 | |||||||||||
| 67 | __END__ | ||||||||||