| 1 | 56 | ▶ | use strict; use warnings; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 2 | package Lingy::Common; | ||||||||||||||||||||||
| 3 | |||||||||||||||||||||||
| 4 | 56 | ▶ | use Exporter 'import'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | |||||||||||||||||||||||
| 6 | 56 | ▶ | use Scalar::Util qw'refaddr reftype'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 7 | |||||||||||||||||||||||
| 8 | # RT is the RunTime class accessor function. | ||||||||||||||||||||||
| 9 | # 'Lingy::RT' or a subclass like 'YAMLScript::RT'. | ||||||||||||||||||||||
| 10 | 56 | ▶ | BEGIN { | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.2
| |||||||||||||||||||||||
| 11 | 56 | ▶ | *RT = sub { 'Lingy::RT' } unless defined &RT; | ||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||
| 13 | |||||||||||||||||||||||
| 14 | # Base type classes: | ||||||||||||||||||||||
| 15 | 56 | ▶ | use constant LISTTYPE => 'Lingy::ListClass'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 16 | 56 | ▶ | use constant SCALARTYPE => 'Lingy::ScalarClass'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 17 | 56 | ▶ | use constant SEQUENTIAL => 'Lingy::Sequential'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 18 | |||||||||||||||||||||||
| 19 | # Type classes: | ||||||||||||||||||||||
| 20 | 56 | ▶ | use constant ATOM => 'Lingy::Atom'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 21 | 56 | ▶ | use constant BOOLEAN => 'Lingy::Boolean'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 22 | 56 | ▶ | use constant CHARACTER => 'Lingy::Character'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 23 | 56 | ▶ | use constant CLASS => 'Lingy::Class'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 24 | 56 | ▶ | use constant CLOJURE => 'Lingy::Clojure'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 25 | 56 | ▶ | use constant COMPILER => 'Lingy::Compiler'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 26 | 56 | ▶ | use constant FUNCTION => 'Lingy::Fn'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 27 | 56 | ▶ | use constant HASHMAP => 'Lingy::HashMap'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 28 | 56 | ▶ | use constant HASHSET => 'Lingy::HashSet'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 29 | 56 | ▶ | use constant KEYWORD => 'Lingy::Keyword'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 30 | 56 | ▶ | use constant LIST => 'Lingy::List'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 31 | 56 | ▶ | use constant MACRO => 'Lingy::Macro'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 32 | 56 | ▶ | use constant NIL => 'Lingy::Nil'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 33 | 56 | ▶ | use constant NUMBER => 'Lingy::Number'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 34 | 56 | ▶ | use constant REGEX => 'Lingy::Regex'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 35 | 56 | ▶ | use constant STRBUILD => 'Lingy::StringBuilder'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 36 | 56 | ▶ | use constant STRING => 'Lingy::String'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 37 | 56 | ▶ | use constant SYMBOL => 'Lingy::Symbol'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 38 | 56 | ▶ | use constant SYSTEM => 'Lingy::System'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 39 | 56 | ▶ | use constant UTIL => 'Lingy::Util'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 40 | 56 | ▶ | use constant VECTOR => 'Lingy::Vector'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 41 | 56 | ▶ | use constant VAR => 'Lingy::Var'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 42 | |||||||||||||||||||||||
| 43 | # Exception classes: | ||||||||||||||||||||||
| 44 | 56 | ▶ | use constant EXCEPTION => 'Lingy::Exception'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 45 | 56 | ▶ | use constant ILLEGALARGUMENTEXCEPTION => | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 46 | 56 | 'Lingy::IllegalArgumentException'; | |||||||||||||||||||||
| 47 | |||||||||||||||||||||||
| 48 | # Functionality classes: | ||||||||||||||||||||||
| 49 | 56 | ▶ | use constant NAMESPACE => 'Lingy::Namespace'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 50 | 56 | ▶ | use constant NUMBERS => 'Lingy::Numbers'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 51 | 56 | ▶ | use constant TERM => 'Lingy::Term'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 52 | 56 | ▶ | use constant THREAD => 'Lingy::Thread'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 53 | |||||||||||||||||||||||
| 54 | 56 | ▶ | BEGIN { | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 55 | 56 | our @EXPORT = qw< | |||||||||||||||||||||
| 56 | OK | ||||||||||||||||||||||
| 57 | |||||||||||||||||||||||
| 58 | $symbol_re | ||||||||||||||||||||||
| 59 | $namespace_re | ||||||||||||||||||||||
| 60 | |||||||||||||||||||||||
| 61 | refaddr | ||||||||||||||||||||||
| 62 | reftype | ||||||||||||||||||||||
| 63 | |||||||||||||||||||||||
| 64 | RT | ||||||||||||||||||||||
| 65 | |||||||||||||||||||||||
| 66 | LISTTYPE | ||||||||||||||||||||||
| 67 | SCALARTYPE | ||||||||||||||||||||||
| 68 | SEQUENTIAL | ||||||||||||||||||||||
| 69 | |||||||||||||||||||||||
| 70 | COMPILER | ||||||||||||||||||||||
| 71 | NAMESPACE | ||||||||||||||||||||||
| 72 | NUMBERS | ||||||||||||||||||||||
| 73 | TERM | ||||||||||||||||||||||
| 74 | THREAD | ||||||||||||||||||||||
| 75 | UTIL | ||||||||||||||||||||||
| 76 | |||||||||||||||||||||||
| 77 | ATOM | ||||||||||||||||||||||
| 78 | BOOLEAN | ||||||||||||||||||||||
| 79 | CHARACTER | ||||||||||||||||||||||
| 80 | CLASS | ||||||||||||||||||||||
| 81 | CLOJURE | ||||||||||||||||||||||
| 82 | FUNCTION | ||||||||||||||||||||||
| 83 | HASHMAP | ||||||||||||||||||||||
| 84 | HASHSET | ||||||||||||||||||||||
| 85 | KEYWORD | ||||||||||||||||||||||
| 86 | LIST | ||||||||||||||||||||||
| 87 | MACRO | ||||||||||||||||||||||
| 88 | NIL | ||||||||||||||||||||||
| 89 | NUMBER | ||||||||||||||||||||||
| 90 | REGEX | ||||||||||||||||||||||
| 91 | STRBUILD | ||||||||||||||||||||||
| 92 | STRING | ||||||||||||||||||||||
| 93 | SYMBOL | ||||||||||||||||||||||
| 94 | SYSTEM | ||||||||||||||||||||||
| 95 | VAR | ||||||||||||||||||||||
| 96 | VECTOR | ||||||||||||||||||||||
| 97 | |||||||||||||||||||||||
| 98 | EXCEPTION | ||||||||||||||||||||||
| 99 | ILLEGALARGUMENTEXCEPTION | ||||||||||||||||||||||
| 100 | |||||||||||||||||||||||
| 101 | list | ||||||||||||||||||||||
| 102 | string | ||||||||||||||||||||||
| 103 | symbol | ||||||||||||||||||||||
| 104 | |||||||||||||||||||||||
| 105 | has | ||||||||||||||||||||||
| 106 | err | ||||||||||||||||||||||
| 107 | box_val | ||||||||||||||||||||||
| 108 | unbox_val | ||||||||||||||||||||||
| 109 | assert_args | ||||||||||||||||||||||
| 110 | comp_pair | ||||||||||||||||||||||
| 111 | nil | ||||||||||||||||||||||
| 112 | false | ||||||||||||||||||||||
| 113 | true | ||||||||||||||||||||||
| 114 | |||||||||||||||||||||||
| 115 | Dump | ||||||||||||||||||||||
| 116 | PPP | ||||||||||||||||||||||
| 117 | WWW | ||||||||||||||||||||||
| 118 | XXX | ||||||||||||||||||||||
| 119 | YYY | ||||||||||||||||||||||
| 120 | ZZZ | ||||||||||||||||||||||
| 121 | >; | ||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||
| 123 | |||||||||||||||||||||||
| 124 | { | ||||||||||||||||||||||
| 125 | 56 | my ($n, $t, $f); | |||||||||||||||||||||
| 126 | 56 | ($n, $t, $f) = (1, 1, 0); | |||||||||||||||||||||
| 127 | 56 | my $nil = bless \$n, 'Lingy::Nil'; | |||||||||||||||||||||
| 128 | 56 | my $true = bless \$t, BOOLEAN; | |||||||||||||||||||||
| 129 | 56 | my $false = bless \$f, BOOLEAN; | |||||||||||||||||||||
| 130 | 1748 | ▶ | sub nil { $nil } | ||||||||||||||||||||
|
Subroutine
nil: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 131 | 4372 | ▶ | sub true { $true } | ||||||||||||||||||||
|
Subroutine
true: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 132 | 21109 | ▶ | sub false { $false } | ||||||||||||||||||||
|
Subroutine
false: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||
| 134 | |||||||||||||||||||||||
| 135 | 56 | our $namespace_re = qr{(?: | |||||||||||||||||||||
| 136 | \w+ | ||||||||||||||||||||||
| 137 | (?:\.\w+)* | ||||||||||||||||||||||
| 138 | )}x; | ||||||||||||||||||||||
| 139 | |||||||||||||||||||||||
| 140 | 56 | our $symbol_re = qr{( | |||||||||||||||||||||
| 141 | \*?[-\w]+[\?\!\*\#\=]? | | ||||||||||||||||||||||
| 142 | [-+*/<>] | | ||||||||||||||||||||||
| 143 | ==? | | ||||||||||||||||||||||
| 144 | <= | | ||||||||||||||||||||||
| 145 | >=| | ||||||||||||||||||||||
| 146 | ->>? | ||||||||||||||||||||||
| 147 | )}x; | ||||||||||||||||||||||
| 148 | |||||||||||||||||||||||
| 149 | 0 | ▶ | sub OK { $Lingy::RT::OK } | ||||||||||||||||||||
|
Subroutine
OK: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 150 | |||||||||||||||||||||||
| 151 | 156509 | ▶ | sub list { LIST->new(@_) } | ||||||||||||||||||||
|
Subroutine
list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 152 | 478 | ▶ | sub string { STRING->new(@_) } | ||||||||||||||||||||
|
Subroutine
string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 153 | 174791 | ▶ | sub symbol { SYMBOL->new(@_) } | ||||||||||||||||||||
|
Subroutine
symbol: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 154 | |||||||||||||||||||||||
| 155 | 56 | ▶ | sub has { | ||||||||||||||||||||
|
Subroutine
has: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 156 | 56 | my ($caller) = caller; | |||||||||||||||||||||
| 157 | 56 | my $name = shift; | |||||||||||||||||||||
| 158 | my $method = | ||||||||||||||||||||||
| 159 | 8872 | ▶ | sub { | ||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
| |||||||||||||||||||||||
| 160 | $#_ | ||||||||||||||||||||||
| 161 | ? $_[0]{$name} = $_[1] | ||||||||||||||||||||||
| 162 | 8872 | ▶ | : $_[0]{$name}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 163 | 56 | }; | |||||||||||||||||||||
| 164 | 56 | ▶ | no strict 'refs'; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 165 | 56 | *{"${caller}::$name"} = $method; | |||||||||||||||||||||
| 166 | }; | ||||||||||||||||||||||
| 167 | |||||||||||||||||||||||
| 168 | 56 | our $error_prefix = ''; | |||||||||||||||||||||
| 169 | 50 | ▶ | sub err { | ||||||||||||||||||||
|
Subroutine
err: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||
| 170 | 50 | my $msg = shift; | |||||||||||||||||||||
| 171 | 50 | $msg = sprintf $msg, @_; | |||||||||||||||||||||
| 172 | |||||||||||||||||||||||
| 173 | # XXX This is needed to keep the mal tests passing for now. | ||||||||||||||||||||||
| 174 | 50 | ▶ | $error_prefix = 'Error:' if $ENV{LINGY_TEST}; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 175 | |||||||||||||||||||||||
| 176 | 50 | ▶ | if ($error_prefix) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 177 | 49 | ▶ | $msg = $error_prefix . | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 178 | ($msg =~ /\n./ ? "\n" : ' ') . | ||||||||||||||||||||||
| 179 | $msg; | ||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||
| 181 | |||||||||||||||||||||||
| 182 | 50 | die "$msg\n"; | |||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||
| 184 | |||||||||||||||||||||||
| 185 | 28 | ▶ | sub box_val { | ||||||||||||||||||||
|
Subroutine
box_val: called CC=6 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||
| 186 | map { | ||||||||||||||||||||||
| 187 | 28 | my $o = $_; | |||||||||||||||||||||
| 188 | 28 | my $type = ref($o); | |||||||||||||||||||||
| 189 | 28 | ▶ | if (not($type)) { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 190 | 7 | ▶ | /^\-?\d+$/ ? NUMBER->new($o) : STRING->new($o); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||
| 192 | elsif ($type eq 'HASH') { | ||||||||||||||||||||||
| 193 | 0 | HASHMAP->new([ | |||||||||||||||||||||
| 194 | map box_val($_), %$o | ||||||||||||||||||||||
| 195 | ]); | ||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||
| 197 | elsif ($type eq 'ARRAY') { | ||||||||||||||||||||||
| 198 | 0 | VECTOR->new([ | |||||||||||||||||||||
| 199 | map box_val($_), %$o | ||||||||||||||||||||||
| 200 | ]); | ||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||
| 202 | elsif ($type =~ /^(?:SCALAR|REF|Regexp)$/) { | ||||||||||||||||||||||
| 203 | 0 | XXX($o, "Lingy can't box this object yet"); | |||||||||||||||||||||
| 204 | } else { | ||||||||||||||||||||||
| 205 | 21 | $o; | |||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||
| 207 | } @_; | ||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||
| 209 | |||||||||||||||||||||||
| 210 | 13 | ▶ | sub unbox_val { | ||||||||||||||||||||
|
Subroutine
unbox_val: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 211 | 13 | my ($obj) = @_; | |||||||||||||||||||||
| 212 | 13 | ▶ | ref($obj) =~ /^ | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 213 | Lingy::( | ||||||||||||||||||||||
| 214 | String|Number|Boolean|Nil|HashMap|Vector|Fn | ||||||||||||||||||||||
| 215 | ) | ||||||||||||||||||||||
| 216 | $/x ? $obj->unbox : $obj; | ||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||
| 218 | |||||||||||||||||||||||
| 219 | 8 | ▶ | sub assert_args { | ||||||||||||||||||||
|
Subroutine
assert_args: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||
| 220 | 8 | my $args = shift; | |||||||||||||||||||||
| 221 | 8 | ▶ | for (my $i = 0; $i < @_; $i++) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 222 | 8 | ▶ | if (ref($args->[$i]) ne $_[$i]) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 223 | 1 | my (undef, undef, undef, $fn) = caller(1); | |||||||||||||||||||||
| 224 | 1 | err "Arg %d for '%s' must be '%s', not '%s'", | |||||||||||||||||||||
| 225 | $i, $fn, $_[$i], ref($args->[$i]); | ||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||
| 229 | |||||||||||||||||||||||
| 230 | 0 | ▶ | sub comp_pair { | ||||||||||||||||||||
|
Subroutine
comp_pair: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||
| 231 | 0 | my ($x, $y) = @_; | |||||||||||||||||||||
| 232 | 0 | ▶ | if (ref($x) eq NIL) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 233 | 0 | ▶ | return ref($y) eq NIL ? 0 : -1; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||
| 235 | 0 | ▶ | return 1 if ref($y) eq NIL; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 236 | 0 | ▶ | ref($x) eq ref($y) or | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 237 | err "Can't compare values of type '%s' and '%s'", | ||||||||||||||||||||||
| 238 | ref($x), ref($y); | ||||||||||||||||||||||
| 239 | 0 | ▶ | if (ref($x) eq VECTOR) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 240 | 0 | ▶ | return @$x cmp @$y unless @$x == @$y; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 241 | 0 | my $i = 0; | |||||||||||||||||||||
| 242 | 0 | for my $e (@$x) { | |||||||||||||||||||||
| 243 | 0 | ▶ | return 1 if $i > @$y; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 244 | 0 | my $r = comp_pair($x->[$i], $y->[$i]); | |||||||||||||||||||||
| 245 | 0 | ▶ | return $r if $r; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 246 | 0 | $i++; | |||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||
| 248 | 0 | return 0; | |||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||
| 250 | 0 | "$x" cmp "$y"; | |||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||
| 252 | |||||||||||||||||||||||
| 253 | 3 | ▶ | sub Dump { | ||||||||||||||||||||
|
Subroutine
Dump: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 254 | 3 | _dump(@_); | |||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||
| 256 | 1 | ▶ | sub PPP { | ||||||||||||||||||||
|
Subroutine
PPP: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 257 | 1 | require Lingy::Printer; | |||||||||||||||||||||
| 258 | 1 | die _dump(RT->printer->pr_str(@_)); | |||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||
| 260 | 1 | ▶ | sub WWW { | ||||||||||||||||||||
|
Subroutine
WWW: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||
| 261 | 1 | warn _dump(@_); | |||||||||||||||||||||
| 262 | 1 | ▶ | return wantarray ? @_ : $_[0]; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||
| 264 | 2 | ▶ | sub XXX { | ||||||||||||||||||||
|
Subroutine
XXX: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||
| 265 | 2 | die _dump(@_); | |||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||
| 267 | 0 | ▶ | sub YYY { | ||||||||||||||||||||
|
Subroutine
YYY: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||
| 268 | 0 | print _dump(@_); | |||||||||||||||||||||
| 269 | 0 | ▶ | return wantarray ? @_ : $_[0]; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||
| 271 | 0 | ▶ | sub ZZZ { | ||||||||||||||||||||
|
Subroutine
ZZZ: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||
| 272 | 0 | require Carp; | |||||||||||||||||||||
| 273 | 0 | Carp::confess _dump(@_); | |||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||
| 275 | 7 | ▶ | sub _dump { | ||||||||||||||||||||
|
Subroutine
_dump: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 276 | 7 | require YAML::PP; | |||||||||||||||||||||
| 277 | 7 | YAML::PP->new( | |||||||||||||||||||||
| 278 | schema => ['Core', 'Perl', '-dumpcode'] | ||||||||||||||||||||||
| 279 | )->dump_string(@_) . "...\n"; | ||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||
| 281 | |||||||||||||||||||||||
| 282 | 56 | 1; | |||||||||||||||||||||