| 1 | 53 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Lingy::HashSet; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 53 | ▶ | use base 'Lingy::Class'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 53 | ▶ | use Lingy::Common; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 53 | ▶ | use Hash::Ordered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 397 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 397 | my ($class, $list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 397 | tie my %hash, 'Hash::Ordered'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 397 | ▶ | for (my $i = 0; $i < @$list; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 425 | my $val = $list->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 425 | my $key = $class->_get_key($val); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 425 | ▶ | delete $hash{$key} if exists $hash{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 425 | $hash{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 397 | bless \%hash, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | HASHSET->new([ %{$_[0]} ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 425 | ▶ | sub _get_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_key: called CC=9 SCAR=24.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 425 | my ($self, $key) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 425 | my $type = ref($key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | $type eq '' ? qq<$key> : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | $type eq STRING ? qq<"$key> : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | $type eq SYMBOL ? qq<$key > : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $type->isa(SCALARTYPE) ? qq<$key> : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ( # Quoted symbol: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $type eq LIST and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ref($key->[0]) eq SYMBOL and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ${$key->[0]} eq 'quote' and | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ref($key->[1]) eq SYMBOL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 425 | ▶ | ) ? ${$key->[1]} . ' ' : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition33%3/9
$type eq "Lingy::List" and ref $key->[0] eq "Lingy::Symbol" and ${$key->[0];} eq "quote" and ref $key->[1] eq "Lingy::Symbol"
$type eq "Lingy::List" and ref $key->[0] eq "Lingy::Symbol" and ${$key->[0];} eq "quote"
$type eq "Lingy::List" and ref $key->[0] eq "Lingy::Symbol"
MC/DC0%0/4
$type eq "Lingy::List" and ref $key->[0] eq "Lingy::Symbol" and ${$key->[0];} eq "quote" and ref $key->[1] eq "Lingy::Symbol"
$type eq "Lingy::List"
ref $key->[0] eq "Lingy::Symbol"
${$key->[0];} eq "quote"
ref $key->[1] eq "Lingy::Symbol"
Truth table20%1/5
A and B and C and D
A= $type eq "Lingy::List"B= ref $key->[0] eq "Lingy::Symbol"C= ${$key->[0];} eq "quote"D= ref $key->[1] eq "Lingy::Symbol"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | err "Type '$type' not supported as a hash-map key"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | ▶ | sub _to_seq { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_to_seq: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1 | my ($map) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1 | ▶ | return nil unless %$map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | LIST->new([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 4 | $map->{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | } keys %{$_[0]} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 53 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||