From 7a8d20f6ee8bc57767927755d0a10a8788261bfd Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 5 Mar 2021 05:21:19 -0700 Subject: [PATCH] help: make sure help shows with nice formatting Starting with Perl 5.28.0, the default output when using Pod::Usage with a verbose level >= 2 has been made plain, ugly, no formatting whatsoever. Compensate for this documentation travesty by setting the PERLDOC environment variable, if it's not already set, to restore the previous behavior. Additionally, add the necessary changes so that the brief help shown for '-h' will use terminal formatting codes to show bold, underline, etc., if available, to avoid the very ugly plain text mess that would otherwise appear. Signed-off-by: Kyle J. McKay --- jobd/jobd.pl | 6 ++++++ taskd/taskd.pl | 6 ++++++ toolbox/perlcpio.pl | 2 ++ toolbox/perlcrc32.pl | 2 ++ toolbox/show-pack-counts.pl | 6 ++++++ toolbox/update-all-config.pl | 6 ++++++ 6 files changed, 28 insertions(+) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index 77a51b3..4c4756b 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -9,6 +9,12 @@ use warnings; use Getopt::Long; use Pod::Usage; +BEGIN { + eval 'require Pod::Text::Termcap; 1;' and + @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; +} use POSIX ":sys_wait_h"; use Cwd qw(realpath); diff --git a/taskd/taskd.pl b/taskd/taskd.pl index 61687a3..50be39d 100755 --- a/taskd/taskd.pl +++ b/taskd/taskd.pl @@ -33,6 +33,12 @@ use warnings; use Getopt::Long; use Pod::Usage; +BEGIN { + eval 'require Pod::Text::Termcap; 1;' and + @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; +} use Socket; use Errno; use Fcntl; diff --git a/toolbox/perlcpio.pl b/toolbox/perlcpio.pl index c1bd281..dafe84f 100755 --- a/toolbox/perlcpio.pl +++ b/toolbox/perlcpio.pl @@ -29,6 +29,8 @@ use Pod::Usage; BEGIN { eval 'require Pod::Text::Termcap; 1;' and @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; } my $hascrc32; BEGIN { $hascrc32 = eval 'use Compress::Zlib qw(crc32); 1;' } diff --git a/toolbox/perlcrc32.pl b/toolbox/perlcrc32.pl index e4d6a5b..f124731 100755 --- a/toolbox/perlcrc32.pl +++ b/toolbox/perlcrc32.pl @@ -30,6 +30,8 @@ use Pod::Usage; BEGIN { eval 'require Pod::Text::Termcap; 1;' and @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; } my $me = basename($0); close(DATA) if fileno(DATA); diff --git a/toolbox/show-pack-counts.pl b/toolbox/show-pack-counts.pl index 2f2a58f..6f1f5bd 100755 --- a/toolbox/show-pack-counts.pl +++ b/toolbox/show-pack-counts.pl @@ -11,6 +11,12 @@ BEGIN {*VERSION = \'2.0'} use File::Basename; use Getopt::Long; use Pod::Usage; +BEGIN { + eval 'require Pod::Text::Termcap; 1;' and + @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; +} use lib "__BASEDIR__"; use Girocco::Config; use Girocco::Project; diff --git a/toolbox/update-all-config.pl b/toolbox/update-all-config.pl index 484f716..15356cd 100755 --- a/toolbox/update-all-config.pl +++ b/toolbox/update-all-config.pl @@ -12,6 +12,12 @@ use Cwd qw(realpath); use POSIX qw(); use Getopt::Long; use Pod::Usage; +BEGIN { + eval 'require Pod::Text::Termcap; 1;' and + @Pod::Usage::ISA = (qw( Pod::Text::Termcap )); + defined($ENV{PERLDOC}) && $ENV{PERLDOC} ne "" or + $ENV{PERLDOC} = "-oterm -oman"; +} use lib "__BASEDIR__"; use Girocco::Config; use Girocco::Util; -- 2.11.4.GIT