| 1 | package Aion::Type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # Базовый класс для типов и преобразователей | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use common::sense; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings FATAL => 'recursion'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | #use warnings 'recursion'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 8 | ▶ | use Aion::Meta::Util qw//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 8 | ▶ | use Aion::Type::Lim; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 8 | ▶ | use List::Util qw//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 8 | ▶ | use Scalar::Util qw//; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 8 | require Aion::Type::DNF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 8 | require Aion::Type::Espresso; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 8 | our @ISA = qw/Aion::Type::DNF Aion::Type::Espresso/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 213 | ▶ | sub true {1} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
true: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 8 | ▶ | "fallback" => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | "&{}" => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | sub { $self->test } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | '""' => "stringify", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 50 | ▶ | "|" => sub { Aion::Types::Union([@_[0, 1]]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 107 | ▶ | "&" => sub { Aion::Types::Intersection([@_[0, 1]]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 486 | ▶ | "~" => sub { Aion::Types::Exclude([shift]) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | "~~" => "include", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ">>" => "coerce", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | "eq" => "identical", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | "ne" => "distinct", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | "lt" => sub {die "lt do'nt used!"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | "gt" => sub {die "gt do'nt used!"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | "le" => sub {die "le do'nt used!"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | "ge" => sub {die "ge do'nt used!"}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 8 | "cmp" => "compare", | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | "<=>" => "compare", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | "==" => "equals", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | "!=" => "differs", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ">=" => "superset", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | "<=" => "subset", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ">" => "superproper", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | "<" => "subproper", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 8 | ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 8 | Aion::Meta::Util::create_getters(qw/name args as/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 8 | Aion::Meta::Util::create_accessors(qw/message/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 8 | $Aion::Type::SELF = __PACKAGE__->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | is_param_args => __PACKAGE__->new(name => "Argument_ARGS", is_param => -1024), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | is_param => -256, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | name => 'Argument_SELF', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | args => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | __PACKAGE__->new(name => "Argument_A", is_param => 1), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | __PACKAGE__->new(name => "Argument_B", is_param => 2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | __PACKAGE__->new(name => "Argument_C", is_param => 3), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | __PACKAGE__->new(name => "Argument_D", is_param => 4), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | N => __PACKAGE__->new(name => "Argument_N", is_param => -1), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | M => __PACKAGE__->new(name => "Argument_M", is_param => -2), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | # конструктор | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | # * name (Str) – Имя типа. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | # * as (Object[Aion::Type]) – наследуемый тип. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # * args (ArrayRef) – Список аргументов. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # * init (ArrayRef[CodeRef]) – Инициализатор типа. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # * test (CodeRef) – Чекер. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # * a_test (CodeRef) – Используется для проверки типа с аргументами, если аргументы не указаны, то используется test. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | # * coerce (ArrayRef) – Массив преобразователей в этот тип: [Type => sub {}]. Общий для экземплятов параметрического типа. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | # * subset (CodeRef) - Проверка на подмножество типа A типу B. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | # * message (CodeRef) – Сообщение об ошибке. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # * title (Str) – Заголовок. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # * description (Str) – Описание. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # * example (Any) – Пример. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # * is_option (Bool) – это Option[A]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | # * is_wantarray (Bool) – это Wantarray[A, S]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | # * ally (Bool) – вступать в союз для объединения ветвей наследования при пересечении типов. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 3635 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 3635 | my $cls = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 3635 | my $self = bless {@_}, $cls; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 3635 | ▶ | $self->{test} //= \&test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"test"} //= \&Aion::Type::test
MC/DC100%1/1
$self->{"test"} //= \&Aion::Type::test
$self->{"test"}
Truth table100%2/2
A
A= $self->{"test"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 3635 | ▶ | $self->{coerce} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"coerce"} //= []
MC/DC100%1/1
$self->{"coerce"} //= []
$self->{"coerce"}
Truth table100%2/2
A
A= $self->{"coerce"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 3635 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | # Клонировать тип | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 308 | ▶ | sub clone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clone: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 308 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 308 | $self = bless { %$self, @_ }, ref $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 308 | delete @$self{qw/key as_test_cache/}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 308 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # Инициализировать тип | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 2762 | ▶ | sub init { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2762 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # Есть параметрические типы – не инициализируем | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 2762 | ▶ | return $self if $self->{args} && List::Util::first { UNIVERSAL::isa($_, __PACKAGE__) && exists $_->{is_param} } @{$self->{args}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
Branch: 2 branches
Condition66%2/3
$self->{"args"} and &List::Util::first(sub {
UNIVERSAL::isa($_, __PACKAGE__) and exists $_->{"is_param"};
}
, @{$$self{"args"};})
MC/DC0%0/2
$self->{"args"} and &List::Util::first(sub {
UNIVERSAL::isa($_, __PACKAGE__) and exists $_->{"is_param"};
}
, @{$$self{"args"};})
$self->{"args"}
&List::Util::first(sub {
UNIVERSAL::isa($_, __PACKAGE__) and exists $_->{"is_param"};
}
, @{$$self{"args"};})
Truth table66%2/3
A and B
A= $self->{"args"}B= &List::Util::first(sub {
UNIVERSAL::isa($_, __PACKAGE__) and exists $_->{"is_param"};
}
, @{$$self{"args"};})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 2749 | local $Aion::Type::SELF = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 2749 | $_->() for @{$self->{init}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 2748 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | #@category strings | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Строковое представление | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 9016 | ▶ | sub stringify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 9016 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 9016 | my @args = map Aion::Meta::Util::val_to_str($_), @{$self->{args}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $self->is_union? join "", "( ", join(" | ", @args), " )": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | $self->is_intersection? join "", "( ", join(" & ", @args), " )": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | $self->is_exclude? "~$args[0]": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 9016 | ▶ | join("", $self->{name}, @args? ("[", join(", ", @args), "]") : ()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # Сообщение об ошибке | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 15 | ▶ | sub detail { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
detail: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 15 | (my $self, local $_, my $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 15 | local $Aion::Type::SELF = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 15 | ▶ | $self->{message}? do { local $self->{property} = $name; $self->{message}->() }: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | "$name must have the type $self. The it is ${\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 12 | Aion::Meta::Util::val_to_str($_) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | }!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # Преобразовать значение в строку | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | sub val_to_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
val_to_str: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | my ($self, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | Aion::Meta::Util::val_to_str($val) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | #@category test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Строит кеш для вызова только для примитивного типа | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 387 | ▶ | sub _build_as_test_cache { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_as_test_cache: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 387 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 387 | my @as; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 387 | ▶ | for(my $i = $self->{as}; $i; $i = $i->{as}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 1162 | ▶ | return "" if $i->is_set_theoretic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1043 | ▶ | unshift @as, $i if $i->{test} != \&true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 268 | \@as; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # Это - примитивный тип, то есть тот, в иерархии которого нет множественно-теоритических операторов | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 2 | ▶ | sub is_primitive { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_primitive: called CC=2 SCAR=8.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | ▶ | !!($self->{as_test_cache} //= $self->_build_as_test_cache); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"as_test_cache"} //= $self->_build_as_test_cache
MC/DC0%0/2
$self->{"as_test_cache"} //= $self->_build_as_test_cache
$self->{"as_test_cache"}
$self->_build_as_test_cache
Truth table33%1/3
A //= B
A= $self->{"as_test_cache"}B= $self->_build_as_test_cache
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | # Тестировать значение в $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1477 | ▶ | sub test { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
test: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1477 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 1477 | ▶ | if($self->{as_test_cache} //= $self->_build_as_test_cache) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"as_test_cache"} //= $self->_build_as_test_cache
MC/DC0%0/2
$self->{"as_test_cache"} //= $self->_build_as_test_cache
$self->{"as_test_cache"}
$self->_build_as_test_cache
Truth table66%2/3
A //= B
A= $self->{"as_test_cache"}B= $self->_build_as_test_cache
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 1149 | local $Aion::Type::SELF; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1149 | for $Aion::Type::SELF (@{$self->{as_test_cache}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1955 | ▶ | return "" unless $Aion::Type::SELF->{test}->(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 328 | ▶ | return "" if $self->{as} && !$self->{as}->test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"as"} and not $self->{"as"}->test
MC/DC50%1/2
$self->{"as"} and not $self->{"as"}->test
$self->{"as"}
not $self->{"as"}->test
Truth table66%2/3
A and not(B)
A= $self->{"as"}B= not $self->{"as"}->test
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 1398 | local $Aion::Type::SELF = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1398 | $self->{test}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # Является элементом множества описываемого типом | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 741 | ▶ | sub include { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
include: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 741 | (my $self, local $_) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 741 | $self->test | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # Не является элементом множества описываемого типом | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 60 | ▶ | sub exclude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
exclude: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 60 | (my $self, local $_) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 60 | !$self->test | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # Валидировать значение в параметре | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 252 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 252 | (my $self, local $_, my $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 252 | ▶ | die $self->detail($_, $name) unless $self->test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 239 | $_ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | # Преобразовать значение в параметре и вернуть преобразованное | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 30 | ▶ | sub coerce { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
coerce: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 30 | local ($Aion::Type::SELF, $_) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 30 | for my $coerce (@{$Aion::Type::SELF->{coerce}}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 34 | ▶ | return $coerce->[1]() if $coerce->[0]->test; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | $_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 3 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | #@category compare | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 5 | ▶ | sub Any() { *Any = \&Aion::Types::Any; &Any } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Any: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 5 | ▶ | sub None() { *None = \&Aion::Types::None; &None } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
None: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # refaddr coerce => минимальная нижняя граница. У Range она -Inf, а у остальных – 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 8 | our %range_lbound; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # Определяет, что тип – множественно-теоретический оператор | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 8 | my $set_theoretic = [qw/Union Intersection Exclude/]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 2761 | ▶ | sub is_set_theoretic { shift->{name} ~~ $set_theoretic } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_set_theoretic: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 14235 | ▶ | sub is_union { shift->{name} eq 'Union' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_union: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 19554 | ▶ | sub is_intersection { shift->{name} eq 'Intersection' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_intersection: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 36411 | ▶ | sub is_exclude { shift->{name} eq 'Exclude' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_exclude: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 23590 | ▶ | sub is_enum { shift->{name} eq 'Enum' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_enum: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 20496 | ▶ | sub _range_lbaund_addr { Scalar::Util::refaddr shift->{coerce} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_range_lbaund_addr: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 18963 | ▶ | sub is_range_type { exists $range_lbound{shift->_range_lbaund_addr} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_range_type: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 60 | ▶ | sub range_lbound { $range_lbound{shift->_range_lbaund_addr} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range_lbound: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 28 | ▶ | sub is_range { shift->range_lbound == '-Inf' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_range: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Формирует ключ с отсортированными типизированными параметрами | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 1021 | ▶ | sub typed_sorted_args_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
typed_sorted_args_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1021 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1021 | my $coerceaddr = Scalar::Util::refaddr $self->{coerce}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1021 | join "-", $coerceaddr, join(",", map { join ":", length($_), $_ } sort map $_->key, @{$self->{args}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # Формирует ключ с отсортированными нетипизированными параметрами | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 28 | ▶ | sub sorted_args_key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sorted_args_key: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 28 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 28 | my $coerceaddr = Scalar::Util::refaddr $self->{coerce}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 28 | join "-", $coerceaddr, join(",", map { join ":", length($_), $_ } sort @{$self->{args}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | # Возвращает уникальный ключ для типа, использующийся в хешах и сравнения | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | # Должен быть заменён на созданные типы | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 8 | my %keyfn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 8 | my $undefined = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 30890 | ▶ | sub key { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
key: called CC=9 SCAR=22.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 30890 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 30890 | ▶ | $self->{key} //= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$self->{"key"} //= do {
my $coerceaddr = builtin::refaddr($self->{"coerce"});
my $keyfn = $keyfn{$coerceaddr};
$keyfn ? &$keyfn($self) : join("-", $coerceaddr, exists $self->{"args"} && @{$self->{"args"};} || exists $self->{"N"} || exists $self->{"M"} ? join(",", map({my $key = UNIVERSAL::isa($_, __PACKAGE__) ? $_->key : '' . ($_ // $undefined);
join ":", length $key, $key;} @{$$self{"args"};})) : ())
}
MC/DC0%0/2
$self->{"key"} //= do {
my $coerceaddr = builtin::refaddr($self->{"coerce"});
my $keyfn = $keyfn{$coerceaddr};
$keyfn ? &$keyfn($self) : join("-", $coerceaddr, exists $self->{"args"} && @{$self->{"args"};} || exists $self->{"N"} || exists $self->{"M"} ? join(",", map({my $key = UNIVERSAL::isa($_, __PACKAGE__) ? $_->key : '' . ($_ // $undefined);
join ":", length $key, $key;} @{$$self{"args"};})) : ())
}
$self->{"key"}
do {
my $coerceaddr = builtin::refaddr($self->{"coerce"});
my $keyfn = $keyfn{$coerceaddr};
$keyfn ? &$keyfn($self) : join("-", $coerceaddr, exists $self->{"args"} && @{$self->{"args"};} || exists $self->{"N"} || exists $self->{"M"} ? join(",", map({my $key = UNIVERSAL::isa($_, __PACKAGE__) ? $_->key : '' . ($_ // $undefined);
join ":", length $key, $key;} @{$$self{"args"};})) : ())
}
Truth table66%2/3
A //= B
A= $self->{"key"}B= do {
my $coerceaddr = builtin::refaddr($self->{"coerce"});
my $keyfn = $keyfn{$coerceaddr};
$keyfn ? &$keyfn($self) : join("-", $coerceaddr, exists $self->{"args"} && @{$self->{"args"};} || exists $self->{"N"} || exists $self->{"M"} ? join(",", map({my $key = UNIVERSAL::isa($_, __PACKAGE__) ? $_->key : '' . ($_ // $undefined);
join ":", length $key, $key;} @{$$self{"args"};})) : ())
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1507 | my $coerceaddr = Scalar::Util::refaddr $self->{coerce}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 1507 | my $keyfn = $keyfn{$coerceaddr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | $keyfn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | ? $keyfn->($self) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 451 | : join "-", $coerceaddr, exists $self->{args} && @{$self->{args}} || exists $self->{N} || exists $self->{M} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | ? join(",", map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 521 | ▶ | my $key = UNIVERSAL::isa($_, __PACKAGE__)? $_->key: "" . ($_ // $undefined); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_ // $undefined
MC/DC0%0/2
$_ // $undefined
$_
$undefined
Truth table33%1/3
A // B
A= $_B= $undefined
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 521 | join ":", length($key), $key | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1507 | ▶ | } @{$self->{args}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition88%8/9
exists $self->{"args"} and @{$self->{"args"};} or exists $self->{"N"} or exists $self->{"M"}
exists $self->{"args"} and @{$self->{"args"};} or exists $self->{"N"}
exists $self->{"args"} and @{$self->{"args"};}
MC/DC75%3/4
exists $self->{"args"} and @{$self->{"args"};} or exists $self->{"N"} or exists $self->{"M"}
exists $self->{"args"}
@{$self->{"args"};}
exists $self->{"N"}
exists $self->{"M"}
Truth table57%4/7
A and B or C or D
A= exists $self->{"args"}B= @{$self->{"args"};}C= exists $self->{"N"}D= exists $self->{"M"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # Устанавливает/возвращает функцию построения ключа для типа как класса | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 26 | ▶ | sub keyfn { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
keyfn: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 26 | my ($self, $fn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 26 | ▶ | if(@_>1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 26 | $keyfn{Scalar::Util::refaddr $self->{coerce}} = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 26 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | $keyfn{Scalar::Util::refaddr $self->{coerce}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # Возвращает цепочку предков | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 16 | ▶ | sub asen { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
asen: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 16 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 16 | my @as; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 16 | ▶ | for(my $i=$self->{as}; $i; $i = $i->{as}) { unshift @as, $i } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 16 | ▶ | unshift @as, Any unless @as && $as[0] eq Any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
@as and $as[0] eq &Any()
MC/DC0%0/2
@as and $as[0] eq &Any()
@as
$as[0] eq &Any()
Truth table33%1/3
A and B
A= @asB= $as[0] eq &Any()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | @as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 16 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # Ключ для сравнения типов в <=> и cmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 18 | ▶ | sub ckey { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ckey: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 18 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 18 | ▶ | $self->{ckey} //= join " <- ", map $_->stringify, $self->asen, $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"ckey"} //= join(" <- ", map($_->stringify, $self->asen, $self))
MC/DC100%1/1
$self->{"ckey"} //= join(" <- ", map($_->stringify, $self->asen, $self))
$self->{"ckey"}
Truth table100%2/2
A
A= $self->{"ckey"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | # Сравнение для сортировки | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 9 | ▶ | sub compare { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compare: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 9 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 9 | $self->ckey cmp $other->ckey; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # A потомок B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 6 | ▶ | sub instanceof { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
instanceof: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 6 | my ($self, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 6 | my @S = $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 6 | ▶ | while(@S) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 16 | my $x = pop @S; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 16 | ▶ | return 1 if $x->{name} eq $name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 11 | ▶ | if($x->is_intersection) { push @S, @{$x->{args}} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | elsif($x->is_set_theoretic) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 7 | ▶ | else { push @S, $x->{as} if $x->{as} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # A потомок B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 33 | ▶ | sub is_descendant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_descendant: called CC=10 SCAR=24.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 33 | my ($self, $other, $is_strict) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 33 | ▶ | return 1 if $is_strict && $self eq $other | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$is_strict and $self eq $other or not $is_strict and $self->like($other)
$is_strict and $self eq $other
not $is_strict and $self->like($other)
MC/DC25%1/4
$is_strict and $self eq $other or not $is_strict and $self->like($other)
$is_strict
$self eq $other
not $is_strict
$self->like($other)
Truth table28%2/7
A and B or not(C) and D
A= $is_strictB= $self eq $otherC= not $is_strictD= $self->like($other)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | || !$is_strict && $self->like($other); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 29 | ▶ | if ($self->is_intersection) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 2 | ▶ | return List::Util::any { $_->is_descendant($other, $is_strict) } @{$self->{args}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 27 | ▶ | if ($self->is_union) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 3 | ▶ | return List::Util::all { $_->is_descendant($other, $is_strict) } @{$self->{args}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 24 | ▶ | if ($self->is_exclude) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | ▶ | return $self->{args}[0]->is_descendant($other->is_exclude? $other->{args}[0]: ~$other, $is_strict); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 24 | ▶ | return $self->{as}->is_descendant($other, $is_strict) if $self->{as}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 2 | "" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # Сравнивает по прототипам | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 34 | ▶ | sub like { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
like: called CC=9 SCAR=25.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 34 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | return List::Util::all { $_->[0]->like($_->[1]) } List::Util::zip $self->{args}, $other->{args} if $self->is_intersection && $other->is_intersection; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.8
Branch: 1 branch
Condition66%2/3
$self->is_intersection and $other->is_intersection
MC/DC0%0/2
$self->is_intersection and $other->is_intersection
$self->is_intersection
$other->is_intersection
Truth table66%2/3
A and B
A= $self->is_intersectionB= $other->is_intersection
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | return List::Util::any { $_->[0]->like($_->[1]) } List::Util::zip $self->{args}, $other->{args} if $self->is_union && $other->is_union; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.8
Branch: 1 branch
Condition66%2/3
$self->is_union and $other->is_union
MC/DC0%0/2
$self->is_union and $other->is_union
$self->is_union
$other->is_union
Truth table66%2/3
A and B
A= $self->is_unionB= $other->is_union
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 34 | ▶ | return $self->{args}[0]->like($other->{args}[0]) if $self->is_exclude && $other->is_exclude; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->is_exclude and $other->is_exclude
MC/DC0%0/2
$self->is_exclude and $other->is_exclude
$self->is_exclude
$other->is_exclude
Truth table33%1/3
A and B
A= $self->is_excludeB= $other->is_exclude
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 34 | ▶ | return "" if $self->is_set_theoretic || $other->is_set_theoretic; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->is_set_theoretic or $other->is_set_theoretic
MC/DC50%1/2
$self->is_set_theoretic or $other->is_set_theoretic
$self->is_set_theoretic
$other->is_set_theoretic
Truth table66%2/3
A or B
A= $self->is_set_theoreticB= $other->is_set_theoretic
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 29 | $self->{coerce} == $other->{coerce}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # Тождество | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 239 | ▶ | sub identical { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
identical: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 239 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 239 | ▶ | return 1 if Scalar::Util::refaddr $self == Scalar::Util::refaddr $other; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | return "" unless UNIVERSAL::isa($other, __PACKAGE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 169 | ▶ | && $self->{coerce} == $other->{coerce}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
UNIVERSAL::isa($other, __PACKAGE__) and $self->{"coerce"} == $other->{"coerce"}
MC/DC100%2/2
UNIVERSAL::isa($other, __PACKAGE__) and $self->{"coerce"} == $other->{"coerce"}
UNIVERSAL::isa($other, __PACKAGE__)
$self->{"coerce"} == $other->{"coerce"}
Truth table100%3/3
A and B
A= UNIVERSAL::isa($other, __PACKAGE__)B= $self->{"coerce"} == $other->{"coerce"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 49 | $self->key eq $other->key | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # Нетождественно | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 2 | ▶ | sub distinct { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
distinct: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 2 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 2 | !$self->identical($other); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | # Превращает выражение в ДНФ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 60 | ▶ | sub _simplify { shift->_unfolding->_pushing->_distribute } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_simplify: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | # Упрощает выражение | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | # TODO: использовать алгоритм Espresso для свёртки DNF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | ▶ | sub simplify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
simplify: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 2 | ▶ | $self->_simplify eq None? None: $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # A <= B <=> A & ~B = ∅ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 68 | ▶ | sub subset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subset: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 68 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 68 | ▶ | return 1 if $self eq $other or $other eq Any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self eq $other or $other eq &Any()
MC/DC100%2/2
$self eq $other or $other eq &Any()
$self eq $other
$other eq &Any()
Truth table100%3/3
A or B
A= $self eq $otherB= $other eq &Any()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 53 | ($self & ~$other)->_simplify eq None; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | # A < B (Строгое включение: подтип, но не равен) = A <= B && !(B <= A) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 14 | ▶ | sub subproper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subproper: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 14 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 14 | ▶ | $self->subset($other) && !$other->subset($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | # A >= B = B <= A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | sub superset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
superset: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $other->subset($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | # A > B = B < A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | ▶ | sub superproper { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
superproper: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 1 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | $other->subproper($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # A == B (Эквивалентность типов: A является подтипом B И B является подтипом A) = A <= B && B <= A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 9 | ▶ | sub equals { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equals: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 9 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 9 | ▶ | $self eq $other || $self->subset($other) && $other->subset($self); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
$self eq $other || $self->subset($other) && $other->subset($self)
$self->subset($other) and $other->subset($self)
MC/DC66%2/3
$self eq $other || $self->subset($other) && $other->subset($self)
$self eq $other
$self->subset($other)
$other->subset($self)
Truth table75%3/4
A || B and C
A= $self eq $otherB= $self->subset($other)C= $other->subset($self)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # A != B | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | sub differs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
differs: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | !$self->equals($other); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # Пересекаются | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | ▶ | sub joint { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
joint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 2 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 2 | !$self->disjoint($other); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | # Не пересекаются | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 4 | ▶ | sub disjoint { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
disjoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 4 | my ($self, $other) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | ($self & $other)->_simplify eq None; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | #@category swagger | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | # Заголовок | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | sub title { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
title: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my ($self, $title) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if(@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | $self->{title} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | bless {%$self, title => $title}, ref $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # Описание | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub description { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my ($self, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | if(@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | $self->{description} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | bless {%$self, description => $description}, ref $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | # Описание | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | sub example { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
example: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my ($self, $description) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | if(@_ == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | $self->{example} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | } else { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | bless {%$self, example => $description}, ref $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | #@category makers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | # Создаёт функцию для типа | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 379 | ▶ | sub make { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 379 | my ($self, $pkg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 379 | ▶ | die "init_where won't work in $self->{name}" if $self->{init}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 378 | my $var = "\$$self->{name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 378 | my $code = "package $pkg { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | my $var = \$self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | sub $self->{name} () { $var } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 378 | ▶ | eval $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Any: called CC=1 SCAR=0.0
Subroutine
Bin: called CC=1 SCAR=0.0
Subroutine
Bool: called CC=1 SCAR=0.0
Subroutine
BoolLike: called CC=1 SCAR=0.0
Subroutine
ClassName: called CC=1 SCAR=0.0
Subroutine
CodeLike: called CC=1 SCAR=0.0
Subroutine
CodeRef: called CC=1 SCAR=0.0
Subroutine
Control: called CC=1 SCAR=0.0
Subroutine
Defined: called CC=1 SCAR=0.0
Subroutine
Double: called CC=1 SCAR=0.0
Subroutine
Email: called CC=1 SCAR=0.0
Subroutine
FileHandle: called CC=1 SCAR=0.0
Subroutine
Float: called CC=1 SCAR=0.0
Subroutine
FormatRef: called CC=1 SCAR=0.0
Subroutine
ForwardRef: called CC=1 SCAR=0.0
Subroutine
GlobRef: called CC=1 SCAR=0.0
Subroutine
Html: called CC=1 SCAR=0.0
Subroutine
ImplementRef: called CC=1 SCAR=0.0
Subroutine
Int: called CC=1 SCAR=0.0
Subroutine
Item: called CC=1 SCAR=0.0
Subroutine
LValueRef: called CC=1 SCAR=0.0
Subroutine
Like: called CC=1 SCAR=0.0
Subroutine
Nat: called CC=1 SCAR=0.0
Subroutine
NonEmptyStr: called CC=1 SCAR=0.0
Subroutine
Num: called CC=1 SCAR=0.0
Subroutine
NumLike: called CC=1 SCAR=0.0
Subroutine
PackageName: called CC=1 SCAR=0.0
Subroutine
Path: called CC=1 SCAR=0.0
Subroutine
PositiveInt: called CC=1 SCAR=0.0
Subroutine
PositiveNum: called CC=1 SCAR=0.0
Subroutine
Rat: called CC=1 SCAR=0.0
Subroutine
Ref: called CC=1 SCAR=0.0
Subroutine
RegexpLike: called CC=1 SCAR=0.0
Subroutine
RegexpRef: called CC=1 SCAR=0.0
Subroutine
RoleName: called CC=1 SCAR=0.0
Subroutine
Str: called CC=1 SCAR=0.0
Subroutine
StrDate: called CC=1 SCAR=0.0
Subroutine
StrDateTime: called CC=1 SCAR=0.0
Subroutine
StrLike: called CC=1 SCAR=0.0
Subroutine
StrRat: called CC=1 SCAR=0.0
Subroutine
Tel: called CC=1 SCAR=0.0
Subroutine
Undef: called CC=1 SCAR=0.0
Subroutine
Uni: called CC=1 SCAR=0.0
Subroutine
Url: called CC=1 SCAR=0.0
Subroutine
Value: called CC=1 SCAR=0.0
Subroutine
Version: called CC=1 SCAR=0.0
Subroutine
Rim: called CC=1 SCAR=0.0
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
undocumented
Pod
undocumented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 378 | ▶ | die if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 377 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # Создаёт функцию для типа c аргументом | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 249 | ▶ | sub make_arg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_arg: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 249 | my ($self, $pkg, $is_arg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 249 | my $hash = "%$self->{name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 249 | ▶ | my $proto = $is_arg? '$': ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 249 | ▶ | if($is_arg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 240 | ▶ | my $init = $self->{init}? '->init': ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 240 | my $code = "package $pkg { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | my $hash = %\$self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | sub $self->{name} (\$) { Aion::Type->new($hash, args => \$_[0])$init } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 240 | ▶ | eval $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Bytes: called CC=1 SCAR=0.0
Subroutine
ConsumerOf: called CC=1 SCAR=0.0
Subroutine
CycleTuple: called CC=1 SCAR=0.0
Subroutine
Dict: called CC=1 SCAR=0.0
Subroutine
EndsWith: called CC=1 SCAR=0.0
Subroutine
Enum: called CC=1 SCAR=0.0
Subroutine
Exclude: called CC=1 SCAR=0.0
Subroutine
HasMethods: called CC=1 SCAR=0.0
Subroutine
HasProp: called CC=1 SCAR=0.0
Subroutine
InstanceOf: called CC=1 SCAR=0.0
Subroutine
Intersection: called CC=1 SCAR=0.0
Subroutine
Isa: called CC=1 SCAR=0.0
Subroutine
Join: called CC=1 SCAR=0.0
Subroutine
Len: called CC=1 SCAR=0.0
Subroutine
Lim: called CC=1 SCAR=0.0
Subroutine
LimKeys: called CC=1 SCAR=0.0
Subroutine
Map: called CC=1 SCAR=0.0
Subroutine
Maybe: called CC=1 SCAR=0.0
Subroutine
NamedCode: called CC=1 SCAR=0.0
Subroutine
Option: called CC=1 SCAR=0.0
Subroutine
PositiveBytes: called CC=1 SCAR=0.0
Subroutine
ProtoCode: called CC=1 SCAR=0.0
Subroutine
Range: called CC=1 SCAR=0.0
Subroutine
Split: called CC=1 SCAR=0.0
Subroutine
StartsWith: called CC=1 SCAR=0.0
Subroutine
StrMatch: called CC=1 SCAR=0.0
Subroutine
Tuple: called CC=1 SCAR=0.0
Subroutine
Union: called CC=1 SCAR=0.0
Subroutine
Wantarray: called CC=1 SCAR=0.0
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 240 | ▶ | die if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 240 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 9 | my $code = "package $pkg { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | my $hash = %\$self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | sub $self->{name} () { Aion::Type->new($hash)->init } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | }"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 9 | ▶ | eval $code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Me: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 9 | ▶ | die if $@; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 8 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | # Создаёт функцию для типа c аргументом или без. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | # init вызывается только для типа с аргументами. Без аргументов возвращается один и тот же тип | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 84 | ▶ | sub make_maybe_arg { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_maybe_arg: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 84 | my ($self, $pkg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 84 | my $var = "\$$self->{name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 84 | my $hash = "%$self->{name}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 84 | ▶ | my $init = $self->{init}? '->init': ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 84 | my $code = "package $pkg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | my $var = \$self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | my $hash = %\$self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | sub $self->{name} (;\$) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | \@_==0? $var: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | Aion::Type->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | $hash, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | args => \$_[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | test => ${var}->{a_test}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | )$init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | "; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 84 | ▶ | eval $code or die; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ArrayLike: called CC=2 SCAR=6.9
Subroutine
ArrayRef: called CC=2 SCAR=6.9
Subroutine
HashLike: called CC=2 SCAR=6.9
Subroutine
HashRef: called CC=2 SCAR=6.9
Subroutine
Object: called CC=2 SCAR=6.9
Subroutine
Overload: called CC=2 SCAR=6.9
Subroutine
RefRef: called CC=2 SCAR=6.9
Subroutine
ScalarRef: called CC=2 SCAR=6.9
Subroutine
Tied: called CC=2 SCAR=6.9
Subroutine
ValueRef: called CC=2 SCAR=6.9
Pod
undocumented
Pod
documented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Pod
undocumented
Branch: 11 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 83 | $self | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 8 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||