| 1 | 3 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package LINQ::FieldSet::Single; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 3 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||||||||
| 8 | 3 | our $VERSION = '0.003'; | |||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 3 | ▶ | use Class::Tiny; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 3 | ▶ | use parent qw( LINQ::FieldSet ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 3 | ▶ | use overload ( | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 'fallback' => !!1, | ||||||||||||||||||||
| 15 | 1 | ▶ | q[bool] => sub { !! 1 }, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 3 | q[""] => 'to_string', | |||||||||||||||||||
| 17 | q[&{}] => 'coderef', | ||||||||||||||||||||
| 18 | 3 | ); | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 7 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||
| 21 | 7 | my $class = shift; | |||||||||||||||||||
| 22 | 7 | my $field = shift; | |||||||||||||||||||
| 23 | 7 | my $self = $class->SUPER::new( $field ); | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 7 | ▶ | if ( wantarray ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 7 | return ( $self, @_ ); | |||||||||||||||||||
| 27 | } | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | 0 | ▶ | if ( @_ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 30 | 0 | LINQ::Util::Internal::throw( | |||||||||||||||||||
| 31 | 'CallerError', | ||||||||||||||||||||
| 32 | 'message' => 'Unexpected extra parameters; single field name expected', | ||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | return $self; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 37 | ▶ | sub coderef { | ||||||||||||||||||
|
Subroutine
coderef: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 40 | 37 | my ( $self ) = ( shift ); | |||||||||||||||||||
| 41 | 37 | ▶ | $self->{coderef} ||= $self->_build_coderef; | ||||||||||||||||||
|
Condition66%2/3
$self->{"coderef"} ||= $self->_build_coderef
MC/DC0%0/2
$self->{"coderef"} ||= $self->_build_coderef
$self->{"coderef"}
$self->_build_coderef
Truth table66%2/3
A ||= B
A= $self->{"coderef"}B= $self->_build_coderef
| |||||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 7 | ▶ | sub _build_coderef { | ||||||||||||||||||
|
Subroutine
_build_coderef: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 45 | 7 | my ( $self ) = ( shift ); | |||||||||||||||||||
| 46 | 7 | my ( $field ) = @{ $self->fields }; | |||||||||||||||||||
| 47 | 7 | return $field->getter; | |||||||||||||||||||
| 48 | } | ||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 0 | ▶ | sub to_string { | ||||||||||||||||||
|
Subroutine
to_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 51 | 0 | my ( $self ) = ( shift ); | |||||||||||||||||||
| 52 | 0 | sprintf 'field(%s)', join q[, ], map $_->name, @{ $self->fields }; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 3 | 1; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||