| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perinci::To::Text; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
137528
|
use 5.010001; |
|
|
1
|
|
|
|
|
15
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Log::ger; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
5
|
1
|
|
|
1
|
|
806
|
use Moo; |
|
|
1
|
|
|
|
|
11565
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
2014
|
use Locale::TextDomain::UTF8 'Perinci-To-Doc'; |
|
|
1
|
|
|
|
|
21105
|
|
|
|
1
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends 'Perinci::To::PackageBase'; |
|
10
|
|
|
|
|
|
|
with 'Perinci::To::Doc::Role::Section::AddTextLines'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
13
|
|
|
|
|
|
|
our $DATE = '2022-10-15'; # DATE |
|
14
|
|
|
|
|
|
|
our $DIST = 'Perinci-To-Doc'; # DIST |
|
15
|
|
|
|
|
|
|
our $VERSION = '0.880'; # VERSION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub BUILD { |
|
18
|
1
|
|
|
1
|
0
|
44
|
my ($self, $args) = @_; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub gen_doc_section_summary { |
|
22
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#my $meta = $self->meta; |
|
25
|
0
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self->SUPER::gen_doc_section_summary; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $name_summary = join( |
|
30
|
|
|
|
|
|
|
"", |
|
31
|
|
|
|
|
|
|
$dres->{name} // "", |
|
32
|
|
|
|
|
|
|
($dres->{name} && $dres->{summary} ? ' - ' : ''), |
|
33
|
0
|
0
|
0
|
|
|
|
$dres->{summary} // "" |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$self->add_doc_lines(uc(__("Name")), ""); |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$self->inc_doc_indent; |
|
39
|
0
|
|
|
|
|
|
$self->add_doc_lines($name_summary); |
|
40
|
0
|
|
|
|
|
|
$self->dec_doc_indent; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub gen_doc_section_version { |
|
44
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
45
|
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my $meta = $self->meta; |
|
47
|
|
|
|
|
|
|
#my $dres = $self->{_doc_res}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self->add_doc_lines("", uc(__("Version")), ""); |
|
50
|
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->inc_doc_indent; |
|
52
|
0
|
|
0
|
|
|
|
$self->add_doc_lines($meta->{entity_v} // '?'); |
|
53
|
0
|
|
|
|
|
|
$self->dec_doc_indent; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub gen_doc_section_description { |
|
57
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
58
|
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->SUPER::gen_doc_section_description; |
|
62
|
0
|
0
|
|
|
|
|
return unless $dres->{description}; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$self->add_doc_lines("", uc(__("Description")), ""); |
|
65
|
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->inc_doc_indent; |
|
67
|
0
|
|
|
|
|
|
$self->add_doc_lines($dres->{description}); |
|
68
|
0
|
|
|
|
|
|
$self->dec_doc_indent; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _gen_func_doc { |
|
72
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
73
|
0
|
|
|
|
|
|
my $o = Perinci::Sub::To::Text->new(_pa=>$self->{_pa}, @_); |
|
74
|
0
|
|
|
|
|
|
$o->gen_doc; |
|
75
|
0
|
|
|
|
|
|
$o->doc_lines; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub gen_doc_section_functions { |
|
79
|
0
|
|
|
0
|
0
|
|
require Perinci::Sub::To::Text; |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
my ($self) = @_; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$self->add_doc_lines("", uc(__("Functions")), ""); |
|
86
|
0
|
|
|
|
|
|
$self->SUPER::gen_doc_section_functions; |
|
87
|
0
|
|
|
|
|
|
my $i; |
|
88
|
0
|
|
|
|
|
|
for my $furi (sort keys %{ $dres->{functions} }) { |
|
|
0
|
|
|
|
|
|
|
|
89
|
0
|
0
|
|
|
|
|
$self->add_doc_lines('') if $i++; |
|
90
|
0
|
|
|
|
|
|
my $meta = $dres->{function_metas}{$furi}; |
|
91
|
0
|
0
|
0
|
|
|
|
next if ($meta->{is_meth} || $meta->{is_class_meth}) && !($meta->{is_func} // 1); |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
for (@{ $dres->{functions}{$furi} }) { |
|
|
0
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
chomp; |
|
94
|
0
|
|
|
|
|
|
$self->add_doc_lines({wrap=>0}, $_); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
} |
|
97
|
0
|
|
|
|
|
|
$self->add_doc_lines(''); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub gen_doc_section_methods { |
|
101
|
0
|
|
|
0
|
0
|
|
require Perinci::Sub::To::Text; |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
my ($self) = @_; |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $dres = $self->{_doc_res}; |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$self->add_doc_lines("", uc(__("Methods")), ""); |
|
108
|
0
|
|
|
|
|
|
$self->SUPER::gen_doc_section_methods; |
|
109
|
0
|
|
|
|
|
|
my $i; |
|
110
|
0
|
|
|
|
|
|
for my $furi (sort keys %{ $dres->{functions} }) { |
|
|
0
|
|
|
|
|
|
|
|
111
|
0
|
0
|
|
|
|
|
$self->add_doc_lines('') if $i++; |
|
112
|
0
|
|
|
|
|
|
my $meta = $dres->{function_metas}{$furi}; |
|
113
|
0
|
0
|
0
|
|
|
|
next unless ($meta->{is_meth} || $meta->{is_class_meth}) && !($meta->{is_func} // 1); |
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
for (@{ $dres->{functions}{$furi} }) { |
|
|
0
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
chomp; |
|
116
|
0
|
|
|
|
|
|
$self->add_doc_lines({wrap=>0}, $_); |
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
} |
|
119
|
0
|
|
|
|
|
|
$self->add_doc_lines(''); |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
|
123
|
|
|
|
|
|
|
# ABSTRACT: Generate text documentation for a package from Rinci metadata |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
__END__ |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=pod |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=encoding UTF-8 |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 NAME |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Perinci::To::Text - Generate text documentation for a package from Rinci metadata |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 VERSION |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This document describes version 0.880 of Perinci::To::Text (from Perl distribution Perinci-To-Doc), released on 2022-10-15. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
use Perinci::To::POD; |
|
142
|
|
|
|
|
|
|
my $doc = Perinci::To::Text->new( |
|
143
|
|
|
|
|
|
|
name=>'Foo::Bar', meta => {...}, child_metas=>{...}); |
|
144
|
|
|
|
|
|
|
say $doc->gen_doc; |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
You can also try the L<peri-doc> script with the C<--format text> option: |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
% peri-doc --format text /Some/Module/ |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
To generate a usage-like help message for a single function, you can try the |
|
151
|
|
|
|
|
|
|
L<peri-func-usage> from the L<Perinci::CmdLine::Classic> distribution. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=for Pod::Coverage .+ |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 HOMEPAGE |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Perinci-To-Doc>. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 SOURCE |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Perinci-To-Doc>. |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 AUTHOR |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
|
171
|
|
|
|
|
|
|
GitHub. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
|
174
|
|
|
|
|
|
|
simply modify the code, then test via: |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
% prove -l |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
|
179
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
|
180
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
|
181
|
|
|
|
|
|
|
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
|
182
|
|
|
|
|
|
|
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
|
183
|
|
|
|
|
|
|
that are considered a bug and can be reported to me. |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013 by perlancar <perlancar@cpan.org>. |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
190
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 BUGS |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-To-Doc> |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
197
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
198
|
|
|
|
|
|
|
feature. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |