Skilletor/Bundles.pm

filter: Statementstmt 99.5% 211 / 212 Branchbran 95.4% 84 / 88 Conditioncond 71.4% 30 / 42 MC/DCmcdc 57.6% 15 / 26 Subroutinesub 100% 29 / 29 Podpod 100% 7 / 7 totaltotal 93.0% 376 / 404 CC 69 SCAR 23.0
CC
69
Cov
95%
parse_bundle
18.1
_foreign_entry
16.3
__ANON__
16.0
CRAP 10.0
« Skilletor/Source/Url.pm ↑ Summary Skilletor/Config.pm »
1 package Skilletor::Bundles;
2 # ABSTRACT: Bundle files (spec §15), their expansion, and name patterns
3  
4 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 34 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 34 ▶use Exporter qw( import );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 34 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 34 ▶use Skilletor::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 34 ▶use Skilletor::Error::Bundle;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 34 ▶use Skilletor::Error::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 34 ▶use Skilletor::Frontmatter qw( parse_yaml_document is_yaml_float );
Subroutine BEGIN: called CC=1 SCAR=0.0
13 34 ▶use Skilletor::JSON qw( js_ordered js_stringify js_type );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 34 ▶use Skilletor::JSString qw( js_lc js_trim );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 34 ▶use Skilletor::Spec qw( resolve_spec );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 34 our $VERSION = '0.001';
18  
19 34 our @EXPORT_OK = qw(
20 PATTERN_CHAR is_pattern matches_pattern same_identity match_entry
21 parse_bundle expand_bundle entry_miss
22 );
23  
24 # The character that makes a name a pattern (spec §3).
25 34 ▶use constant PATTERN_CHAR => '*';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 34 my $DOT = qr/[^\n\r\x{2028}\x{2029}]/; # JavaScript's `.`
28  
29 34 my @TYPE_KEYS = ( skills => 'skill', agents => 'agent', rules => 'rule' );
30 34 my @KEYS = qw( description skills agents rules bundles vars );
31 34 my %KEY = map { $_ => 1 } @KEYS;
32  
33 44 ▶sub is_pattern {
Subroutine is_pattern: called CC=2 SCAR=6.9
Pod documented
34 44 my ( $name ) = @_;
35 44 ▶ return index( $name, PATTERN_CHAR ) >= 0 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
index($name, '*') != -1 ? : 8 36 44
36 }
37  
38 # `*` matches any run of characters but a line terminator (JavaScript's `.*`); the rest is literal.
39 103 ▶sub matches_pattern {
Subroutine matches_pattern: called CC=2 SCAR=6.9
Pod documented
40 103 my ( $pattern, $name ) = @_;
41 103 my $re = join "$DOT*", map { quotemeta } split /\Q${\PATTERN_CHAR}\E/, $pattern, -1;
42 103 ▶ return $name =~ /\A$re\z/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /\A$re\z/ ? : 93 10 103
43 }
44  
45 # Two source identities (`git`/`url` values) are the same modulo a trailing `/`, `.git` and host case.
46 10 ▶sub same_identity {
Subroutine same_identity: called CC=2 SCAR=6.9
Pod documented
47 10 my ( $a, $b ) = @_;
48 10 ▶ return _normalize_identity($a) eq _normalize_identity($b) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
_normalize_identity($a) eq _normalize_identity($b) ? : 7 3 10
49 }
50  
51 20 ▶sub _normalize_identity {
Subroutine _normalize_identity: called CC=2 SCAR=6.9
52 20 my ( $u ) = @_;
53 20 ( my $s = js_trim($u) ) =~ s{/+\z}{};
54 20 $s =~ s/\.git\z//;
55 20 ▶ if ( $s =~ m{\A([a-z][a-z0-9+.\-]*://)([^/]*)($DOT*)\z}i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s =~ m[\A([a-z][a-z0-9+.\-]*://)([^/]*)($DOT*)\z]i) 16 4 20
56 16 $s = js_lc($1).js_lc($2).$3;
57 }
58 20 return $s;
59 }
60  
61 # Catalog items of $type a name or pattern names (spec §3).
62 15 ▶sub match_entry {
Subroutine match_entry: called CC=4 SCAR=13.9
Pod documented
63 15 my ( $cat, $type, $entry ) = @_;
64 15 ▶ return [ grep { $_->{type} eq $type && matches_pattern( $entry, $_->{name} ) } @{ $cat->{items} } ] if is_pattern($entry);
Branch: 1 branch
BranchTrueFalseTotal
if is_pattern($entry) 5 10 15
Condition100%3/3
$_->{'type'} eq $type && matches_pattern($entry, $_->{'name'})
!ll&&!rl&&r
1825
MC/DC100%2/2
$_->{'type'} eq $type && matches_pattern($entry, $_->{'name'})
$_->{'type'} eq $type matches_pattern($entry, $_->{'name'})
Truth table100%3/3
A && B
A= $_->{'type'} eq $typeB= matches_pattern($entry, $_->{'name'})
ABresult
0X0
100
111
65 10 ▶ return [ grep { $_->{type} eq $type && $_->{name} eq $entry } @{ $cat->{items} } ];
Condition100%3/3
$_->{'type'} eq $type && $_->{'name'} eq $entry
!ll&&!rl&&r
22199
MC/DC100%2/2
$_->{'type'} eq $type && $_->{'name'} eq $entry
$_->{'type'} eq $type $_->{'name'} eq $entry
Truth table100%3/3
A && B
A= $_->{'type'} eq $typeB= $_->{'name'} eq $entry
ABresult
0X0
100
111
66 }
67  
68 # The warning for an entry that matched $count items, if any (a bare `*` stays silent, spec §3).
69 15 ▶sub entry_miss {
Subroutine entry_miss: called CC=4 SCAR=13.9
Pod documented
70 15 my ( $type, $entry, $count ) = @_;
71 15 ▶ return undef if $count > 0 || $entry eq PATTERN_CHAR;
Branch: 1 branch
BranchTrueFalseTotal
if $count > 0 or $entry eq "*" 13 2 15
Condition66%2/3
$count > 0 or $entry eq "*"
l!l&&r!l&&!r
1302
MC/DC50%1/2
$count > 0 or $entry eq "*"
$count > 0 $entry eq "*"
Truth table66%2/3
A or B
A= $count > 0B= $entry eq "*"
ABresult
1X1
011
000
72 2 ▶ return is_pattern($entry) ? 'pattern '.$type.':'.$entry.' matches nothing' : $type.' '.$entry.' not found in the source';
Branch: 1 branch
BranchTrueFalseTotal
is_pattern($entry) ? : 1 1 2
73 }
74  
75 216 ▶sub _fail { Skilletor::Error::Bundle->throw( $_[0] ) }
Subroutine _fail: called CC=1 SCAR=0.0
76  
77 1 ▶sub _message { my ( $err ) = @_; return blessed $err && $err->can('message') ? $err->message : "$err" =~ s/ at \S+ line \d+\.?\n?\z//r }
Subroutine _message: called CC=3 SCAR=13.1
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($err) && $err->can('message') ? : 1 0 1
Condition33%1/3
builtin::blessed($err) and $err->can("message")
!ll&&!rl&&r
001
MC/DC0%0/2
builtin::blessed($err) and $err->can("message")
builtin::blessed($err) $err->can("message")
Truth table33%1/3
A and B
A= builtin::blessed($err)B= $err->can("message")
ABresult
0X0
100
111
78  
79 # A YAML value as plain JSON-like data (floats become numbers).
80 41 ▶sub _plain {
Subroutine _plain: called CC=4 SCAR=13.9
81 41 my ( $v ) = @_;
82 41 ▶ return $v->value if is_yaml_float($v);
Branch: 1 branch
BranchTrueFalseTotal
if is_yaml_float($v) 3 38 41
83 38 ▶ return [ map { _plain($_) } @$v ] if ref $v eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $v eq "ARRAY" 1 37 38
84 37 ▶ return js_ordered( map { ( $_ => _plain( $v->{$_} ) ) } keys %$v ) if ref $v eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $v eq "HASH" 13 24 37
85 24 return $v;
86 }
87  
88 245 ▶sub _string_list {
Subroutine _string_list: called CC=5 SCAR=16.1
89 245 my ( $value, $key ) = @_;
90 245 ▶ return [] unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 171 74 245
91 74 ▶ _fail( $key.' must be a list' ) unless ref $value eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $value eq "ARRAY" 2 72 74
92 return [
93 map {
94 72 ▶ _fail( $key.' entries must be strings (got '.js_stringify( _plain($_) ).')' ) unless _is_string($_);
Branch: 1 branch
BranchTrueFalseTotal
unless _is_string($_) 5 85 90
95 85 ▶ _fail( $key.' has an empty entry' ) if js_trim($_) eq '';
Branch: 1 branch
BranchTrueFalseTotal
if js_trim($_) eq "" 3 82 85
96 82 js_trim($_);
97 } @$value
98 ];
99 }
100  
101 168 ▶sub _is_string { my ( $v ) = @_; return !ref $v && js_type($v) eq 'string' }
Subroutine _is_string: called CC=2 SCAR=6.9
Condition100%3/3
!ref($v) && js_type($v) eq 'string'
!ll&&!rl&&r
44160
MC/DC100%2/2
!ref($v) && js_type($v) eq 'string'
!ref($v) js_type($v) eq 'string'
Truth table100%3/3
not(A) && B
A= !ref($v)B= js_type($v) eq 'string'
ABresult
0X0
100
111
102  
103 # `name@<spec>` resolved without a probe (spec §15.6): local paths, generic hosts, an address
104 # config load would refuse as a source and a ref or a path pinned by the address are errors.
105 24 ▶sub _foreign_entry {
Subroutine _foreign_entry: called CC=16 SCAR=27.9
106 24 my ( $type, $entry, $key ) = @_;
107 24 my $at = index $entry, '@';
108 24 my $name = substr $entry, 0, $at;
109 24 my $spec = substr $entry, $at + 1;
110 24 ▶ _fail( $key.': "'.$entry.'" has an empty name or address' ) if $name eq '' || $spec eq '';
Branch: 1 branch
BranchTrueFalseTotal
if $name eq "" or $spec eq "" 2 22 24
Condition100%3/3
$name eq "" or $spec eq ""
l!l&&r!l&&!r
1122
MC/DC100%2/2
$name eq "" or $spec eq ""
$name eq "" $spec eq ""
Truth table100%3/3
A or B
A= $name eq ""B= $spec eq ""
ABresult
1X1
011
000
111 22 my $r;
112 22 my $ok = eval {
113 22 ▶ $r = resolve_spec( $spec, sub { Skilletor::Error::Spec->throw('probe') } );
Subroutine __ANON__: called CC=1 SCAR=0.0
114 20 ▶ if ( $r->{kind} eq 'local' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->{"kind"} eq "local") 1 19 20
115 1 _fail( $key.': "'.$entry.'" names a local path; a bundle can only name remote sources' );
116 }
117 19 ▶ if ( defined $r->{ref} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $r->{"ref"}) 2 17 19
118 2 ▶ my $pins = 'ref '.js_stringify( $r->{ref} ).( defined $r->{path} ? ' and path '.js_stringify( $r->{path} ) : '' );
Branch: 1 branch
BranchTrueFalseTotal
defined $r->{'path'} ? : 1 1 2
119 2 _fail( $key.': "'.$entry.'" pins '.$pins.', but an entry names its source by address alone: write '.$name.'@'.$r->{value} );
120 }
121 17 1;
122 };
123 22 ▶ unless ($ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 5 17 22
124 5 my $err = $@;
125 5 ▶ die $err if blessed $err && $err->isa('Skilletor::Error::Bundle');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($err) and $err->isa("Skilletor::Error::Bundle") 3 2 5
Condition66%2/3
builtin::blessed($err) and $err->isa("Skilletor::Error::Bundle")
!ll&&!rl&&r
023
MC/DC50%1/2
builtin::blessed($err) and $err->isa("Skilletor::Error::Bundle")
builtin::blessed($err) $err->isa("Skilletor::Error::Bundle")
Truth table66%2/3
A and B
A= builtin::blessed($err)B= $err->isa("Skilletor::Error::Bundle")
ABresult
0X0
100
111
126 2 ▶ if ( blessed $err && $err->isa('Skilletor::Error::Spec') && $err->message eq 'probe' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($err) and $err->isa("Skilletor::Error::Spec") and $err->message eq "probe") 1 1 2
Condition50%3/6
builtin::blessed($err) and $err->isa("Skilletor::Error::Spec") and $err->message eq "probe"
!ll&&!rl&&r
011
builtin::blessed($err) and $err->isa("Skilletor::Error::Spec")
!ll&&!rl&&r
002
MC/DC33%1/3
builtin::blessed($err) and $err->isa("Skilletor::Error::Spec") and $err->message eq "probe"
builtin::blessed($err) $err->isa("Skilletor::Error::Spec") $err->message eq "probe"
Truth table50%2/4
A and B and C
A= builtin::blessed($err)B= $err->isa("Skilletor::Error::Spec")C= $err->message eq "probe"
ABCresult
0XX0
10X0
1100
1111
127 1 _fail( $key.': "'.$entry.'": a generic host must be written as a full https:// URL' );
128 }
129 1 _fail( $key.': "'.$entry.'": '._message($err) );
130 }
131 17 ▶ my $field = $r->{kind} eq 'git' ? { git => $r->{value} } : { url => $r->{value} };
Branch: 1 branch
BranchTrueFalseTotal
$r->{'kind'} eq 'git' ? : 15 2 17
132 17 ▶ unless ( eval { Skilletor::Config->source_fields( $field, 'sources.'.$r->{derivedName} ); 1 } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { "Skilletor::Config"->source_fields($field, 'sources.' . $r->{"derivedName"}); 1 } }) 1 16 17
133 1 my $err = $@;
134 1 ▶ die $err unless blessed $err && $err->isa('Skilletor::Error::Config');
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($err) and $err->isa("Skilletor::Error::Config") 0 1 1
Condition33%1/3
builtin::blessed($err) and $err->isa("Skilletor::Error::Config")
!ll&&!rl&&r
001
MC/DC0%0/2
builtin::blessed($err) and $err->isa("Skilletor::Error::Config")
builtin::blessed($err) $err->isa("Skilletor::Error::Config")
Truth table33%1/3
A and B
A= builtin::blessed($err)B= $err->isa("Skilletor::Error::Config")
ABresult
0X0
100
111
135 1 _fail( $key.': "'.$entry.'" cannot be added as a source: '.$err->message );
136 }
137 return {
138 type => $type,
139 entry => $entry,
140 name => $name,
141 spec => $spec,
142 url => $r->{value},
143 kind => $r->{kind},
144 derivedName => $r->{derivedName},
145 16 };
146 }
147  
148 257 ▶sub parse_bundle {
Subroutine parse_bundle: called CC=18 SCAR=29.0
Pod documented
149 257 my ( $text ) = @_;
150 257 my $data;
151 257 ▶ unless ( eval { $data = parse_yaml_document($text); 1 } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $data = parse_yaml_document($text); 1 } }) 150 107 257
152 150 my $err = $@;
153 150 ▶ _fail( $err->message ) if blessed $err && $err->isa('Skilletor::Error::Frontmatter');
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($err) and $err->isa("Skilletor::Error::Frontmatter") 150 0 150
Condition33%1/3
builtin::blessed($err) and $err->isa("Skilletor::Error::Frontmatter")
!ll&&!rl&&r
00150
MC/DC0%0/2
builtin::blessed($err) and $err->isa("Skilletor::Error::Frontmatter")
builtin::blessed($err) $err->isa("Skilletor::Error::Frontmatter")
Truth table33%1/3
A and B
A= builtin::blessed($err)B= $err->isa("Skilletor::Error::Frontmatter")
ABresult
0X0
100
111
154 0 die $err;
155 }
156 107 for my $key ( keys %$data ) {
157 199 ▶ _fail( 'unknown key "'.$key.'" (allowed: '.join( ', ', @KEYS ).')' ) unless $KEY{$key};
Branch: 1 branch
BranchTrueFalseTotal
unless $KEY{$key} 18 181 199
158 }
159 89 my $description = $data->{description};
160 89 ▶ _fail('description is required (a string)') unless defined $description && _is_string($description) && js_trim($description) ne '';
Branch: 1 branch
BranchTrueFalseTotal
unless defined $description and _is_string($description) and js_trim($description) ne "" 15 74 89
Condition100%6/6
defined $description and _is_string($description) and js_trim($description) ne ""
!ll&&!rl&&r
14174
defined $description and _is_string($description)
!ll&&!rl&&r
11375
MC/DC100%3/3
defined $description and _is_string($description) and js_trim($description) ne ""
defined $description _is_string($description) js_trim($description) ne ""
Truth table100%4/4
A and B and C
A= defined $descriptionB= _is_string($description)C= js_trim($description) ne ""
ABCresult
0XX0
10X0
1100
1111
161 74 my %def = ( description => $description, items => [], foreign => [], bundles => [], vars => js_ordered() );
162 74 my @pairs = @TYPE_KEYS;
163 74 ▶ while ( my ( $key, $type ) = splice @pairs, 0, 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = splice(@pairs, 0, 2)) 188 57 245
164 188 for my $entry ( @{ _string_list( $data->{$key}, $key ) } ) {
165 53 ▶ if ( index( $entry, '@' ) >= 0 ) { push @{ $def{foreign} }, _foreign_entry( $type, $entry, $key ) }
Branch: 1 branch
BranchTrueFalseTotal
if (index($entry, '@') != -1) { } 24 29 53
166 29 else { push @{ $def{items} }, { type => $type, entry => $entry } }
167 }
168 }
169 57 for my $name ( @{ _string_list( $data->{bundles}, 'bundles' ) } ) {
170 29 ▶ _fail( 'bundles: "'.$name.'" must be a bare name of this source' ) if index( $name, '@' ) >= 0;
Branch: 1 branch
BranchTrueFalseTotal
if index($name, "\@") != -1 2 27 29
171 27 ▶ _fail( 'bundles: "'.$name.'": patterns over bundle names are not supported' ) if is_pattern($name);
Branch: 1 branch
BranchTrueFalseTotal
if is_pattern($name) 2 25 27
172 25 push @{ $def{bundles} }, $name;
173 }
174 52 my $vars = $data->{vars};
175 52 ▶ if ( defined $vars ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $vars) 15 37 52
176 15 ▶ _fail('vars must be a mapping') unless ref $vars eq 'HASH' && !blessed $vars;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $vars eq "HASH" and not builtin::blessed($vars) 4 11 15
Condition66%2/3
ref $vars eq "HASH" and not builtin::blessed($vars)
!ll&&!rl&&r
4011
MC/DC50%1/2
ref $vars eq "HASH" and not builtin::blessed($vars)
ref $vars eq "HASH" not builtin::blessed($vars)
Truth table66%2/3
A and not(B)
A= ref $vars eq "HASH"B= not builtin::blessed($vars)
ABresult
0X0
100
111
177 11 $def{vars} = _plain($vars);
178 }
179 48 return \%def;
180 }
181  
182 #### Expansion (spec §15.2) ############################################
183  
184 4 ▶sub _label_path { join '/', @{ $_[0] } }
Subroutine _label_path: called CC=1 SCAR=0.0
185  
186 11 ▶sub expand_bundle {
Subroutine expand_bundle: called CC=2 SCAR=6.9
Pod documented
187 11 my ( $cat, $name ) = @_;
188 11 my %by_name = map { ( $_->{name} => $_ ) } @{ $cat->{bundles} };
189 11 my ( %members, @order );
190 11 my $out = { items => [], foreign => [], warnings => [] };
191  
192 11 my $visit;
193 21 ▶ $visit = sub {
Subroutine __ANON__: called CC=16 SCAR=27.7
194 21 my ( $bundle, $path, $outer ) = @_;
195 21 my $cb = $by_name{$bundle};
196 21 ▶ my $where = @$path ? 'bundle '.$bundle.' (included by '.$path->[-1].')' : 'bundle '.$bundle;
Branch: 1 branch
BranchTrueFalseTotal
@$path ? : 10 11 21
197 21 ▶ _fail( $where.' not found' ) unless $cb;
Branch: 1 branch
BranchTrueFalseTotal
unless $cb 2 19 21
198 19 ▶ _fail( $where.': '.$cb->{error} ) if defined $cb->{error};
Branch: 1 branch
BranchTrueFalseTotal
if defined $cb->{"error"} 4 15 19
199 15 my $here = [ @$path, $bundle ];
200 15 my $def = $cb->{def};
201 # Inner vars first, then the outer chain on top: the outer bundle wins.
202 15 my $chain = { path => $here, vars => js_ordered( map { ( $_ => $def->{vars}{$_} ) } keys %{ $def->{vars} } ), setters => {} };
203 15 $chain->{setters}{$_} = $bundle for keys %{ $def->{vars} };
204 15 ▶ if ($outer) {
Branch: 1 branch
BranchTrueFalseTotal
if ($outer) 8 7 15
205 8 $chain->{vars}{$_} = $outer->{vars}{$_} for keys %{ $outer->{vars} };
206 8 $chain->{setters}{$_} = $outer->{setters}{$_} for keys %{ $outer->{setters} };
207 }
208 15 for my $it ( @{ $def->{items} } ) {
209 15 my $found = match_entry( $cat, $it->{type}, $it->{entry} );
210 15 my $miss = entry_miss( $it->{type}, $it->{entry}, scalar @$found );
211 15 ▶ push @{ $out->{warnings} }, { bundle => $bundle, message => $miss } if defined $miss;
Branch: 1 branch
BranchTrueFalseTotal
if defined $miss 2 13 15
212 15 for my $ci (@$found) {
213 14 my $key = $ci->{type}.'/'.$ci->{name};
214 14 ▶ unless ( $members{$key} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($members{$key}) 12 2 14
215 12 $members{$key} = { type => $ci->{type}, name => $ci->{name}, chains => [] };
216 12 push @order, $key;
217 }
218 14 my $m = $members{$key};
219 14 ▶ push @{ $m->{chains} }, $chain unless grep { _label_path( $_->{path} ) eq _label_path($here) } @{ $m->{chains} };
Branch: 1 branch
BranchTrueFalseTotal
unless grep {_label_path($_->{"path"}) eq _label_path($here);} @{$$m{"chains"};} 14 0 14
220 }
221 }
222 15 push @{ $out->{foreign} }, { %$_, chain => $chain } for @{ $def->{foreign} };
223 15 for my $inner ( @{ $def->{bundles} } ) {
224 11 my ($at) = grep { $here->[$_] eq $inner } 0 .. $#$here;
225 11 ▶ _fail( 'bundle cycle '.join( " \x{2192} ", @{$here}[ $at .. $#$here ], $inner ) ) if defined $at;
Branch: 1 branch
BranchTrueFalseTotal
if defined $at 1 10 11
226 10 $visit->( $inner, $here, { %$chain, path => $here } );
227 }
228 11 };
229 11 my $ok = eval { $visit->( $name, [], undef ); 1 };
230 11 my $err = $@;
231 11 undef $visit; # the closure refers to itself
232 11 ▶ die $err unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 7 4 11
233 4 $out->{items} = [ map { $members{$_} } @order ];
234 4 return $out;
235 }
236  
237 34 1;
238  
239 __END__
« Skilletor/Source/Url.pm ↑ Summary Skilletor/Config.pm »