line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::Pluggable::ReadmeMarkdownFromPod; |
2
|
4
|
|
|
4
|
|
39554
|
use strict; |
|
4
|
|
|
|
|
19
|
|
|
4
|
|
|
|
|
233
|
|
3
|
4
|
|
|
4
|
|
29
|
use warnings; |
|
4
|
|
|
|
|
17
|
|
|
4
|
|
|
|
|
185
|
|
4
|
4
|
|
|
4
|
|
107
|
use 5.010001; |
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
290
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
900
|
use parent qw/Module::Build::Pluggable::Base/; |
|
4
|
|
|
|
|
338
|
|
|
4
|
|
|
|
|
150
|
|
8
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
9
|
4
|
|
|
|
|
26
|
ro => [qw/filename clean/], |
10
|
4
|
|
|
4
|
|
35686
|
); |
|
4
|
|
|
|
|
241
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub HOOK_configure { |
13
|
1
|
|
|
1
|
0
|
91359
|
my ($self) = @_; |
14
|
1
|
|
|
|
|
32
|
$self->build_requires('Pod::Markdown' => 0); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub HOOK_build { |
18
|
2
|
|
|
2
|
0
|
97
|
my ($self) = @_; |
19
|
2
|
|
|
|
|
3248
|
require Pod::Markdown; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
33
|
|
|
100145
|
my $src = $self->filename || $self->builder->dist_version_from; |
22
|
2
|
50
|
|
|
|
323
|
unless ($src) { |
23
|
0
|
|
|
|
|
0
|
die "Missing filename for ReadmeMarkdownFromPod"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
24
|
$self->log_info("Writing README.mkdn\n"); |
27
|
|
|
|
|
|
|
|
28
|
2
|
100
|
|
|
|
805
|
if (-f 'README.mkdn') { |
29
|
1
|
|
|
|
|
17
|
my $perm = (stat 'README.mkdn')[2] & oct('7777'); |
30
|
1
|
|
|
|
|
49
|
chmod($perm | oct('600'), 'README.mkdn'); |
31
|
1
|
|
|
|
|
4
|
_write_file($src); |
32
|
1
|
|
|
|
|
46
|
chmod($perm, 'README.mkdn'); # restore permission |
33
|
|
|
|
|
|
|
} else { |
34
|
1
|
|
|
|
|
5
|
_write_file($src); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
2
|
50
|
|
|
|
12
|
if ($self->clean) { |
38
|
0
|
|
|
|
|
0
|
$self->add_to_cleanup('README.mkdn'); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _write_file { |
43
|
2
|
|
|
2
|
|
5
|
my ($src) = @_; |
44
|
2
|
|
|
|
|
21
|
my $parser = Pod::Markdown->new(); |
45
|
2
|
|
|
|
|
694
|
$parser->parse_from_file($src); |
46
|
2
|
50
|
|
|
|
6821
|
open my $fh, '>', 'README.mkdn' or die "Cannot open README.mkdn: $!\n"; |
47
|
2
|
|
|
|
|
6
|
print {$fh} $parser->as_markdown; |
|
2
|
|
|
|
|
15
|
|
48
|
2
|
|
|
|
|
245
|
close $fh; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |