line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Specio::Library::Structured::Map; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
20
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
80
|
|
4
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
115
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.46'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
16
|
use Carp qw( confess ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
119
|
|
9
|
3
|
|
|
3
|
|
17
|
use List::Util (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
49
|
|
10
|
3
|
|
|
3
|
|
20
|
use Specio::Library::Builtins; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
19
|
|
11
|
3
|
|
|
3
|
|
19
|
use Specio::TypeChecks qw( does_role ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1073
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $hashref = t('HashRef'); |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
0
|
16
|
sub parent {$hashref} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
18
|
|
|
|
|
|
|
sub _inline { |
19
|
1
|
|
|
1
|
|
6
|
$hashref->inline_check( $_[1] ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _parameterization_args_builder { |
23
|
2
|
|
|
2
|
|
35
|
my $self = shift; |
24
|
2
|
|
|
|
|
4
|
my $args = shift; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
5
|
for my $k (qw( key value )) { |
27
|
|
|
|
|
|
|
does_role( |
28
|
4
|
50
|
|
|
|
18
|
$args->{$k}, |
29
|
|
|
|
|
|
|
'Specio::Constraint::Role::Interface' |
30
|
|
|
|
|
|
|
) |
31
|
|
|
|
|
|
|
or confess |
32
|
|
|
|
|
|
|
qq{The "$k" parameter passed to ->parameterize must be one or more objects which do the Specio::Constraint::Role::Interface role}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
confess |
35
|
|
|
|
|
|
|
qq{The "$k" parameter passed to ->parameterize must be an inlinable constraint} |
36
|
4
|
50
|
|
|
|
51
|
unless $args->{$k}->can_be_inlined; |
37
|
|
|
|
|
|
|
} |
38
|
2
|
|
|
|
|
11
|
return map { $_ => $args->{$_} } qw( key value ); |
|
4
|
|
|
|
|
13
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _name_builder { |
42
|
2
|
|
|
2
|
|
9
|
my $self = shift; |
43
|
2
|
|
|
|
|
2
|
my $p = shift; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
## no critic (Subroutines::ProtectPrivateSubs) |
46
|
|
|
|
|
|
|
return |
47
|
|
|
|
|
|
|
'Map{ ' |
48
|
|
|
|
|
|
|
. $self->_name_or_anon( $p->{key} ) . ' => ' |
49
|
2
|
|
|
|
|
8
|
. $self->_name_or_anon( $p->{value} ) . ' }'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _structured_inline_generator { |
53
|
3
|
|
|
3
|
|
7
|
my $self = shift; |
54
|
3
|
|
|
|
|
4
|
my $val = shift; |
55
|
3
|
|
|
|
|
7
|
my %args = @_; |
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
5
|
my $code = <<'EOF'; |
58
|
|
|
|
|
|
|
( |
59
|
|
|
|
|
|
|
( %s ) |
60
|
|
|
|
|
|
|
&& ( List::Util::all { %s } keys %%{ %s } ) |
61
|
|
|
|
|
|
|
&& ( List::Util::all { %s } values %%{ %s } ) |
62
|
|
|
|
|
|
|
) |
63
|
|
|
|
|
|
|
EOF |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
return sprintf( |
66
|
|
|
|
|
|
|
$code, |
67
|
|
|
|
|
|
|
$hashref->_inline_check($val), |
68
|
|
|
|
|
|
|
$args{key}->inline_check('$_'), |
69
|
|
|
|
|
|
|
$val, |
70
|
3
|
|
|
|
|
10
|
$args{value}->inline_check('$_'), |
71
|
|
|
|
|
|
|
$val, |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# ABSTRACT: Guts of Map structured type |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding UTF-8 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Specio::Library::Structured::Map - Guts of Map structured type |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
version 0.46 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
There are no user facing parts here. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=for Pod::Coverage .* |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SUPPORT |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Specio/issues>. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 SOURCE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
The source code repository for Specio can be found at L<https://github.com/houseabsolute/Specio>. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 AUTHOR |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is Copyright (c) 2012 - 2020 by Dave Rolsky. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software, licensed under: |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
The full text of the license can be found in the |
122
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |