| 1 | package Data::Page::Pageset::Chunk; | ||||||||||||
| 2 | 3 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 3 | ▶ | use base 'Class::Accessor::Fast'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | use overload | ||||||||||||
| 6 | 3 | ▶ | '""' => sub { shift->as_string }; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 3 | __PACKAGE__->mk_accessors( qw( first last pages is_current ) ); | |||||||||||
| 9 | |||||||||||||
| 10 | 3 | our $VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /: (\d+)\.(\d+)/; | |||||||||||
| 11 | |||||||||||||
| 12 | 10 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 13 | 10 | my $class = shift; | |||||||||||
| 14 | 10 | my @array = @_; | |||||||||||
| 15 | |||||||||||||
| 16 | 10 | my $self = bless {}, $class; | |||||||||||
| 17 | 10 | $self->first( $array[0] ); | |||||||||||
| 18 | 10 | $self->last( $array[-1] ); | |||||||||||
| 19 | 10 | $self->pages( $#array + 1 ); | |||||||||||
| 20 | 10 | $self->is_current(0); | |||||||||||
| 21 | |||||||||||||
| 22 | 10 | return $self; | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub middle { | ||||||||||
|
Subroutine
middle: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 26 | 0 | my $self = shift; | |||||||||||
| 27 | 0 | my $pages = $self->pages; | |||||||||||
| 28 | 0 | ▶ | $pages++ if $pages % 2; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | 0 | return $self->first + $pages / 2; | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 8 | ▶ | sub as_string { | ||||||||||
|
Subroutine
as_string: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||||
| 33 | 8 | my $self = shift; | |||||||||||
| 34 | 8 | ▶ | my $sep = shift || '-'; | ||||||||||
|
Condition50%1/2
shift() || '-'
MC/DC0%0/1
shift() || '-'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||
| 35 | 8 | ▶ | my $string = ( $self->first == $self->last ) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 36 | ? $self->first | ||||||||||||
| 37 | : join ("$sep", $self->first, $self->last ); | ||||||||||||
| 38 | 8 | return $string; | |||||||||||
| 39 | } | ||||||||||||
| 40 | 3 | 1; | |||||||||||