| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
|
3
|
1
|
|
|
1
|
|
396
|
use Data::Dump::OneLine qw(dump1); |
|
|
1
|
|
|
|
|
3
|
|
|
4
|
1
|
|
|
1
|
|
334
|
use Log::ger; |
|
|
1
|
|
|
|
|
2273
|
|
|
|
1
|
|
|
|
|
39
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
6
|
1
|
|
|
1
|
|
158
|
use Perinci::Object; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
7
|
1
|
|
|
1
|
|
242
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
651
|
|
|
8
|
|
|
|
|
|
|
with 'Perinci::To::Doc::Role::Section'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has name => (is=>'rw'); |
|
11
|
|
|
|
|
|
|
has meta => (is=>'rw'); |
|
12
|
|
|
|
|
|
|
has url => (is=>'rw'); |
|
13
|
|
|
|
|
|
|
has child_metas => (is=>'rw'); |
|
14
|
|
|
|
|
|
|
has _pa => (is=>'rw'); |
|
15
|
|
|
|
|
|
|
has exports => (is=>'rw'); # hash, key=function name, val=0|1|2 (see Perinci::Sub::To::FuncBase's export) |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
18
|
|
|
|
|
|
|
our $DATE = '2022-05-14'; # DATE |
|
19
|
|
|
|
|
|
|
our $DIST = 'Perinci-To-Doc'; # DIST |
|
20
|
|
|
|
|
|
|
our $VERSION = '0.879'; # VERSION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my ($self, $args) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
0
|
7
|
$args->{meta} or die "Please specify meta"; |
|
25
|
|
|
|
|
|
|
$args->{child_metas} or die "Please specify child_metas"; |
|
26
|
1
|
50
|
|
|
|
4
|
$self->{doc_sections} //= [ |
|
27
|
1
|
50
|
|
|
|
3
|
'summary', |
|
28
|
|
|
|
|
|
|
'version', |
|
29
|
1
|
|
50
|
|
|
7
|
'description', |
|
30
|
|
|
|
|
|
|
'functions', |
|
31
|
|
|
|
|
|
|
'methods', |
|
32
|
|
|
|
|
|
|
'links', |
|
33
|
|
|
|
|
|
|
]; |
|
34
|
|
|
|
|
|
|
$self->{_pa} //= do { |
|
35
|
|
|
|
|
|
|
require Perinci::Access; |
|
36
|
1
|
|
33
|
|
|
5
|
Perinci::Access->new; |
|
37
|
1
|
|
|
|
|
1904
|
}; |
|
38
|
1
|
|
|
|
|
871
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my ($self, %opts) = @_; |
|
41
|
|
|
|
|
|
|
log_trace("=> PackageBase's before_gen_doc(opts=%s)", \%opts); |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
0
|
|
# initialize hash to store [intermediate] result |
|
44
|
0
|
|
|
|
|
|
$self->{_doc_res} = {}; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
# provide simple default implementation without any text wrapping. subclass such |
|
48
|
|
|
|
|
|
|
# as Perinci::To::Text will use another implementation, one that supports text |
|
49
|
|
|
|
|
|
|
# wrapping for example (provided by |
|
50
|
|
|
|
|
|
|
# Perinci::To::Doc::Role::Section::AddTextLines). |
|
51
|
|
|
|
|
|
|
my $self = shift; |
|
52
|
|
|
|
|
|
|
my $opts; |
|
53
|
|
|
|
|
|
|
if (ref($_[0]) eq 'HASH') { $opts = shift } |
|
54
|
|
|
|
|
|
|
$opts //= {}; |
|
55
|
0
|
|
|
0
|
0
|
|
|
|
56
|
0
|
|
|
|
|
|
my @lines = map { $_ . (/\n\z/s ? "" : "\n") } |
|
57
|
0
|
0
|
|
|
|
|
map {/\n/ ? split /\n/ : $_} @_; |
|
|
0
|
|
|
|
|
|
|
|
58
|
0
|
|
0
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $indent = $self->doc_indent_str x $self->doc_indent_level; |
|
60
|
0
|
0
|
|
|
|
|
push @{$self->doc_lines}, |
|
61
|
0
|
0
|
|
|
|
|
map {"$indent$_"} @lines; |
|
|
0
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
0
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my ($self) = @_; |
|
65
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
my $rimeta = rimeta($self->meta); |
|
67
|
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
0
|
|
my $name = $self->name // $rimeta->langprop("name") // "UnnamedModule"; |
|
70
|
|
|
|
|
|
|
my $summary = $rimeta->langprop("summary"); |
|
71
|
0
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$dres->{name} = $name; |
|
73
|
|
|
|
|
|
|
$dres->{summary} = $summary; |
|
74
|
0
|
|
0
|
|
|
|
} |
|
|
|
|
0
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
0
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
my ($self) = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $rimeta = rimeta($self->meta); |
|
81
|
|
|
|
0
|
0
|
|
my $dres = $self->{_doc_res}; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
$dres->{description} = $rimeta->langprop("description"); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
0
|
|
|
0
|
0
|
|
|
|
86
|
|
|
|
|
|
|
require Perinci::Sub::To::FuncBase; |
|
87
|
0
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my ($self) = @_; |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
my $cmetas = $self->child_metas; |
|
91
|
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# list all functions |
|
94
|
0
|
|
|
0
|
0
|
|
my @func_uris = grep {m!(\A|/)\w+\z!} sort keys %$cmetas; |
|
95
|
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
# generate doc for all functions |
|
97
|
|
|
|
|
|
|
$dres->{functions} = {}; |
|
98
|
0
|
|
|
|
|
|
$dres->{function_names_by_meta_addr} = {}; |
|
99
|
0
|
|
|
|
|
|
for my $furi (@func_uris) { |
|
100
|
|
|
|
|
|
|
my $fname = $furi; $fname =~ s!.+/!!; |
|
101
|
|
|
|
|
|
|
my $meta = $cmetas->{$furi}; |
|
102
|
0
|
|
|
|
|
|
next if $meta->{'x.no_index'} || grep { $_ eq 'hidden' } @{ $meta->{tags} // [] }; |
|
|
0
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
push @{ $dres->{function_names_by_meta_addr}{"$meta"} }, $fname; |
|
104
|
|
|
|
|
|
|
$dres->{functions}{$furi} = |
|
105
|
0
|
|
|
|
|
|
$self->_gen_func_doc( |
|
106
|
0
|
|
|
|
|
|
parent=>$self, |
|
107
|
0
|
|
|
|
|
|
name=>$fname, |
|
108
|
0
|
|
|
|
|
|
meta=>$meta, |
|
|
0
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
url=> ($self->{url}//'') . $furi, |
|
110
|
0
|
0
|
0
|
|
|
|
); |
|
|
0
|
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
$dres->{function_metas}{$furi} = $meta; |
|
|
0
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# already done by gen_doc_section_functions |
|
116
|
|
|
|
|
|
|
} |
|
117
|
0
|
|
0
|
|
|
|
|
|
118
|
|
|
|
|
|
|
} |
|
119
|
0
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
1; |
|
121
|
|
|
|
|
|
|
# ABSTRACT: Base class for Perinci::To::* package documentation generators |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
0
|
0
|
|
|
|
124
|
|
|
|
|
|
|
=pod |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=encoding UTF-8 |
|
127
|
|
|
|
0
|
0
|
|
|
|
128
|
|
|
|
|
|
|
=head1 NAME |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Perinci::To::PackageBase - Base class for Perinci::To::* package documentation generators |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 VERSION |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This document describes version 0.879 of Perinci::To::PackageBase (from Perl distribution Perinci-To-Doc), released on 2022-05-14. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=for Pod::Coverage .+ |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Perinci-To-Doc>. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 SOURCE |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Perinci-To-Doc>. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 AUTHOR |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
|
154
|
|
|
|
|
|
|
GitHub. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
|
157
|
|
|
|
|
|
|
simply modify the code, then test via: |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
% prove -l |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
|
162
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
|
163
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
|
164
|
|
|
|
|
|
|
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required |
|
165
|
|
|
|
|
|
|
beyond that are considered a bug and can be reported to me. |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013 by perlancar <perlancar@cpan.org>. |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
172
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 BUGS |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-To-Doc> |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
179
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
180
|
|
|
|
|
|
|
feature. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |