line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::PodFromEuclid; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Module::Install::PodFromEuclid - Module::Install extension to make POD from |
7
|
|
|
|
|
|
|
Getopt::Euclid-based scripts |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# In Makefile.PL: |
12
|
|
|
|
|
|
|
use inc::Module::Install; |
13
|
|
|
|
|
|
|
author 'John Doe'; |
14
|
|
|
|
|
|
|
license 'perl'; |
15
|
|
|
|
|
|
|
pod_from 'scripts/my_script.pl'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Module::Install::PodFromEuclid is a L extension that generates |
20
|
|
|
|
|
|
|
a C file automatically from an indicated script containing Getopt::Euclid |
21
|
|
|
|
|
|
|
command-line specifications. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
The POD file is generated using the --podfile option of Getopt::Euclid, but only |
24
|
|
|
|
|
|
|
whenever authors run C. While this extension will be bundled in |
25
|
|
|
|
|
|
|
your distribution, the pod_from command does nothing on the user-side. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Note: Authors should make sure that C is |
28
|
|
|
|
|
|
|
installed before running C. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This module was inspired and borrows a lot from C. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 COMMANDS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
This plugin adds the following Module::Install command: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=over |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=item C |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Does nothing on the user-side. On the author-side it will generate a C |
41
|
|
|
|
|
|
|
file that has the same base name as the Perl file, using Getopt::Euclid's |
42
|
|
|
|
|
|
|
--podfile feature: |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
pod_from 'scripts/my_script.pl'; # generate scripts/my_script.pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
If you use the C command, C will default to this value. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
all_from 'scripts/my_script.pl'; |
49
|
|
|
|
|
|
|
pod_from; # create scripts/my_script.pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=back |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 AUTHOR |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Florent Angly |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 LICENSE |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Copyright Florent Angly |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This module may be used, modified, and distributed under the same terms as Perl |
62
|
|
|
|
|
|
|
itself. Please see the license that came with your Perl distribution for details. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 SEE ALSO |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
L |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
1
|
|
26392
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
76
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
77
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
46
|
|
78
|
1
|
|
|
1
|
|
6
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
79
|
1
|
|
|
1
|
|
1654
|
use Env qw(@INC); |
|
1
|
|
|
|
|
3448
|
|
|
1
|
|
|
|
|
6
|
|
80
|
1
|
|
|
1
|
|
269
|
use base qw(Module::Install::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
725
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub pod_from { |
86
|
0
|
|
|
0
|
1
|
|
my ($self, $in_file) = @_; |
87
|
0
|
0
|
|
|
|
|
return unless $self->is_admin; |
88
|
0
|
0
|
|
|
|
|
if (not defined $in_file) { |
89
|
0
|
0
|
|
|
|
|
$in_file = $self->_all_from or die "Error: Could not determine file to make pod_from"; |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
my @inc = map { ( '-I', File::Spec->rel2abs($_) ) } @INC; |
|
0
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# use same -I included modules as caller |
93
|
0
|
|
|
|
|
|
my @args = ($^X, @inc, $in_file, '--podfile'); |
94
|
0
|
0
|
|
|
|
|
system(@args) == 0 or die "Error: Could not run command ".join(' ',@args).": $?\n"; |
95
|
0
|
|
|
|
|
|
return 1; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub _all_from { |
100
|
0
|
|
|
0
|
|
|
my $self = shift; |
101
|
0
|
0
|
|
|
|
|
return unless $self->admin->{extensions}; |
102
|
0
|
|
|
|
|
|
my ($metadata) = grep { |
103
|
0
|
|
|
|
|
|
ref($_) eq 'Module::Install::Metadata'; |
104
|
0
|
|
|
|
|
|
} @{$self->admin->{extensions}}; |
105
|
0
|
0
|
|
|
|
|
return unless $metadata; |
106
|
0
|
|
0
|
|
|
|
return $metadata->{values}{all_from} || ''; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |
111
|
|
|
|
|
|
|
|