Skip to content

Commit dcc718c

Browse files
cowenswchristian
authored andcommitted
make Makefile.PL write README and README.md
If the necessary modules are present, create README and README.md from the POD.
1 parent 2c2a7d6 commit dcc718c

File tree

2 files changed

+810
-4
lines changed

2 files changed

+810
-4
lines changed

Makefile.PL

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@ use warnings;
33

44
use inc::Module::Install 1.10;
55

6-
# only needed by author to run 'perl Makefile.PL'
7-
# use Module::Install::ReadmeFromPod 0.22;
8-
96
all_from 'lib/PPI.pm';
10-
readme_from 'lib/PPI.pm'; # Module::Install::ReadmeFromPod
7+
8+
# This code is only needed by author to generate README and README.md
9+
eval {
10+
eval "use Module::Install::ReadmeFromPod 0.22";
11+
eval "use Pod::Markdown 2.002";
12+
13+
my $pod = 'lib/PPI.pm';
14+
readme_from $pod; # Module::Install::ReadmeFromPod
15+
16+
my $parser = Pod::Markdown->new;
17+
open my $in, "<", $pod;
18+
open my $out, ">", "README.md";
19+
if ($parser and $in and $out) {
20+
$parser->parse_from_filehandle($in);
21+
print $out $parser->as_markdown;
22+
}
23+
};
1124

1225
requires 'Clone' => '0.30';
1326
requires 'File::Spec' => win32() ? '3.2701' : '0.84';

0 commit comments

Comments
 (0)