| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## Module Generic - ~/lib/Module/Generic/Array.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Version v2.3.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2025 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## Created 2021/03/20 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## Modified 2026/01/22 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## All rights reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ## under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package Module::Generic::Array; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 23 | ▶ | use v5.16.0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 23 | ▶ | use common::sense; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 23 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 23 | warnings::register_categories( 'Module::Generic' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 23 | ▶ | use vars qw( $DEBUG $ERROR $TRUE $FALSE ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 23 | ▶ | use List::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 23 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 23 | ▶ | use Wanted; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 23 | ▶ | no warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 23 | ▶ | use overload ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # Turned out to be not such a good ide as it create unexpected results, especially when this is an array of overloaded objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # '""' => 'as_string', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | '==' => sub { _obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | '!=' => sub { !_obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 39 | ▶ | 'eq' => sub { _obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | 'ne' => sub { !_obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 23 | '%{}' => 'as_hash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | fallback => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 23 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 23 | ▶ | use constant BREAK_LOOP => 'BREAK'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 23 | ▶ | use Module::Generic::Global ':const'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 23 | $DEBUG = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 23 | our $VERSION = 'v2.3.1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 23 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 23 | require Module::Generic::Boolean; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 23 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 23 | $TRUE = ${"Module::Generic::Boolean::true"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 23 | $FALSE = ${"Module::Generic::Boolean::false"}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 947 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 947 | my $this = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 947 | my $init = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 947 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 260 | ▶ | if( ( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'ARRAY' ) ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
builtin::blessed($_[0]) and $_[0]->isa("ARRAY") or ref $_[0] eq "ARRAY"
builtin::blessed($_[0]) and $_[0]->isa("ARRAY")
MC/DC66%2/3
builtin::blessed($_[0]) and $_[0]->isa("ARRAY") or ref $_[0] eq "ARRAY"
builtin::blessed($_[0])
$_[0]->isa("ARRAY")
ref $_[0] eq "ARRAY"
Truth table60%3/5
A and B or C
A= builtin::blessed($_[0])B= $_[0]->isa("ARRAY")C= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ref( $_[0] ) eq 'ARRAY' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 256 | $init = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | $init = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 947 | ▶ | CORE::return( bless( $init => ( ref( $this ) || $this ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table66%2/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub append { CORE::return( CORE::shift->push( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
append: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub as_array { CORE::return( $_[0] ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_array: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | sub as_hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_hash: called CC=8 SCAR=24.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 7 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 7 | my $opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 7 | ▶ | $opts = CORE::shift( @_ ) if( ( Scalar::Util::reftype( $opts ) // '' ) eq 'HASH' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($opts) // ""
MC/DC0%0/1
builtin::reftype($opts) // ""
builtin::reftype($opts)
Truth table50%1/2
A
A= builtin::reftype($opts)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # my $ref = {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 7 | my $offsets = $self->keys; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 7 | ▶ | if( $opts->{start_from} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $start = CORE::int( $opts->{start_from} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | for my $i ( 0..$#$offsets ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $offsets->[ $i ] += $start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 7 | my $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | ▶ | if( $opts->{strict} || $opts->{native} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opts->{"strict"} or $opts->{"native"}
MC/DC0%0/2
$opts->{"strict"} or $opts->{"native"}
$opts->{"strict"}
$opts->{"native"}
Truth table33%1/3
A or B
A= $opts->{"strict"}B= $opts->{"native"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | $ref = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 7 | ▶ | $self->_load_class( 'Module::Generic::Hash' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | CORE::return( $self->pass_error ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Since our array might contain reference, we instantiate first our special hash object, and then we add into it our elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | # Module::Generic::Hash, that uses Module::Generic::TieHash, knows how to handle keys as reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 7 | $ref = Module::Generic::Hash->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 7 | @$ref{ @$self } = @$offsets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 7 | CORE::return( $ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | sub as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 101 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 101 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 101 | my $sort = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 101 | ▶ | $sort = CORE::shift( @_ ) if( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 101 | ▶ | CORE::return( $self->sort->as_string ) if( $sort ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 54 | CORE::return( "@$self" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | sub break | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
break: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 2 | my $repo = Module::Generic::Global->new( 'return' => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | my $val = BREAK_LOOP; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 2 | $repo->set( $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 2 | CORE::return( $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | sub callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callback: called CC=19 SCAR=40.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 18 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 18 | my( $what, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 18 | ▶ | if( !defined( $what ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | warn( "No callback type was provided.\n" ) if( warnings::enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | ▶ | elsif( $what ne 'add' && $what ne 'remove' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$what ne "add" and $what ne "remove"
MC/DC0%0/2
$what ne "add" and $what ne "remove"
$what ne "add"
$what ne "remove"
Truth table66%2/3
A and B
A= $what ne "add"B= $what ne "remove"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | warn( "Callback type provided ($what) is unsupported. Use 'add' or 'remove'.\n" ) if( warnings::enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | elsif( CORE::scalar( @_ ) == 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | warn( "No callback code was provided. Provide an anonymous subroutine, or reference to existing subroutine.\n" ) if( warnings::enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | ▶ | elsif( defined( $code ) && ref( $code ) ne 'CODE' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
defined $code and ref $code ne "CODE"
MC/DC0%0/2
defined $code and ref $code ne "CODE"
defined $code
ref $code ne "CODE"
Truth table66%2/3
A and B
A= defined $codeB= ref $code ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | warn( "Callback provided is not a code reference. Provide an anonymous subroutine, or reference to existing subroutine." ) if( warnings::enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 18 | ▶ | if( !defined( $code ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | # undef is passed as an argument, so we remove the callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3 | ▶ | if( CORE::scalar( @_ ) >= 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | # The array is not tied, so there is nothing to remove. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | my $tie = tied( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 3 | ▶ | CORE::return(1) if( !$tie ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 3 | my $rv = $tie->unset_callback( $what ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 3 | ▶ | untie( @$self ) if( !$tie->has_callback ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 3 | CORE::return( $rv ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # Only 1 argument: get mode only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $tie = tied( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | CORE::return if( !$tie ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | CORE::return( $tie->get_callback( $what ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # $code is defined, so we have something to set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 15 | my $tie = tied( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | # Not tied yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 15 | ▶ | if( !$tie ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | ▶ | $tie = tie( @$self => 'Module::Generic::Array::Tie', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
tie(@$self, 'Module::Generic::Array::Tie', {'data', $self, 'debug', $Module::Generic::Array::DEBUG, $what, $code, 'object', $self}) || (return)
MC/DC0%0/1
tie(@$self, 'Module::Generic::Array::Tie', {'data', $self, 'debug', $Module::Generic::Array::DEBUG, $what, $code, 'object', $self}) || (return)
tie(@$self, 'Module::Generic::Array::Tie', {'data', $self, 'debug', $Module::Generic::Array::DEBUG, $what, $code, 'object', $self})
Truth table50%1/2
A
A= tie(@$self, 'Module::Generic::Array::Tie', {'data', $self, 'debug', $Module::Generic::Array::DEBUG, $what, $code, 'object', $self})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | data => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | debug => $DEBUG, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | $what => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | object => $self, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | }) || CORE::return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | CORE::return(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 14 | ▶ | $tie->set_callback( $what => $code ) || CORE::return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 14 | CORE::return(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | sub chomp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
chomp: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | CORE::chomp( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 7 | ▶ | sub clone { CORE::return( $_[0]->new( [ @{$_[0]} ] ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | sub concat | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
concat: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $new = $self->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | for( my $i = 0; $i < CORE::scalar( @_ ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if( !defined( $_[$i] ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
not defined $_[$i] or (builtin::reftype($_[$i]) // "") ne "ARRAY"
builtin::reftype($_[$i]) // ""
MC/DC0%0/2
not defined $_[$i] or (builtin::reftype($_[$i]) // "") ne "ARRAY"
not defined $_[$i]
builtin::reftype($_[$i])
Truth table0%0/3
not(A) or B
A= not defined $_[$i]B= builtin::reftype($_[$i])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ( Scalar::Util::reftype( $_[$i] ) // '' ) ne 'ARRAY' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | $new->push( @{$_[$i]} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | CORE::return( $new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub contains { CORE::return( CORE::shift->exists( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
contains: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | sub delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: called CC=9 SCAR=25.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 4 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 4 | my( $offset, $length ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 4 | ▶ | if( defined( $offset ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 4 | ▶ | if( $offset !~ /^\-?\d+$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1 | ▶ | warn( "Non integer offset \"$offset\" provided to delete array element\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 3 | ▶ | if( CORE::defined( $length ) && $length !~ /^\-?\d+$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $length and not $length =~ /^\-?\d+$/
MC/DC0%0/2
defined $length and not $length =~ /^\-?\d+$/
defined $length
not $length =~ /^\-?\d+$/
Truth table66%2/3
A and not(B)
A= defined $lengthB= not $length =~ /^\-?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | warn( $self, "Non integer length \"$length\" provided to delete array element\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | ▶ | my @removed = CORE::splice( @$self, $offset, CORE::defined( $length ) ? CORE::int( $length ) : 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | ▶ | if( Wanted::want( 'LIST' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | rreturn( @removed ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 3 | rreturn( $self->new( \@removed ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # Required to make the compiler happy, as per Wanted documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | sub each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each: called CC=10 SCAR=29.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | my $code = CORE::shift( @_ ) || do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
CORE::shift @_ || do {
warn "No subroutine callback as provided for each\n" if $self->_warnings_is_enabled('Module::Generic');
return
}
MC/DC0%0/2
CORE::shift @_ || do {
warn "No subroutine callback as provided for each\n" if $self->_warnings_is_enabled('Module::Generic');
return
}
CORE::shift @_
do {
warn "No subroutine callback as provided for each\n" if $self->_warnings_is_enabled('Module::Generic');
return
}
Truth table33%1/3
A || B
A= CORE::shift @_B= do {
warn "No subroutine callback as provided for each\n" if $self->_warnings_is_enabled('Module::Generic');
return
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | warn( "No subroutine callback as provided for each\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | ▶ | if( ref( $code ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | warn( "I was expecting a reference to a subroutine for the callback to each, but got '$code' instead.\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | # Index starts from 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | # This does not work in perl < 5.12.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # while( my( $i, $v ) = CORE::each( @$self ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | for( my $i = 0; $i < scalar( @$self ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 10 | my $v = $self->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 10 | local $_ = $v; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # CORE::defined( $code->( $i, $v ) ) || CORE::last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 10 | my $rv = $code->( $i, $v ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 10 | ▶ | CORE::last if( defined( $rv ) && CORE::length( $rv ) && ( $rv eq BREAK_LOOP || !$rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $rv and CORE::length $rv and $rv eq "BREAK" || !$rv
defined $rv and CORE::length $rv
$rv eq "BREAK" or not $rv
MC/DC25%1/4
defined $rv and CORE::length $rv and $rv eq "BREAK" || !$rv
defined $rv
CORE::length $rv
$rv eq "BREAK"
not $rv
Truth table40%2/5
A and B and C or not(D)
A= defined $rvB= CORE::length $rvC= $rv eq "BREAK"D= not $rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 1 | ▶ | sub eighth { CORE::return( CORE::shift->get_null(7) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
eighth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub empty { CORE::return( CORE::shift->reset( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | sub error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=28 SCAR=65.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | my $addr = Scalar::Util::refaddr( $self ) || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
builtin::refaddr($self) || $self
MC/DC0%0/2
builtin::refaddr($self) || $self
builtin::refaddr($self)
$self
Truth table0%0/3
A || B
A= builtin::refaddr($self)B= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | my $class = ref( $self ) || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $o; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 23 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $repo = Module::Generic::Global->new( 'errors' => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my $args = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # We got an object as first argument. It could be a child from our exception package or from another package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # Either way, we use it as it is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if( ( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'Module::Generic::Exception' ) ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Exception") or builtin::blessed($_[0])
builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Exception")
MC/DC0%0/3
builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Exception") or builtin::blessed($_[0])
builtin::blessed($_[0])
$_[0]->isa("Module::Generic::Exception")
builtin::blessed($_[0])
Truth table0%0/5
A and B or C
A= builtin::blessed($_[0])B= $_[0]->isa("Module::Generic::Exception")C= builtin::blessed($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | Scalar::Util::blessed( $_[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $o = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | elsif( ref( $_[0] ) eq 'HASH' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $args = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | ▶ | $args->{message} = CORE::join( '', CORE::map( ref( $_ ) eq 'CODE' ? $_->() : $_, @_ ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | $args->{class} //= ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"class"} //= ""
MC/DC0%0/1
$args->{"class"} //= ""
$args->{"class"}
Truth table0%0/2
A
A= $args->{"class"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | my $ex_class = CORE::length( $args->{class} ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | ? $args->{class} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | : ( defined( ${"${class}\::EXCEPTION_CLASS"} ) && CORE::length( ${"${class}\::EXCEPTION_CLASS"} ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | ? ${"${class}\::EXCEPTION_CLASS"} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined ${"${class}::EXCEPTION_CLASS";} and CORE::length ${"${class}::EXCEPTION_CLASS";}
MC/DC0%0/2
defined ${"${class}::EXCEPTION_CLASS";} and CORE::length ${"${class}::EXCEPTION_CLASS";}
defined ${"${class}::EXCEPTION_CLASS";}
CORE::length ${"${class}::EXCEPTION_CLASS";}
Truth table0%0/3
A and B
A= defined ${"${class}::EXCEPTION_CLASS";}B= CORE::length ${"${class}::EXCEPTION_CLASS";}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | : 'Module::Generic::Exception'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | unless( CORE::scalar( CORE::keys( %{"${ex_class}\::"} ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $pl = "use $ex_class;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | local $SIG{__DIE__} = sub{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | eval( $pl ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # We have to die, because we have an error within another error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | die( "${class}\::error() is unable to load exception class \"$ex_class\": $@" ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $o = $ex_class->new( $args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $repo->set( $o ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # $ERROR = $o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # try-catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | if( !$self->_is_class_loaded( 'Encode' ) && !eval( 'require Encode' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_is_class_loaded('Encode') || eval 'require Encode'
MC/DC0%0/2
$self->_is_class_loaded('Encode') || eval 'require Encode'
$self->_is_class_loaded('Encode')
eval 'require Encode'
Truth table0%0/3
A || B
A= $self->_is_class_loaded('Encode')B= eval 'require Encode'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | warn( $o ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | my $enc_str = eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 23 | ▶ | no strict 'subs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | Encode::encode( 'UTF-8', "$o", Encode::FB_CROAK ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | # Display warnings if warnings for this class is registered and enabled or if not registered | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | warn( $@ ? $o : $enc_str ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | if( !$args->{no_return_null_object} && want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $args->{"no_return_null_object"} and want("OBJECT")
MC/DC0%0/2
not $args->{"no_return_null_object"} and want("OBJECT")
not $args->{"no_return_null_object"}
want("OBJECT")
Truth table0%0/3
not(A) and B
A= not $args->{"no_return_null_object"}B= want("OBJECT")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # try-catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if( !$self->_is_class_loaded( 'Module::Generic::Null' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | eval( 'require Module::Generic::Null' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | die( "Unable to load module Module::Generic::Null" ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my $null = Module::Generic::Null->new( $o, { debug => $DEBUG, has_error => 1 }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | rreturn( $null ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $o = $repo->get; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | if( !$o && want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $o and want("OBJECT")
MC/DC0%0/2
not $o and want("OBJECT")
not $o
want("OBJECT")
Truth table0%0/3
not(A) and B
A= not $oB= want("OBJECT")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # try-catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | if( !$self->_is_class_loaded( 'Module::Generic::Null' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | eval( 'require Module::Generic::Null' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | die( "Unable to load module Module::Generic::Null" ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my $null = Module::Generic::Null->new( $o, { debug => $DEBUG, wants => 'object' }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | rreturn( $null ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | CORE::return( $o ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # Credits: <https://www.perlmonks.org/?node_id=871696> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | sub even | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
even: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 1 | my @new = @$self[ CORE::grep( !($_ % 2), 0..$#$self ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 1 | CORE::return( $self->new( \@new ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | # Mostly the same as with remove() except for the end | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | sub except | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
except: called CC=7 SCAR=27.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | my $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | ▶ | if( CORE::scalar( @_ ) == 1 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
scalar @_ == 1 and builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Array")
scalar @_ == 1 and builtin::blessed($_[0])
MC/DC0%0/3
scalar @_ == 1 and builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Array")
scalar @_ == 1
builtin::blessed($_[0])
$_[0]->isa("Module::Generic::Array")
Truth table25%1/4
A and B and C
A= scalar @_ == 1B= builtin::blessed($_[0])C= $_[0]->isa("Module::Generic::Array")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | Scalar::Util::blessed( $_[0] ) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | $_[0]->isa( 'Module::Generic::Array' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | $ref = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | ▶ | elsif( CORE::scalar( @_ ) == 1 && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
scalar @_ == 1 and (builtin::reftype($_[0]) // "") eq "ARRAY"
builtin::reftype($_[0]) // ""
MC/DC0%0/2
scalar @_ == 1 and (builtin::reftype($_[0]) // "") eq "ARRAY"
scalar @_ == 1
builtin::reftype($_[0])
Truth table0%0/3
A and B
A= scalar @_ == 1B= builtin::reftype($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | ( Scalar::Util::reftype( $_[0] ) // '' ) eq 'ARRAY' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $ref = $self->new( CORE::shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $ref = $self->new( [ @_ ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 1 | my $hash = $ref->as_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | my @res = grep{ !CORE::exists( $hash->{ $_ } ) } @$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 1 | CORE::return( $self->new( \@res ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | sub exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exists: called CC=4 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 5 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 5 | my $this = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 5 | ▶ | if( ref( $this ) && ref( $this ) ne 'Regexp' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $this and ref $this ne "Regexp"
MC/DC0%0/2
ref $this and ref $this ne "Regexp"
ref $this
ref $this ne "Regexp"
Truth table66%2/3
A and B
A= ref $thisB= ref $this ne "Regexp"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $pos = $self->pos( $this ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | CORE::return( CORE::defined( $pos ) ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 5 | CORE::return( $self->_number( CORE::scalar( CORE::grep( /^$this$/, @$self ) ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1 | ▶ | sub fifth { CORE::return( CORE::shift->get_null(4) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fifth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | sub filter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 2 | my( $code, $this ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 2 | ▶ | CORE::return if( ref( $code ) ne 'CODE' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 2 | my $n = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | CORE::return( $self->map(sub | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 10 | local $_ = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 10 | ▶ | my $rv = $code->( ( defined( $this ) ? $this : () ), $_, ++$n, $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 10 | ▶ | CORE::return if( !$rv ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 6 | CORE::return( $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 2 | }) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 14 | ▶ | sub first { CORE::return( CORE::shift->get_null(0) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | sub for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 37 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for: called CC=16 SCAR=27.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 37 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 37 | my $code = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 37 | ▶ | CORE::return if( ref( $code ) ne 'CODE' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 37 | $self->return_reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 37 | ▶ | CORE::for( my $i = 0; $i < CORE::scalar( @$self ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 244 | local $_ = $self->[ $i ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 244 | my $rv = $code->( $i, $self->[ $i ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 244 | ▶ | CORE::last if( CORE::defined( $rv ) && CORE::length( "$rv" ) && ( $rv eq BREAK_LOOP || !$rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
defined $rv and CORE::length "$rv" and $rv eq "BREAK" || !$rv
defined $rv and CORE::length "$rv"
$rv eq "BREAK" or not $rv
MC/DC75%3/4
defined $rv and CORE::length "$rv" and $rv eq "BREAK" || !$rv
defined $rv
CORE::length "$rv"
$rv eq "BREAK"
not $rv
Truth table80%4/5
A and B and C or not(D)
A= defined $rvB= CORE::length "$rv"C= $rv eq "BREAK"D= not $rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 241 | ▶ | if( defined( my $ret = $self->return ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 17 | $rv = $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 17 | $self->return_reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # If it's a scalar ref, dereference it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 241 | ▶ | my $value = ref( $rv ) eq 'SCALAR' ? $$rv : $rv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 241 | ▶ | CORE::last if( defined( $value ) && length( $value ) && ( $value eq BREAK_LOOP || !$value ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
defined $value and CORE::length $value and $value eq "BREAK" || !$value
defined $value and CORE::length $value
$value eq "BREAK" or not $value
MC/DC50%2/4
defined $value and CORE::length $value and $value eq "BREAK" || !$value
defined $value
CORE::length $value
$value eq "BREAK"
not $value
Truth table60%3/5
A and B and C or not(D)
A= defined $valueB= CORE::length $valueC= $value eq "BREAK"D= not $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 240 | ▶ | if( ref( $rv ) eq 'SCALAR' && defined( $$rv ) && $$rv =~ /^[\-\+]?\d+$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref $rv eq "SCALAR" and defined $$rv and $$rv =~ /^[\-\+]?\d+$/
ref $rv eq "SCALAR" and defined $$rv
MC/DC33%1/3
ref $rv eq "SCALAR" and defined $$rv and $$rv =~ /^[\-\+]?\d+$/
ref $rv eq "SCALAR"
defined $$rv
$$rv =~ /^[\-\+]?\d+$/
Truth table50%2/4
A and B and C
A= ref $rv eq "SCALAR"B= defined $$rvC= $$rv =~ /^[\-\+]?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 18 | $i += int( $$rv ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 37 | $self->return_reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 37 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | sub foreach | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 37 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
foreach: called CC=13 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 37 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 37 | my $code = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 37 | ▶ | CORE::return if( ref( $code ) ne 'CODE' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # CORE::foreach my $v ( @$self ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 37 | CORE::foreach( @$self ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | # local $_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | # local $_ = $v; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # my $rv = $code->( $v ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 37 | my $rv = $code->( $_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 37 | ▶ | CORE::last if( CORE::defined( $rv ) && CORE::length( "$rv" ) && ( $rv eq BREAK_LOOP || !$rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $rv and CORE::length "$rv" and $rv eq "BREAK" || !$rv
defined $rv and CORE::length "$rv"
$rv eq "BREAK" or not $rv
MC/DC0%0/4
defined $rv and CORE::length "$rv" and $rv eq "BREAK" || !$rv
defined $rv
CORE::length "$rv"
$rv eq "BREAK"
not $rv
Truth table20%1/5
A and B and C or not(D)
A= defined $rvB= CORE::length "$rv"C= $rv eq "BREAK"D= not $rv
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 37 | ▶ | if( defined( my $ret = $self->return ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $rv = $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | $self->return_reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | # If it's a scalar ref, dereference it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 37 | ▶ | my $value = ref( $rv ) eq 'SCALAR' ? $$rv : $rv; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 37 | ▶ | CORE::last if( defined( $value ) && length( $value ) && ( $value eq BREAK_LOOP || !$value ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
defined $value and CORE::length $value and $value eq "BREAK" || !$value
defined $value and CORE::length $value
$value eq "BREAK" or not $value
MC/DC0%0/4
defined $value and CORE::length $value and $value eq "BREAK" || !$value
defined $value
CORE::length $value
$value eq "BREAK"
not $value
Truth table20%1/5
A and B and C or not(D)
A= defined $valueB= CORE::length $valueC= $value eq "BREAK"D= not $value
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 37 | $self->return_reset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 37 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 2 | ▶ | sub fourth { CORE::return( CORE::shift->get_null(3) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fourth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | sub get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 11 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 11 | my $offset = CORE::int( CORE::shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | # offset may be out of bound, which will lead Module::Generic::Scalar to hold an undefined value or the offset exists but contains an undef value which will lead to the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 11 | ▶ | if( want( 'OBJECT' ) && ( !ref( $self->[ $offset ] ) || ( Scalar::Util::reftype( $self->[ $offset ] ) // '' ) eq 'SCALAR' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
want("OBJECT") and !ref($self->[$offset]) || (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
not ref $self->[$offset] or (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
builtin::reftype($self->[$offset]) // ""
MC/DC33%1/3
want("OBJECT") and !ref($self->[$offset]) || (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
want("OBJECT")
not ref $self->[$offset]
builtin::reftype($self->[$offset])
Truth table50%2/4
A and not(B) or C
A= want("OBJECT")B= not ref $self->[$offset]C= builtin::reftype($self->[$offset])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1 | rreturn( Module::Generic::Scalar->new( $self->[ $offset ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | # If the enclosed value is a regular ref like array or hash and user wants an object, this will trigger an error, but that is the user's fault. I think it would be bad design to prevent the error from happening and second guess what the user is trying to do. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 10 | CORE::return( $self->[ $offset ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | sub get_callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_callback: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | my $type = CORE::shift( @_ ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
CORE::shift @_ || (return $self->error('No type was provided to get the array callback.'))
MC/DC0%0/1
CORE::shift @_ || (return $self->error('No type was provided to get the array callback.'))
CORE::shift @_
Truth table0%0/2
A
A= CORE::shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | CORE::return( $self->error( "No type was provided to get the array callback." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | ▶ | unless( $type eq 'add' || $type eq 'remove' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "add" or $type eq "remove"
MC/DC0%0/2
$type eq "add" or $type eq "remove"
$type eq "add"
$type eq "remove"
Truth table0%0/3
A or B
A= $type eq "add"B= $type eq "remove"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | CORE::return( $self->error( "Unsupported callback type '$type'. You can only use 'add' or 'remove'." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $tie = tied( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | CORE::return if( !$tie ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | CORE::return( $tie->get_callback( $type ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | sub get_null | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 38 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_null: called CC=10 SCAR=24.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 38 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 38 | my $offset = CORE::int( CORE::shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 38 | ▶ | if( CORE::defined( $self->[ $offset ] ) && CORE::length( $self->[ $offset ] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->[$offset] and CORE::length $self->[$offset]
MC/DC100%2/2
defined $self->[$offset] and CORE::length $self->[$offset]
defined $self->[$offset]
CORE::length $self->[$offset]
Truth table100%3/3
A and B
A= defined $self->[$offset]B= CORE::length $self->[$offset]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 35 | ▶ | if( want( 'OBJECT' ) && ( !ref( $self->[ $offset ] ) || ( Scalar::Util::reftype( $self->[ $offset ] ) // '' ) eq 'SCALAR' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
want("OBJECT") and !ref($self->[$offset]) || (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
not ref $self->[$offset] or (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
builtin::reftype($self->[$offset]) // ""
MC/DC33%1/3
want("OBJECT") and !ref($self->[$offset]) || (builtin::reftype($self->[$offset]) // "") eq "SCALAR"
want("OBJECT")
not ref $self->[$offset]
builtin::reftype($self->[$offset])
Truth table50%2/4
A and not(B) or C
A= want("OBJECT")B= not ref $self->[$offset]C= builtin::reftype($self->[$offset])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 3 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 3 | rreturn( Module::Generic::Scalar->new( $self->[ $offset ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | # If the enclosed value is a regular ref like array or hash and user wants an object, this will trigger an error, but that is the user's fault. I think it would be bad design to prevent the error from happening and second guess what the user is trying to do. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 32 | CORE::return( $self->[ $offset ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 3 | ▶ | if( Wanted::want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 1 | ▶ | $self->_load_class( 'Module::Generic::Null' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | die( "Unable to load module Module::Generic::Null" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 1 | rreturn( Module::Generic::Null->new( wants => 'object' ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 2 | CORE::return( $self->[ $offset ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | sub grep | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grep: called CC=7 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 5 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 5 | my $expr = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 5 | ▶ | my $invert = ( @_ ? CORE::shift( @_ ) : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 5 | my $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 5 | my $i = -1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 5 | ▶ | if( ref( $expr ) eq 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 3 | ▶ | $ref = ( $invert ? [CORE::grep( !$expr->( $_, ++$i ), @$self )] : [CORE::grep( $expr->( $_, ++$i ), @$self )] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 2 | ▶ | $expr = ref( $expr ) eq 'Regexp' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | ? $expr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | : qr/\Q$expr\E/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 2 | ▶ | $ref = ( $invert ? [ CORE::grep( $_ !~ /$expr/, @$self ) ] : [ CORE::grep( $_ =~ /$expr/, @$self ) ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 5 | ▶ | if( Wanted::want( 'LIST' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | CORE::return( @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 5 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 1 | ▶ | sub has { CORE::return( CORE::shift->exists( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | sub has_callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_callback: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | my $type = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my $tie = tied( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | ▶ | CORE::return(0) if( !$tie ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | if( defined( $type ) && CORE::length( $type // '' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
defined $type and CORE::length($type // "")
$type // ""
MC/DC0%0/2
defined $type and CORE::length($type // "")
defined $type
$type
Truth table0%0/3
A and B
A= defined $typeB= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | ▶ | unless( $type eq 'add' || $type eq 'remove' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "add" or $type eq "remove"
MC/DC0%0/2
$type eq "add" or $type eq "remove"
$type eq "add"
$type eq "remove"
Truth table0%0/3
A or B
A= $type eq "add"B= $type eq "remove"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | CORE::return( $self->error( "Unsupported callback type '$type'. You can only use 'add' or 'remove'." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | CORE::return( $tie->has_callback( $type ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | # No type was provided | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | CORE::return( $tie->has_callback( 'add' ) || $tie->has_callback( 'remove' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$tie->has_callback('add') || $tie->has_callback('remove')
MC/DC0%0/2
$tie->has_callback('add') || $tie->has_callback('remove')
$tie->has_callback('add')
$tie->has_callback('remove')
Truth table0%0/3
A || B
A= $tie->has_callback('add')B= $tie->has_callback('remove')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | # Same as get. Maybe I should alias it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | sub index | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index: called CC=6 SCAR=19.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 14 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 14 | my $pos = CORE::int( CORE::shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 14 | ▶ | if( want( 'OBJECT' ) && ( !ref( $self->[ $pos ] ) || ( Scalar::Util::reftype( $self->[ $pos ] ) // '' ) eq 'SCALAR' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
want("OBJECT") and !ref($self->[$pos]) || (builtin::reftype($self->[$pos]) // "") eq "SCALAR"
not ref $self->[$pos] or (builtin::reftype($self->[$pos]) // "") eq "SCALAR"
builtin::reftype($self->[$pos]) // ""
MC/DC33%1/3
want("OBJECT") and !ref($self->[$pos]) || (builtin::reftype($self->[$pos]) // "") eq "SCALAR"
want("OBJECT")
not ref $self->[$pos]
builtin::reftype($self->[$pos])
Truth table50%2/4
A and not(B) or C
A= want("OBJECT")B= not ref $self->[$pos]C= builtin::reftype($self->[$pos])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 1 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 1 | rreturn( Module::Generic::Scalar->new( $self->[ $pos ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 13 | CORE::return( $self->[ $pos ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | sub intersection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
intersection: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 2 | my $other = $self->new( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 2 | my $hash = $self->as_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 2 | ▶ | my $new = $other->grep(sub{ CORE::exists( $hash->{ $_ } ) }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 2 | CORE::return( $new ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 4 | ▶ | sub is_empty { CORE::return( CORE::scalar( @{$_[0]} ) ? $FALSE : $TRUE ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_empty: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | # sub iterator { CORE::return( Module::Generic::Iterator->new( CORE::shift( @_ ) ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | sub iterator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iterator: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | $self->_load_class( 'Module::Generic::Iterator' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | die( "Unable to load module Module::Generic::Iterator" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | CORE::return( Module::Generic::Iterator->new( $self ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | sub join | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
join: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 11 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 11 | CORE::return( $self->_scalar( CORE::join( CORE::shift( @_ ), @$self, @_ ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | sub keys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keys: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 10 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | 10 | ▶ | CORE::return( [] ) if( !scalar( @$self ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 10 | my @indices = ( 0 .. $#$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 10 | CORE::return( $self->new( \@indices ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 6 | ▶ | sub last { CORE::return( CORE::shift->get_null(-1) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 146 | ▶ | sub length { CORE::return( $_[0]->_number( CORE::scalar( @{$_[0]} ) ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 14 | ▶ | sub list { CORE::return( @{$_[0]} ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | sub map | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 6 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 6 | my $code = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 6 | ▶ | CORE::return if( ref( $code ) ne 'CODE' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 6 | my $ref = [ CORE::map( $code->( $_ ), @$self ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 6 | ▶ | if( Wanted::want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 1 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | elsif( Wanted::want( 'LIST' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 1 | CORE::return( @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 4 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | sub max | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 2 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 2 | CORE::return( Module::Generic::Scalar->new( List::Util::max( @$self ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | sub merge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge: called CC=5 SCAR=17.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | # First check before modifying anything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 1 | for( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 1 | ▶ | CORE::return( $self->error( "Value provided (", overload::StrVal( $_ ), ") is not an Module::Generic::Array object." ) ) if( !Scalar::Util::blessed( $_ ) || !$_->isa( 'Module::Generic::Array' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($_) and $_->isa("Module::Generic::Array")
MC/DC0%0/2
builtin::blessed($_) and $_->isa("Module::Generic::Array")
builtin::blessed($_)
$_->isa("Module::Generic::Array")
Truth table33%1/3
A and B
A= builtin::blessed($_)B= $_->isa("Module::Generic::Array")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | # Now, we modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 1 | for( @_ ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 1 | CORE::push( @$self, @$_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | sub min | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | 1 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 1 | CORE::return( Module::Generic::Scalar->new( List::Util::min( @$self ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 1 | ▶ | sub ninth { CORE::return( CORE::shift->get_null(8) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ninth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 1 | ▶ | sub object { CORE::return( $_[0] ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
object: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | # Credits: <https://www.perlmonks.org/?node_id=871696> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | sub odd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
odd: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 1 | my @new = @$self[ CORE::grep( ($_ % 2), 0..$#$self ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 1 | CORE::return( $self->new( \@new ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | sub offset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
offset: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 5 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 5 | my( $pos, $len ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 5 | ▶ | if( CORE::scalar( @_ ) >= 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | CORE::return( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 4 | ▶ | int( $len ) < 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | ? $self->new( [ @$self[ ( int( $pos ) + int( $len ) )..int( $pos ) ] ] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | : $self->new( [ @$self[ int( $pos )..( int( $pos ) + ( int( $len ) - 1 ) ) ] ] ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 1 | CORE::return( $self->new( [ @$self[ int( $pos )..$#$self ] ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | sub pack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pack: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 1 | CORE::return( $self->_scalar( CORE::pack( $_[0], @$self ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | sub pass_error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pass_error: not called CC=24 SCAR=63.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 0 | ▶ | my $class = ref( $self ) || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 0 | my $opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | my $err; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | my $ex_class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 23 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my $repo = Module::Generic::Global->new( 'errors' => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | if( scalar( @_ ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | # Either an hash defining a new error and this will be passed along to error(); or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | # an hash with a single property: { class => 'Some::ExceptionClass' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | ▶ | if( CORE::scalar( @_ ) == 1 && CORE::ref( $_[0] ) eq 'HASH' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @_ == 1 and ref $_[0] eq "HASH"
MC/DC0%0/2
scalar @_ == 1 and ref $_[0] eq "HASH"
scalar @_ == 1
ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= scalar @_ == 1B= ref $_[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 0 | $opts = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | # $self->pass_error( $error_object, { class => 'Some::ExceptionClass' } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | if( CORE::scalar( @_ ) > 1 && CORE::ref( $_[-1] ) eq 'HASH' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @_ > 1 and ref $_[-1] eq "HASH"
MC/DC0%0/2
scalar @_ > 1 and ref $_[-1] eq "HASH"
scalar @_ > 1
ref $_[-1] eq "HASH"
Truth table0%0/3
A and B
A= scalar @_ > 1B= ref $_[-1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | $opts = CORE::pop( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 0 | $err = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | # We set $ex_class only if the hash provided is a one-element hash and not an error-defining hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 0 | ▶ | $ex_class = CORE::delete( $opts->{class} ) if( CORE::scalar( CORE::keys( %$opts ) ) == 1 && [CORE::keys( %$opts )]->[0] eq 'class' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar CORE::keys %$opts == 1 and [CORE::keys %$opts]->[0] eq "class"
MC/DC0%0/2
scalar CORE::keys %$opts == 1 and [CORE::keys %$opts]->[0] eq "class"
scalar CORE::keys %$opts == 1
[CORE::keys %$opts]->[0] eq "class"
Truth table0%0/3
A and B
A= scalar CORE::keys %$opts == 1B= [CORE::keys %$opts]->[0] eq "class"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | # called with no argument, most likely from the same class to pass on an error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | # set up earlier by another method; or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | # with an hash containing just one argument class => 'Some::ExceptionClass' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | ▶ | if( !CORE::defined( $err ) && ( !CORE::scalar( @_ ) || CORE::defined( $ex_class ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
not defined $err and !scalar(@_) || defined $ex_class
not scalar @_ or defined $ex_class
MC/DC0%0/3
not defined $err and !scalar(@_) || defined $ex_class
not defined $err
not scalar @_
defined $ex_class
Truth table0%0/4
not(A) and not(B) or C
A= not defined $errB= not scalar @_C= defined $ex_class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | 0 | my $error = $repo->get; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | if( !CORE::defined( $error ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | ▶ | warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" ) if( warnings::enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | ▶ | $err = ( CORE::defined( $ex_class ) ? bless( $error => $ex_class ) : $error ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | ▶ | elsif( CORE::defined( $err ) && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/12
defined $err and builtin::blessed($err) and scalar @_ == 1 || scalar @_ == 2 && defined $ex_class
defined $err and builtin::blessed($err)
scalar @_ == 1 or scalar @_ == 2 and defined $ex_class
scalar @_ == 2 and defined $ex_class
MC/DC0%0/5
defined $err and builtin::blessed($err) and scalar @_ == 1 || scalar @_ == 2 && defined $ex_class
defined $err
builtin::blessed($err)
scalar @_ == 1
scalar @_ == 2
defined $ex_class
Truth table0%0/6
A and B and C or D and E
A= defined $errB= builtin::blessed($err)C= scalar @_ == 1D= scalar @_ == 2E= defined $ex_class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | Scalar::Util::blessed( $err ) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | ( CORE::scalar( @_ ) == 1 || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | ( CORE::scalar( @_ ) == 2 && CORE::defined( $ex_class ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | ▶ | my $o = ( CORE::defined( $ex_class ) ? bless( $err => $ex_class ) : $err ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | $repo->set( $o ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | # $ERROR = $o; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | # If the error provided is not an object, we call error to create one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | return( $self->error( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | if( want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | # try-catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | ▶ | if( !$self->_is_class_loaded( 'Module::Generic::Null' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | eval( 'require Module::Generic::Null' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | ▶ | die( "Unable to load module Module::Generic::Null" ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | my $null = Module::Generic::Null->new( $err, { has_error => 1 }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 0 | rreturn( $null ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | sub pop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 5 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pop: called CC=6 SCAR=20.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | 5 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | 5 | ▶ | if( Wanted::want( 'OBJECT' ) && ( !ref( $self->[-1] ) || ( Scalar::Util::reftype( $self->[-1] ) // '' ) eq 'SCALAR' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
Wanted::want("OBJECT") and !ref($self->[-1]) || (builtin::reftype($self->[-1]) // "") eq "SCALAR"
not ref $self->[-1] or (builtin::reftype($self->[-1]) // "") eq "SCALAR"
builtin::reftype($self->[-1]) // ""
MC/DC33%1/3
Wanted::want("OBJECT") and !ref($self->[-1]) || (builtin::reftype($self->[-1]) // "") eq "SCALAR"
Wanted::want("OBJECT")
not ref $self->[-1]
builtin::reftype($self->[-1])
Truth table50%2/4
A and not(B) or C
A= Wanted::want("OBJECT")B= not ref $self->[-1]C= builtin::reftype($self->[-1])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | 1 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 1 | rreturn( Module::Generic::Scalar->new( CORE::pop( @$self ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | 4 | CORE::return( CORE::pop( @$self ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | sub pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pos: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | my $this = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | CORE::return if( !CORE::length( $this ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | my $is_ref = ref( $this ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | ▶ | my $ref = $is_ref ? Scalar::Util::refaddr( $this ) : $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | foreach my $i ( 0 .. $#$self ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 0 | ▶ | if( ( $is_ref && Scalar::Util::refaddr( $self->[$i] ) eq $ref ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$is_ref and builtin::refaddr($self->[$i]) eq $ref or not $is_ref and $self->[$i] eq $this
$is_ref and builtin::refaddr($self->[$i]) eq $ref
not $is_ref and $self->[$i] eq $this
MC/DC0%0/4
$is_ref and builtin::refaddr($self->[$i]) eq $ref or not $is_ref and $self->[$i] eq $this
$is_ref
builtin::refaddr($self->[$i]) eq $ref
not $is_ref
$self->[$i] eq $this
Truth table0%0/7
A and B or not(C) and D
A= $is_refB= builtin::refaddr($self->[$i]) eq $refC= not $is_refD= $self->[$i] eq $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | ( !$is_ref && $self->[$i] eq $this ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | CORE::return( $i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | sub prepend { CORE::return( CORE::shift->unshift( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prepend: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | sub push | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 297 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 297 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 297 | CORE::push( @$self, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 297 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | sub push_arrayref | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push_arrayref: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 1 | my $ref = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | 1 | ▶ | CORE::return( $self->error( "Data provided ($ref) is not an array reference." ) ) if( !UNIVERSAL::isa( $ref, 'ARRAY' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 1 | CORE::push( @$self, @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | # Implementation of JavaScript reduce in perl. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | # This is different from the one in List::Util that departs from its JavaScript counterpart. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | # Ours is strictly compliant | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | # See <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | sub reduce | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reduce: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | ▶ | my $cb = CORE::shift( @_ ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
CORE::shift @_ || (return $self->error('No callback anonymous subroutine or reference to a subroutine was provided.'))
MC/DC0%0/1
CORE::shift @_ || (return $self->error('No callback anonymous subroutine or reference to a subroutine was provided.'))
CORE::shift @_
Truth table0%0/2
A
A= CORE::shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | CORE::return( $self->error( "No callback anonymous subroutine or reference to a subroutine was provided." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | if( ref( $cb ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | 0 | CORE::return( $self->error( "No callback anonymous subroutine or reference to a subroutine was provided." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | elsif( !CORE::scalar( @$self ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | CORE::return( $self->error( "Array object is empty. Nothing to run reduce on." ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $init; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | $init = CORE::shift( @_ ) if( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | my( $accumulator, $pos ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | ▶ | if( CORE::defined( $init ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | ( $accumulator, $pos ) = ( $init, 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | ( $accumulator, $pos ) = ( $self->[0], 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | ▶ | for( my $i = $pos; $i < CORE::scalar( @$self ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | # try-catch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | eval | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | local $_ = $self->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | $accumulator = $cb->( $accumulator, $self->[$i], $i ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | ▶ | if( $@ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | CORE::return( $self->error( "Error calling reduce callback: $@" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | CORE::return( $accumulator ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | sub remove | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove: called CC=7 SCAR=24.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 1 | my $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | 1 | ▶ | if( CORE::scalar( @_ ) == 1 && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%2/6
scalar @_ == 1 and builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Array")
scalar @_ == 1 and builtin::blessed($_[0])
MC/DC0%0/3
scalar @_ == 1 and builtin::blessed($_[0]) and $_[0]->isa("Module::Generic::Array")
scalar @_ == 1
builtin::blessed($_[0])
$_[0]->isa("Module::Generic::Array")
Truth table25%1/4
A and B and C
A= scalar @_ == 1B= builtin::blessed($_[0])C= $_[0]->isa("Module::Generic::Array")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | Scalar::Util::blessed( $_[0] ) && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | $_[0]->isa( 'Module::Generic::Array' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 0 | $ref = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | ▶ | elsif( CORE::scalar( @_ ) == 1 && | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition20%1/5
scalar @_ == 1 and (builtin::reftype($_[0]) // "") eq "ARRAY"
builtin::reftype($_[0]) // ""
MC/DC0%0/2
scalar @_ == 1 and (builtin::reftype($_[0]) // "") eq "ARRAY"
scalar @_ == 1
builtin::reftype($_[0])
Truth table33%1/3
A and B
A= scalar @_ == 1B= builtin::reftype($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | ( Scalar::Util::reftype( $_[0] ) // '' ) eq 'ARRAY' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | $ref = $self->new( CORE::shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | 1 | $ref = $self->new( [ @_ ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 1 | my $hash = $ref->as_hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 1 | my @res = grep{ !CORE::exists( $hash->{ $_ } ) } @$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 1 | @$self = @res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | sub replace | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
replace: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | my( $old, $new ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | my $pos = $self->pos( $old ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | ▶ | CORE::return if( !defined( $pos ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | $self->[ $pos ] = $new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | 0 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | sub reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 2 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | warn( "Warning only: ", ref( $self ), "::reset() called with ", CORE::scalar( @_ ), " arguments, but I was not expecting any. Called from package \"", [caller]->[0], "\" at line ", [caller]->[2], " from subroutine ", [caller]->[3], "\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | 2 | @$self = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 2 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | sub return | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | 294 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
return: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 294 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 294 | my $repo = Module::Generic::Global->new( 'return' => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | 294 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 16 | my $this = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | 16 | my $val = \$this; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 16 | $repo->set( $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | 16 | ▶ | CORE::return( '' ) if( !CORE::defined( $$val ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 294 | CORE::return( $repo->get ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | sub return_reset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 128 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
return_reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 128 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | 128 | my $repo = Module::Generic::Global->new( 'return' => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 128 | my $val = $repo->get; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | 128 | $repo->remove; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 128 | CORE::return( $val ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | sub reverse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reverse: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 13 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 13 | my $ref = [ CORE::reverse( @$self ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | 13 | ▶ | if( wantarray() ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | CORE::return( @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 13 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | ▶ | sub scalar { CORE::return( CORE::shift->length ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scalar: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | 3 | ▶ | sub second { CORE::return( CORE::shift->get_null(1) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
second: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | sub set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set: called CC=5 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 14 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 14 | ▶ | my $ref = ( CORE::scalar( @_ ) == 1 && ( ( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'ARRAY' ) ) || ref( $_[0] ) eq 'ARRAY' ) ) ? CORE::shift( @_ ) : [ @_ ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
scalar @_ == 1 and builtin::blessed($_[0]) && $_[0]->isa("ARRAY") || ref $_[0] eq "ARRAY"
builtin::blessed($_[0]) and $_[0]->isa("ARRAY") or ref $_[0] eq "ARRAY"
builtin::blessed($_[0]) and $_[0]->isa("ARRAY")
MC/DC0%0/4
scalar @_ == 1 and builtin::blessed($_[0]) && $_[0]->isa("ARRAY") || ref $_[0] eq "ARRAY"
scalar @_ == 1
builtin::blessed($_[0])
$_[0]->isa("ARRAY")
ref $_[0] eq "ARRAY"
Truth table16%1/6
A and B and C or D
A= scalar @_ == 1B= builtin::blessed($_[0])C= $_[0]->isa("ARRAY")D= ref $_[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 14 | @$self = @$ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 14 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 1 | ▶ | sub seventh { CORE::return( CORE::shift->get_null(6) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seventh: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | sub shift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
shift: called CC=6 SCAR=20.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 4 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | 4 | ▶ | if( Wanted::want( 'OBJECT' ) && ( !ref( $self->[0] ) || ( Scalar::Util::reftype( $self->[0] ) // '' ) eq 'SCALAR' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition37%3/8
Wanted::want("OBJECT") and !ref($self->[0]) || (builtin::reftype($self->[0]) // "") eq "SCALAR"
not ref $self->[0] or (builtin::reftype($self->[0]) // "") eq "SCALAR"
builtin::reftype($self->[0]) // ""
MC/DC33%1/3
Wanted::want("OBJECT") and !ref($self->[0]) || (builtin::reftype($self->[0]) // "") eq "SCALAR"
Wanted::want("OBJECT")
not ref $self->[0]
builtin::reftype($self->[0])
Truth table50%2/4
A and not(B) or C
A= Wanted::want("OBJECT")B= not ref $self->[0]C= builtin::reftype($self->[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | 1 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 1 | rreturn( Module::Generic::Scalar->new( CORE::shift( @$self ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | 3 | CORE::return( CORE::shift( @$self ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | 1 | ▶ | sub sixth { CORE::return( CORE::shift->get_null(5) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sixth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | 1 | ▶ | sub size { CORE::return( $_[0]->_number( $#{$_[0]} ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
size: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | sub sort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 65 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sort: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | 65 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 65 | my $code = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 65 | my $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | 65 | ▶ | if( ref( $code ) eq 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | $ref = [sort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 1 | $code->( $a, $b ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } @$self]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 64 | $ref = [ CORE::sort( @$self ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 65 | ▶ | if( Wanted::want( 'LIST' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | CORE::return( @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 65 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | sub splice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 28 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
splice: called CC=16 SCAR=34.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 28 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | 28 | my( $offset, $length, @list ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 28 | ▶ | if( defined( $offset ) && int( $offset ) !~ /^\-?\d+$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $offset and not int($offset) =~ /^\-?\d+$/
MC/DC0%0/2
defined $offset and not int($offset) =~ /^\-?\d+$/
defined $offset
not int($offset) =~ /^\-?\d+$/
Truth table66%2/3
A and not(B)
A= defined $offsetB= not int($offset) =~ /^\-?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | ▶ | warn( "Offset provided for splice \"$offset\" is not an integer.\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | ## If a list was provided, the user is not looking to get an element removed, but add it, so we return out object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | CORE::return( $self ) if( CORE::scalar( @list ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 28 | ▶ | if( defined( $length ) && int( $length ) !~ /^\-?\d+$/ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $length and not int($length) =~ /^\-?\d+$/
MC/DC0%0/2
defined $length and not int($length) =~ /^\-?\d+$/
defined $length
not int($length) =~ /^\-?\d+$/
Truth table66%2/3
A and not(B)
A= defined $lengthB= not int($length) =~ /^\-?\d+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | warn( "Length provided for splice \"$length\" is not an integer.\n" ) if( $self->_warnings_is_enabled( 'Module::Generic' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | ▶ | CORE::return( $self ) if( CORE::scalar( @list ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | # Adding elements, so we return our object and allow chaining | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | # @_ = offset, length, replacement list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 28 | ▶ | if( CORE::scalar( @_ ) > 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | 3 | CORE::splice( @$self, int( $offset ), int( $length ), @list ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | 3 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | elsif( !CORE::scalar( @_ ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 1 | CORE::splice( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 24 | ▶ | if( CORE::defined( $offset ) && CORE::defined( $length ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $offset and defined $length
MC/DC50%1/2
defined $offset and defined $length
defined $offset
defined $length
Truth table66%2/3
A and B
A= defined $offsetB= defined $length
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 23 | ▶ | if( Wanted::want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | 1 | rreturn( $self->new( [CORE::splice( @$self, int( $offset ), int( $length ) )] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 22 | CORE::return( CORE::splice( @$self, int( $offset ), int( $length ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | elsif( CORE::defined( $offset ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 1 | ▶ | if( Wanted::want( 'OBJECT' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 1 | rreturn( $self->new( [CORE::splice( @$self, int( $offset ) )] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | CORE::return( CORE::splice( @$self, int( $offset ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | # my $a = $ar->split( qr/[[:blank:]\h]+/, "I disapprove of what you say, but I will defend to the death your right to say it" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 2 | ▶ | sub split { CORE::return( CORE::shift->_scalar( CORE::splice( @_, 1, 1 ) )->split( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
split: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | 1 | ▶ | sub tenth { CORE::return( CORE::shift->get_null(9) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tenth: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 3 | ▶ | sub third { CORE::return( CORE::shift->get_null(2) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
third: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | sub unchomp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unchomp: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 0 | ▶ | my $nl = CORE::scalar( @_ ) ? CORE::shift( @_ ) : $/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | $_ .= $nl for( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 0 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | sub undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
undef: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 1 | @$self = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | sub unique | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unique: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 2 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 2 | my $self_update = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | 2 | ▶ | $self_update = CORE::shift( @_ ) if( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 2 | my @new = List::Util::uniq( @$self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 2 | ▶ | CORE::return( $self->new( \@new ) ) unless( $self_update ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | 1 | @$self = @new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | 1 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | sub unshift | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unshift: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 3 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 3 | CORE::unshift( @$self, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | 3 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | sub values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
values: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 1 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 1 | my $ref = [ @$self ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | 1 | ▶ | if( Wanted::want( 'LIST' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 0 | CORE::return( @$ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 1 | CORE::return( $self->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | sub _boolean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_boolean: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | sub _is_class_loaded | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 184 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_class_loaded: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 184 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | 184 | my $class = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 184 | ( my $pm = $class ) =~ s{::}{/}gs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 184 | $pm .= '.pm'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | 184 | ▶ | CORE::return(1) if( CORE::exists( $INC{ $pm } ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 2 | CORE::return(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | sub _load_class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 184 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_class: called CC=10 SCAR=25.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | 184 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 184 | my $class = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 184 | ▶ | die( "No class was provided to load." ) if( !$class ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 184 | my $args = [@_]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 184 | my $is_loaded = $self->_is_class_loaded( $class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 184 | ▶ | if( $is_loaded ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 182 | ▶ | if( CORE::scalar( @$args ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | ▶ | my $pl = "$class->import(" . ( CORE::scalar( @$args ) ? "'" . CORE::join( "', '", @$args ) . "'" : '' ) . ");"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | eval( $pl ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | ▶ | CORE::return( $self->error( "Error importing class $class: $@" ) ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 182 | CORE::return( $class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 2 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | 2 | ▶ | local $SIG{__DIE__} = sub{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | # Load the module with thread safety | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | 2 | ▶ | my $key = HAS_THREADS ? CORE::join( ';', $class, threads->tid() ) : $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 2 | my $repo = Module::Generic::Global->new( 'loaded_classes' => CORE::ref( $self ), key => $key ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 2 | my $pl = "require $class;"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | 2 | eval( $pl ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 2 | ▶ | CORE::return( $self->error( "Unable to load package ${class}: $@\nCode executed was:\n${pl}" ) ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 2 | ▶ | $pl = "$class->import(" . ( CORE::scalar( @$args ) ? "'" . CORE::join( "', '", @$args ) . "'" : '' ) . ");"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 2 | eval( $pl ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | 2 | ▶ | CORE::return( $self->error( "Error importing class $class: $@" ) ) if( $@ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | 2 | $repo->set(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 2 | CORE::return( $class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | sub _number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 152 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_number: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 152 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | 152 | my $num = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 152 | ▶ | CORE::return if( !defined( $num ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 152 | ▶ | CORE::return( $num ) if( !CORE::length( $num ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 152 | ▶ | $self->_load_class( 'Module::Generic::Number' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | die( "Unable to load module Module::Generic::Number" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | 152 | CORE::return( Module::Generic::Number->new( $num ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | sub _obj_eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | 40 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_obj_eq: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | 23 | ▶ | no overloading; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 40 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 40 | my $other = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | ## Sorted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 40 | my $strA = $self->as_string(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 40 | my $strB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | 40 | ▶ | if( Scalar::Util::blessed( $other ) && $other->isa( 'Module::Generic::Array' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
builtin::blessed($other) and $other->isa("Module::Generic::Array")
MC/DC50%1/2
builtin::blessed($other) and $other->isa("Module::Generic::Array")
builtin::blessed($other)
$other->isa("Module::Generic::Array")
Truth table66%2/3
A and B
A= builtin::blessed($other)B= $other->isa("Module::Generic::Array")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 3 | $strB = $other->as_string(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | # Compare error message | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | ▶ | elsif( ( Scalar::Util::reftype( $other ) // '' ) eq 'ARRAY' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
builtin::reftype($other) // ""
MC/DC100%1/1
builtin::reftype($other) // ""
builtin::reftype($other)
Truth table100%2/2
A
A= builtin::reftype($other)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | 4 | $strB = $self->new( $other )->as_string(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 33 | CORE::return( 0 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 7 | CORE::return( $strA eq $strB ) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | sub _scalar | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_scalar: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | 14 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 14 | my $str = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | 14 | ▶ | CORE::return if( !defined( $str ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | # Whether empty or not, return an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | 14 | ▶ | $self->_load_class( 'Module::Generic::Scalar' ) || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | die( "Unable to load module Module::Generic::Scalar" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | 14 | CORE::return( Module::Generic::Scalar->new( $str ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 1 | ▶ | sub _warnings_is_enabled { CORE::return( warnings::enabled( $_[1] || 'Module::Generic' ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_warnings_is_enabled: called CC=2 SCAR=7.6
Condition50%1/2
$_[1] || 'Module::Generic'
MC/DC0%0/1
$_[1] || 'Module::Generic'
$_[1]
Truth table50%1/2
A
A= $_[1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | sub DESTROY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 914 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=4 SCAR=14.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | # <https://perldoc.perl.org/perlobj#Destructors> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | 914 | CORE::local( $., $@, $!, $^E, $? ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | 914 | ▶ | CORE::return if( Module::Generic::_in_global_destruction() ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | 914 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 914 | ▶ | CORE::return if( !CORE::defined( $self ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | 914 | foreach my $k ( qw( return errors ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | 1828 | my $repo = Module::Generic::Global->new( $k => $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | 1828 | $repo->remove; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | # For non-object context, we need to call cleanup to ensure there is no leftover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | # We cannot cleanup here the 'loaded_classes7, because we need the class that is cached to build the key, and we do not have it at this very moment. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | sub FREEZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FREEZE: called CC=4 SCAR=14.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | 3 | my $self = CORE::shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 3 | ▶ | my $serialiser = CORE::shift( @_ ) // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
CORE::shift @_ // ""
MC/DC0%0/1
CORE::shift @_ // ""
CORE::shift @_
Truth table50%1/2
A
A= CORE::shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 3 | my $class = CORE::ref( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | 3 | my @array = @$self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | # Return an array reference rather than a list so this works with Sereal and CBOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | # On or before Sereal version 4.023, Sereal did not support multiple values returned | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 3 | ▶ | if( $serialiser eq 'Sereal' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 1 | require Sereal::Encoder; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | 1 | require version; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | 1 | ▶ | if( version->parse( Sereal::Encoder->VERSION ) <= version->parse( '4.023' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | CORE::return( [$class, \@array] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | # But Storable want a list with the first element being the serialised element | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | 3 | CORE::return( $class, \@array ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | 2 | ▶ | sub STORABLE_freeze { CORE::return( CORE::shift->FREEZE( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_freeze: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 2 | ▶ | sub STORABLE_thaw { CORE::return( CORE::shift->THAW( @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORABLE_thaw: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | # NOTE: CBOR will call the THAW method with the stored classname as first argument, the constant string CBOR as second argument, and all values returned by FREEZE as remaining arguments. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | # NOTE: Storable calls it with a blessed object it created followed with $cloning and any other arguments initially provided by STORABLE_freeze | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | sub THAW | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
THAW: called CC=10 SCAR=29.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | 3 | my( $self, undef, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 3 | ▶ | my $ref = ( CORE::scalar( @args ) == 1 && CORE::ref( $args[0] ) eq 'ARRAY' ) ? CORE::shift( @args ) : \@args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
scalar @args == 1 and ref $args[0] eq "ARRAY"
MC/DC0%0/2
scalar @args == 1 and ref $args[0] eq "ARRAY"
scalar @args == 1
ref $args[0] eq "ARRAY"
Truth table33%1/3
A and B
A= scalar @args == 1B= ref $args[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | 3 | ▶ | my $class = ( CORE::defined( $ref ) && CORE::ref( $ref ) eq 'ARRAY' && CORE::scalar( @$ref ) > 1 ) ? CORE::shift( @$ref ) : ( CORE::ref( $self ) || $self ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition22%2/9
defined $ref and ref $ref eq "ARRAY" and scalar @$ref > 1
defined $ref and ref $ref eq "ARRAY"
ref $self or $self
MC/DC0%0/3
defined $ref and ref $ref eq "ARRAY" and scalar @$ref > 1
defined $ref
ref $ref eq "ARRAY"
scalar @$ref > 1
MC/DC0%0/2
ref $self or $self
ref $self
$self
Truth table25%1/4
A and B and C
A= defined $refB= ref $ref eq "ARRAY"C= scalar @$ref > 1
Truth table0%0/3
A or B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 3 | ▶ | $ref = ( CORE::scalar( @$ref ) && CORE::ref( $ref->[0] ) eq 'ARRAY' ) ? $ref->[0] : []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
scalar @$ref and ref $ref->[0] eq "ARRAY"
MC/DC0%0/2
scalar @$ref and ref $ref->[0] eq "ARRAY"
scalar @$ref
ref $ref->[0] eq "ARRAY"
Truth table33%1/3
A and B
A= scalar @$refB= ref $ref->[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | # Storable pattern requires to modify the object it created rather than returning a new one | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | 3 | ▶ | if( CORE::ref( $self ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 2 | @$self = @$ref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | 2 | CORE::return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 1 | CORE::return( $class->new( $ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | 1 | ▶ | sub TO_JSON { CORE::return( [ @{$_[0]} ] ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | # NOTE: Module::Generic::Array::Tie class | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | package | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | Module::Generic::Array::Tie; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | 23 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | 23 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | 23 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | 1 | ▶ | our $dummy_callback = sub{1}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | sub TIEARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEARRAY: called CC=19 SCAR=46.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 1 | my( $class, $opts ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | 1 | ▶ | $opts //= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts //= {}
MC/DC0%0/1
$opts //= {}
$opts
Truth table50%1/2
A
A= $opts
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | 1 | ▶ | if( ( Scalar::Util::reftype( $opts ) // '' ) ne 'HASH' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($opts) // ""
MC/DC0%0/1
builtin::reftype($opts) // ""
builtin::reftype($opts)
Truth table50%1/2
A
A= builtin::reftype($opts)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | warn( "Options provided (", overload::StrVal( $opts ), ") is not an hash reference\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 0 | $opts = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 1 | ▶ | $opts->{data} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"data"} //= []
MC/DC0%0/1
$opts->{"data"} //= []
$opts->{"data"}
Truth table50%1/2
A
A= $opts->{"data"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | 1 | ▶ | $opts->{debug} //= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opts->{"debug"} //= 0
MC/DC0%0/1
$opts->{"debug"} //= 0
$opts->{"debug"}
Truth table50%1/2
A
A= $opts->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | 1 | ▶ | if( CORE::length( $opts->{add} ) && ref( $opts->{add} ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $opts->{"add"} and ref $opts->{"add"} ne "CODE"
MC/DC0%0/2
length $opts->{"add"} and ref $opts->{"add"} ne "CODE"
length $opts->{"add"}
ref $opts->{"add"} ne "CODE"
Truth table33%1/3
A and B
A= length $opts->{"add"}B= ref $opts->{"add"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | ▶ | warn( "Code provided for the array add callback is not a code reference.\n" ) if( warnings::enabled( 'Module::Generic' ) || $opts->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $opts->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $opts->{"debug"}
warnings::enabled("Module::Generic")
$opts->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $opts->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 1 | ▶ | if( CORE::length( $opts->{remove} ) && ref( $opts->{remove} ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
length $opts->{"remove"} and ref $opts->{"remove"} ne "CODE"
MC/DC0%0/2
length $opts->{"remove"} and ref $opts->{"remove"} ne "CODE"
length $opts->{"remove"}
ref $opts->{"remove"} ne "CODE"
Truth table33%1/3
A and B
A= length $opts->{"remove"}B= ref $opts->{"remove"} ne "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 0 | ▶ | warn( "Code provided for the array remove callback is not a code reference.\n" ) if( warnings::enabled( 'Module::Generic' ) || $opts->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $opts->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $opts->{"debug"}
warnings::enabled("Module::Generic")
$opts->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $opts->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | my $ref = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | callback_add => $opts->{add}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | callback_remove => $opts->{remove}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | 1 | data => ( ( Scalar::Util::reftype( $opts->{data} ) // '' ) eq 'ARRAY' ? [@{$opts->{data}}] : [] ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | debug => $opts->{debug}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | object => $opts->{object}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 1 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
builtin::reftype($opts->{"data"}) // ""
MC/DC0%0/1
builtin::reftype($opts->{"data"}) // ""
builtin::reftype($opts->{"data"})
Truth table50%1/2
A
A= builtin::reftype($opts->{"data"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 0 | ▶ | print( STDERR ( ref( $class ) || $class ), "::TIEARRAY: Using ", CORE::scalar( @{$ref->{data}} ), " elements in array vs ", CORE::scalar( @{$opts->{data}} ), " received via opts->data.\n" ) if( $ref->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | 1 | ▶ | CORE::return( bless( $ref => ( ref( $class ) || $class ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | sub CLEAR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | ▶ | my $cb = $self->{callback_remove} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_remove'}
$Module::Generic::Array::Tie::dummy_callback
Truth table0%0/3
A || B
A= $self->{'callback_remove'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | 0 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | ▶ | warn( "No callback remove found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | 0 | my $removed = [ @$data ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | my $def = { type => 'remove', start => 0, end => $#$data, removed => $removed, data => $removed, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | 0 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | ▶ | print( STDERR ref( $self ), "::CLEAR: removing all data from 0 to ", $#$data, " -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | 0 | @{$self->{data}} = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | sub DELETE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: called CC=10 SCAR=29.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | 2 | my( $self, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 2 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 2 | ▶ | CORE::return(0) if( $key > $#$data || $key < 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$key > $data->$#* or $key < 0
MC/DC0%0/2
$key > $data->$#* or $key < 0
$key > $data->$#*
$key < 0
Truth table33%1/3
A or B
A= $key > $data->$#*B= $key < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | 2 | ▶ | my $cb = $self->{callback_remove} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_remove'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_remove'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 2 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | 0 | ▶ | warn( "No callback remove found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 2 | my $removed = [ @$data[ $key ] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | 2 | my $def = { type => 'remove', start => $key, end => $key, removed => $removed, data => $removed, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | 2 | ▶ | print( STDERR ref( $self ), "::DELETE: removing data from $key to ", ( $key + 1 ), " -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | 2 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 1 | CORE::return( CORE::splice( @$data, $key, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | sub EXISTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | my( $self, $key ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | ▶ | CORE::return(0) if( $key > $#$data || $key < 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$key > $data->$#* or $key < 0
MC/DC0%0/2
$key > $data->$#* or $key < 0
$key > $data->$#*
$key < 0
Truth table0%0/3
A or B
A= $key > $data->$#*B= $key < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | CORE::return(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | sub EXTEND | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXTEND: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | my( $self, $count ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | # This is an optional method, so we set it as a noop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | sub FETCH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | 9 | my( $self, $index ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | 9 | CORE::return( $self->{data}->[ $index ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | sub FETCHSIZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCHSIZE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | 11 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 11 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | 11 | CORE::return( $#$data + 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | sub POP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
POP: called CC=8 SCAR=25.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | 2 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 2 | ▶ | my $cb = $self->{callback_remove} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_remove'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_remove'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 2 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | 0 | ▶ | warn( "No callback remove found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | 2 | my $removed = [ @$data[ $#$data ] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | 2 | my $def = { type => 'remove', start => $#$data, end => $#$data, removed => $removed, data => $removed, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 2 | ▶ | print( STDERR ref( $self ), "::POP: removing data from ", $#$data, " to ", ( $#$data + 1 ), " -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | 2 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | 1 | CORE::return( CORE::splice( @$data, -1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | sub PUSH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
PUSH: called CC=8 SCAR=24.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 3 | my( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | 3 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | 3 | ▶ | my $cb = $self->{callback_add} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_add'}
$Module::Generic::Array::Tie::dummy_callback
Truth table66%2/3
A || B
A= $self->{'callback_add'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 3 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 3 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | ▶ | warn( "No callback add found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 3 | my $added = \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 3 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | 3 | my $def = { type => 'add', start => ( $#$data + 1 ), added => $added, data => $added, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 3 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | 3 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 3 | ▶ | print( STDERR ref( $self ), "::PUSH: adding ", CORE::scalar( @values ), " data at position ", ( $#$data + 1 ), " -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), ". Array contains ", CORE::scalar( @$data ), " elements.\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | 3 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | 2 | CORE::splice( @$data, ( $#$data + 1 ), 0, @values ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | sub SHIFT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SHIFT: called CC=6 SCAR=20.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | 2 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | 2 | ▶ | my $cb = $self->{callback_remove} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_remove'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_remove'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 2 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | ▶ | warn( "No callback remove found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 2 | my $removed = [ @$data[0] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | 2 | my $def = { type => 'remove', start => 0, end => 0, removed => $removed, data => $removed, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | 2 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 1 | CORE::return( CORE::splice( @$data, 0, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | sub SPLICE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 4 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SPLICE: called CC=19 SCAR=38.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 4 | my( $self, $offset, $len, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | 4 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 4 | my $size = $#$data + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | 4 | ▶ | $offset //= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$offset //= 0
MC/DC0%0/1
$offset //= 0
$offset
Truth table50%1/2
A
A= $offset
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 4 | ▶ | $offset += $size if( $offset < 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | 4 | ▶ | $len //= ( ( $#$data + 1 ) - $offset ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$len //= $data->$#* + 1 - $offset
MC/DC0%0/1
$len //= $data->$#* + 1 - $offset
$len
Truth table50%1/2
A
A= $len
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 4 | ▶ | print( STDERR ref( $self ), "::SPLICE: called with offset '$offset', length '$len' and ", CORE::scalar( @values ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 4 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | 4 | ▶ | if( CORE::scalar( @values ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | 2 | ▶ | my $cb = $self->{callback_add} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_add'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_add'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | ▶ | warn( "No callback add found. This should not happen.\n" ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 2 | my $added = \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | 2 | my $def = { type => 'add', start => $offset, added => $added, data => $added, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | 2 | ▶ | print( STDERR ref( $self ), "::SPLICE: adding ", CORE::scalar( @values ), " data at position $offset -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 2 | ▶ | my $cb = $self->{callback_remove} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_remove'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_remove'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_remove'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 0 | ▶ | warn( "No callback remove found. This should not happen." ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 2 | my $removed = [ @$data[ $offset..( $offset + ( $len - 1 ) ) ] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 2 | my $def = { type => 'remove', start => $offset, end => ( $offset + ( $len - 1 ) ), removed => $removed, data => $removed, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 2 | ▶ | print( STDERR ref( $self ), "::SPLICE: removing data from $offset to ", ( $offset + $len ), " -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 4 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | 2 | CORE::return( CORE::splice( @$data, $offset, $len, @values ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | sub STORE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 1 | my( $self, $index, $value ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | 1 | ▶ | my $cb = $self->{callback_add} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_add'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_add'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | 1 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1605 | 1 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1606 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1607 | 0 | ▶ | warn( "No callback add found. This should not happen." ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1610 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1611 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1612 | 1 | my $added = [ $value ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1613 | 1 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1614 | 1 | my $def = { type => 'add', start => $index, added => $added, data => $added, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1615 | 1 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1616 | 1 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1617 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1618 | 1 | ▶ | print( STDERR ref( $self ), "::STORE: adding 1 data at position $index -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1619 | 1 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1620 | 0 | $self->{data}->[ $index ] = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1621 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1623 | sub STORESIZE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1624 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORESIZE: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | my( $self, $count ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1626 | 0 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1627 | 0 | $#$data = ( $count - 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1628 | # if( $count > ( $#$data + 1 ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1629 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1630 | # $#$data = ( $count - 1 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1631 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1632 | # else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1633 | # { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1634 | # CORE::splice( @$data, ( $count - 1 ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1635 | # } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1636 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1638 | sub UNSHIFT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1639 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
UNSHIFT: called CC=9 SCAR=26.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1640 | 2 | my( $self, @values ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1641 | 2 | my $data = $self->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1642 | 2 | ▶ | my $cb = $self->{callback_add} || $dummy_callback; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
MC/DC0%0/2
$self->{'callback_add'} || $Module::Generic::Array::Tie::dummy_callback
$self->{'callback_add'}
$Module::Generic::Array::Tie::dummy_callback
Truth table33%1/3
A || B
A= $self->{'callback_add'}B= $Module::Generic::Array::Tie::dummy_callback
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1643 | 2 | my $rv; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1644 | 2 | ▶ | if( !$cb ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1645 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | ▶ | warn( "No callback add found. This should not happen." ) if( warnings::enabled( 'Module::Generic' ) || $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
warnings::enabled("Module::Generic") or $self->{"debug"}
MC/DC0%0/2
warnings::enabled("Module::Generic") or $self->{"debug"}
warnings::enabled("Module::Generic")
$self->{"debug"}
Truth table0%0/3
A or B
A= warnings::enabled("Module::Generic")B= $self->{"debug"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | $rv = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1649 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1650 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1651 | 2 | ▶ | print( STDERR ref( $self ), "::UNSHIFT: got here for values to add '", join( "', '", @values ), "' with callback '$cb'\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1652 | 2 | my $added = \@values; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1653 | 2 | my $caller = $self->get_caller; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1654 | 2 | my $def = { type => 'add', start => 0, added => $added, data => $added, 'caller' => $caller, object => $self->{object} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1655 | 2 | local $_ = $def; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1656 | 2 | $rv = $cb->( $def ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1657 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1658 | 2 | ▶ | print( STDERR ref( $self ), "::UNSHIFT: adding ", CORE::scalar( @values ), " data at position 0 -> callback returned ", ( defined( $rv ) ? 'true' : 'undef' ), "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1659 | 2 | ▶ | CORE::return if( !defined( $rv ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1660 | 1 | CORE::return( CORE::splice( @$data, 0, 0, @values ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1663 | sub UNTIE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1664 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
UNTIE: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1665 | 1 | my( $self, $ref_count ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1666 | # noop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1667 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1669 | sub get_caller | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1670 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_caller: called CC=5 SCAR=20.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1671 | 16 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1672 | 16 | my $frame = 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1673 | 16 | my $info = [caller( $frame )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1674 | 16 | ▶ | print( STDERR ref( $self ), "::get_caller: At frame $frame, called from package ", $info->[0], " at line ", $info->[2], "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1675 | 16 | ▶ | while( CORE::scalar( @$info ) && substr( $info->[0], 0, 22 ) eq 'Module::Generic::Array' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
scalar @$info and substr($info->[0], 0, 22) eq "Module::Generic::Array"
MC/DC0%0/2
scalar @$info and substr($info->[0], 0, 22) eq "Module::Generic::Array"
scalar @$info
substr($info->[0], 0, 22) eq "Module::Generic::Array"
Truth table33%1/3
A and B
A= scalar @$infoB= substr($info->[0], 0, 22) eq "Module::Generic::Array"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1676 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1677 | 0 | $info = [caller( ++$frame )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | ▶ | print( STDERR ref( $self ), "::get_caller: At frame $frame, called from package ", $info->[0], " at line ", $info->[2], "\n" ) if( $self->{debug} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1679 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1680 | 16 | CORE::return( $info ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1683 | sub has_callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1684 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_callback: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1685 | 3 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1686 | 3 | ▶ | CORE::return(1) if( ref( $self->{callback_add} ) eq 'CODE' || ref( $self->{callback_remove} ) eq 'CODE' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $self->{"callback_add"} eq "CODE" or ref $self->{"callback_remove"} eq "CODE"
MC/DC50%1/2
ref $self->{"callback_add"} eq "CODE" or ref $self->{"callback_remove"} eq "CODE"
ref $self->{"callback_add"} eq "CODE"
ref $self->{"callback_remove"} eq "CODE"
Truth table66%2/3
A or B
A= ref $self->{"callback_add"} eq "CODE"B= ref $self->{"callback_remove"} eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1687 | 1 | CORE::return(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1688 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1690 | sub set_callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1691 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_callback: called CC=6 SCAR=25.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1692 | 14 | my( $self, $what, $code ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1693 | 14 | ▶ | if( !defined( $what ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1694 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1695 | 0 | warn( "No callback type was provided. Use \"add\" or \"remove\".\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1697 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1698 | ▶ | elsif( $what ne 'add' && $what ne 'remove' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$what ne "add" and $what ne "remove"
MC/DC0%0/2
$what ne "add" and $what ne "remove"
$what ne "add"
$what ne "remove"
Truth table66%2/3
A and B
A= $what ne "add"B= $what ne "remove"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1699 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | warn( "Unknown callback type was provided: '$what'. Use \"add\" or \"remove\".\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1701 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1703 | elsif( !defined( $code ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1704 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | warn( "No callback anonymous subroutine or subroutine reference was provided.\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1706 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1708 | elsif( ref( $code ) ne 'CODE' ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1709 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1710 | 0 | warn( "Callback provided (", overload::StrVal( $code ), ") is not a code reference.\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1712 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1713 | 14 | $self->{ "callback_${what}" } = $code; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1714 | 14 | CORE::return(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1717 | sub unset_callback | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1718 | 3 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unset_callback: called CC=4 SCAR=17.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1719 | 3 | my( $self, $what ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1720 | 3 | ▶ | if( !defined( $what ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1721 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | warn( "No callback type was provided. Use \"add\" or \"remove\".\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1723 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1724 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1725 | ▶ | elsif( $what ne 'add' && $what ne 'remove' ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$what ne "add" and $what ne "remove"
MC/DC0%0/2
$what ne "add" and $what ne "remove"
$what ne "add"
$what ne "remove"
Truth table66%2/3
A and B
A= $what ne "add"B= $what ne "remove"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1726 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1727 | 0 | warn( "Unknown callback type was provided: '$what'. Use \"add\" or \"remove\".\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1728 | 0 | CORE::return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1729 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1730 | 3 | $self->{ "callback_${what}" } = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1731 | 3 | CORE::return(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1732 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1733 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1735 | 23 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1737 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||