X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2FApp%2FCodeowners%2FOptions.pm;h=154b09894fd92a793f10654d977575b11221d09a;hb=1c893b7e095fdaffdf47ffee426407a1f7e305fb;hp=7b43b75cc5e5d0272af568bbaea4979cbfb4755c;hpb=3c7ed3d762399efb2d01121392f7115104095788;p=chaz%2Fgit-codeowners diff --git a/lib/App/Codeowners/Options.pm b/lib/App/Codeowners/Options.pm index 7b43b75..154b098 100644 --- a/lib/App/Codeowners/Options.pm +++ b/lib/App/Codeowners/Options.pm @@ -1,15 +1,37 @@ package App::Codeowners::Options; # ABSTRACT: Getopt and shell completion for App::Codeowners +use v5.10.1; use warnings; use strict; +use Encode qw(decode); 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) @@ -61,6 +83,9 @@ sub new { my $class = shift; my @args = @_; + # assume UTF-8 args if non-ASCII + @args = map { decode('UTF-8', $_) } @args if grep { /\P{ASCII}/ } @args; + my $self = bless {}, $class; my @args_copy = @args;