line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
3
|
22
|
|
|
22
|
|
9180
|
use strict; |
|
22
|
|
|
|
|
65
|
|
4
|
22
|
|
|
22
|
|
95
|
use warnings; |
|
22
|
|
|
|
|
37
|
|
|
22
|
|
|
|
|
401
|
|
5
|
22
|
|
|
22
|
|
98
|
use Log::ger; |
|
22
|
|
|
|
|
36
|
|
|
22
|
|
|
|
|
539
|
|
6
|
22
|
|
|
22
|
|
107
|
|
|
22
|
|
|
|
|
45
|
|
|
22
|
|
|
|
|
134
|
|
7
|
|
|
|
|
|
|
use Mo qw(build default); |
8
|
22
|
|
|
22
|
|
4489
|
use Role::Tiny::With; |
|
22
|
|
|
|
|
37
|
|
|
22
|
|
|
|
|
107
|
|
9
|
22
|
|
|
22
|
|
5303
|
|
|
22
|
|
|
|
|
40
|
|
|
22
|
|
|
|
|
6541
|
|
10
|
|
|
|
|
|
|
extends 'Data::Sah::Compiler::Prog::TH'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
13
|
|
|
|
|
|
|
our $DATE = '2022-08-20'; # DATE |
14
|
|
|
|
|
|
|
our $DIST = 'Data-Sah'; # DIST |
15
|
|
|
|
|
|
|
our $VERSION = '0.912'; # VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ($self, $cd, $indices_expr, $data_name, $data_term, $code_at_sub_begin) = @_; |
18
|
|
|
|
|
|
|
my $c = $self->compiler; |
19
|
103
|
|
|
103
|
0
|
265
|
my $cv = $cd->{cl_value}; |
20
|
103
|
|
|
|
|
231
|
my $dt = $cd->{data_term}; |
21
|
103
|
|
|
|
|
389
|
|
22
|
103
|
|
|
|
|
165
|
local $cd->{_subdata_level} = $cd->{_subdata_level} + 1; |
23
|
|
|
|
|
|
|
|
24
|
103
|
|
|
|
|
280
|
$c->add_runtime_module($cd, 'List::Util'); |
25
|
|
|
|
|
|
|
my %iargs = %{$cd->{args}}; |
26
|
103
|
|
|
|
|
352
|
$iargs{outer_cd} = $cd; |
27
|
103
|
|
|
|
|
266
|
$iargs{data_name} = $data_name; |
|
103
|
|
|
|
|
1281
|
|
28
|
103
|
|
|
|
|
284
|
$iargs{data_term} = $data_term; |
29
|
103
|
|
|
|
|
150
|
$iargs{schema} = $cv; |
30
|
103
|
|
|
|
|
159
|
$iargs{schema_is_normalized} = 0; |
31
|
103
|
|
|
|
|
183
|
$iargs{cache} = $cd->{args}{cache}; |
32
|
103
|
|
|
|
|
180
|
$iargs{indent_level}++; |
33
|
103
|
|
|
|
|
187
|
$iargs{data_term_includes_topic_var} = 1; |
34
|
103
|
|
|
|
|
200
|
my $icd = $c->compile(%iargs); |
35
|
103
|
|
|
|
|
192
|
my @code = ( |
36
|
103
|
|
|
|
|
577
|
"!defined(List::Util::first(sub {", ($code_at_sub_begin // ''), "!(\n", |
37
|
|
|
|
|
|
|
($c->indent_str($cd), |
38
|
|
|
|
|
|
|
"(\$_sahv_dpath->[-1] = \$_),\n") x !!$cd->{use_dpath}, |
39
|
|
|
|
|
|
|
$icd->{result}, "\n", |
40
|
|
|
|
|
|
|
$c->indent_str($icd), ")}, ", |
41
|
103
|
|
50
|
|
|
830
|
$indices_expr, |
42
|
|
|
|
|
|
|
"))", |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
$c->add_ccl($cd, join("", @code), {subdata=>1}); |
45
|
|
|
|
|
|
|
} |
46
|
103
|
|
|
|
|
1162
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
# ABSTRACT: Base class for perl type handlers |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=pod |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=encoding UTF-8 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Data::Sah::Compiler::perl::TH - Base class for perl type handlers |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 VERSION |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This document describes version 0.912 of Data::Sah::Compiler::perl::TH (from Perl distribution Data-Sah), released on 2022-08-20. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=for Pod::Coverage ^(compiler|clause_.+|gen_.+)$ |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 HOMEPAGE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SOURCE |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Data-Sah>. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
81
|
|
|
|
|
|
|
GitHub. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
84
|
|
|
|
|
|
|
simply modify the code, then test via: |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
% prove -l |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
89
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
90
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
91
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
92
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
93
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
100
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 BUGS |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah> |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
107
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
108
|
|
|
|
|
|
|
feature. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |