From b0c68e542b342b93b6f316562d3d586e9a0666cd Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Thu, 14 Nov 2019 22:25:36 -0700 Subject: [PATCH] make Pod::Usage optional --- dist.ini | 4 +++- lib/App/Codeowners/Options.pm | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dist.ini b/dist.ini index 3574581..8a066de 100644 --- a/dist.ini +++ b/dist.ini @@ -20,13 +20,15 @@ run = %x maint%pbranch_solo.pl %v %d [RemovePhasedPrereqs] remove_runtime = JSON::MaybeXS +remove_runtime = Pod::Usage remove_runtime = Text::CSV remove_runtime = Text::Table::Any remove_runtime = Unicode::GCString remove_runtime = YAML [Prereqs / RuntimeRecommends] -Unicode::GCString = 0 +Pod::Usage = 0 Term::Detect::Software = 0 +Unicode::GCString = 0 [Prereqs / RuntimeSuggests] JSON::MaybeXS = 0 Text::CSV = 0 diff --git a/lib/App/Codeowners/Options.pm b/lib/App/Codeowners/Options.pm index 7b43b75..3c1eb1d 100644 --- a/lib/App/Codeowners/Options.pm +++ b/lib/App/Codeowners/Options.pm @@ -1,15 +1,36 @@ package App::Codeowners::Options; # ABSTRACT: Getopt and shell completion for App::Codeowners +use v5.10.1; use warnings; use strict; use Getopt::Long 2.39 (); use Path::Tiny; -use Pod::Usage; our $VERSION = '9999.999'; # VERSION +sub pod2usage { + eval { require Pod::Usage }; + if ($@) { + my $ref = $VERSION eq '9999.999' ? 'master' : "v$VERSION"; + my $exit = (@_ == 1 && $_[0] =~ /^\d+$/ && $_[0]) // + (@_ % 2 == 0 && {@_}->{'-exitval'}) // 2; + print STDERR < (-t STDOUT ? 1 : 0), ## no critic (InputOutput::ProhibitInteractiveTest) -- 2.43.0