Skip to content

Commit

Permalink
restydoc: pod2man from older perl versions (like 5.8) does not suppor…
Browse files Browse the repository at this point in the history
…t -u option. we should be smarter here.
  • Loading branch information
agentzh committed Jul 13, 2016
1 parent ea78830 commit 933ec17
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/restydoc
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,9 @@ sub process_section_hit {
}

my $groff_cmd = get_groff_cmd();
my $cmd = "pod2man -u -c '$full_dist_name' "
my $pod2man_cmd = get_pod2man_cmd();

my $cmd = "$pod2man_cmd -c '$full_dist_name' "
. " -r OpenResty -s 7 -n '$module_name' "
. "$tmpfile | $groff_cmd | $pager";
#warn $cmd;
Expand Down Expand Up @@ -552,7 +554,9 @@ sub process_module_hit {
}

my $groff_cmd = get_groff_cmd();
exec("pod2man -u -c '$full_dist_name' "
my $pod2man_cmd = get_pod2man_cmd();

exec("$pod2man_cmd -c '$full_dist_name' "
. "-r OpenResty -s 7 -n '$name' "
. "$podfile | $groff_cmd | $pager");
}
Expand All @@ -565,6 +569,14 @@ sub get_groff_cmd {
return "groff -Tascii -mandoc -Wbreak";
}

sub get_pod2man_cmd {
my $help = `pod2man --help`;
if ($help =~ /^ \s+ -u \b/xm) {
return "pod2man -u";
}
return "pod2man";
}

sub shell {
my $cmd = shift;

Expand Down

0 comments on commit 933ec17

Please sign in to comment.