line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
88981
|
use warnings; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
|
|
14
|
|
|
1
|
|
|
|
|
25
|
|
5
|
|
|
|
|
|
|
use Exporter 'import'; |
6
|
1
|
|
|
1
|
|
4
|
our @EXPORT_OK = qw(module_abstract); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
191
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $DATE = '2021-08-27'; # DATE |
10
|
|
|
|
|
|
|
our $DIST = 'Module-Abstract'; # DIST |
11
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require Module::Installed::Tiny; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
1
|
516
|
my $module = shift; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
|
|
1483
|
my $src = Module::Installed::Tiny::module_source($module); |
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
|
|
4
|
return $1 if $src =~ /^=head1 NAME\n\n.+? - (.+)/m; |
20
|
|
|
|
|
|
|
return $1 if $src =~ /^#\s*ABSTRACT\s*:\s*(.+)/m; |
21
|
1
|
50
|
|
|
|
170
|
undef; |
22
|
0
|
0
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |
25
|
|
|
|
|
|
|
# ABSTRACT: Extract the abstract of a locally installed Perl module |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=pod |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=encoding UTF-8 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Module::Abstract - Extract the abstract of a locally installed Perl module |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 VERSION |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
This document describes version 0.002 of Module::Abstract (from Perl distribution Module-Abstract), released on 2021-08-27. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SYNOPSIS |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use Module::Abstract qw(module_abstract); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
say module_abstract("strict"); # => prints something like: Perl pragma to restrict unsafe constructs |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 FUNCTIONS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 module_abstract |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Usage: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $abstract = module_abstract($mod_name); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Extract abstract from module source. Will first load module source using |
57
|
|
|
|
|
|
|
L<Module::Installed::Tiny>'s C<module_source()> function (which dies on failure |
58
|
|
|
|
|
|
|
e.g. when it can't find the module). Then will search using simple regex this |
59
|
|
|
|
|
|
|
pattern: |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Some::Module::Name - some abstract |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
or (usually present in L<Dist::Zilla>-managed distribution): |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#ABSTRACT: some abstract |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Will return undef if abstract cannot be found. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 HOMEPAGE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please visit the project's homepage at L<https://metacpan.org/release/Module-Abstract>. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SOURCE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Source repository is at L<https://github.com/perlancar/perl-Module-Abstract>. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 SEE ALSO |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
L<App::lcpan> also contains routine to extract abstract from module. It might |
82
|
|
|
|
|
|
|
use Module::Abstract in the future. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L<pmabstract> from L<App::PMUtils>, a CLI front-end for Module::Abstract. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 AUTHOR |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
perlancar <perlancar@cpan.org> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 CONTRIBUTING |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
To contribute, you can send patches by email/via RT, or send pull requests on |
94
|
|
|
|
|
|
|
GitHub. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Most of the time, you don't need to build the distribution yourself. You can |
97
|
|
|
|
|
|
|
simply modify the code, then test via: |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
% prove -l |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
If you want to build the distribution (e.g. to try to install it locally on your |
102
|
|
|
|
|
|
|
system), you can install L<Dist::Zilla>, |
103
|
|
|
|
|
|
|
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
104
|
|
|
|
|
|
|
Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required |
105
|
|
|
|
|
|
|
beyond that are considered a bug and can be reported to me. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This software is copyright (c) 2021 by perlancar <perlancar@cpan.org>. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
112
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 BUGS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Abstract> |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
119
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
120
|
|
|
|
|
|
|
feature. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |