Permalink
Browse files

Fix issue with 'use Getopt::Long 2.36'

  • Loading branch information...
1 parent f61d1b3 commit c59eae21f7d11b0e76778b757c770575c9e633f1 @hoelzro hoelzro committed Dec 5, 2012
Showing with 13 additions and 30 deletions.
  1. +3 −7 Ack.pm
  2. +7 −10 ConfigLoader.pm
  3. +3 −13 ack
View
10 Ack.pm
@@ -5,11 +5,7 @@ use strict;
use App::Ack::ConfigDefault;
use App::Ack::ConfigFinder;
-use Getopt::Long ();
-BEGIN {
- # see ack for explanation
- UNIVERSAL::VERSION('Getopt::Long', '2.36');
-}
+use Getopt::Long 2.36 ();
use File::Next 1.10;
=head1 NAME
@@ -81,7 +77,7 @@ sub retrieve_arg_sources {
my $noenv;
my $ackrc;
- Getopt::Long::Configure('default');
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version');
Getopt::Long::Configure('pass_through');
Getopt::Long::Configure('no_auto_abbrev');
@@ -90,7 +86,7 @@ sub retrieve_arg_sources {
'ackrc=s' => \$ackrc,
);
- Getopt::Long::Configure('default');
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version');
my @files;
View
@@ -7,11 +7,7 @@ use App::Ack ();
use App::Ack::Filter;
use App::Ack::Filter::Default;
use Carp 1.22 ();
-use Getopt::Long ();
-BEGIN {
- # see ack for explanation
- UNIVERSAL::VERSION('Getopt::Long', '2.36');
-}
+use Getopt::Long 2.36 ();
use Text::ParseWords 3.1 ();
=head1 App::Ack::ConfigLoader
@@ -51,7 +47,7 @@ sub process_filter_spec {
sub process_filetypes {
my ( $opt, $arg_sources ) = @_;
- Getopt::Long::Configure('default'); # start with default options
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version'); # start with default options, minus some annoying ones
Getopt::Long::Configure(
'no_ignore_case',
'no_auto_abbrev',
@@ -287,7 +283,7 @@ EOT
sub process_other {
my ( $opt, $extra_specs, $arg_sources ) = @_;
- Getopt::Long::Configure('default'); # start with default options
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version'); # start with default options, minus some annoying ones
Getopt::Long::Configure(
'bundling',
'no_ignore_case',
@@ -353,7 +349,7 @@ sub should_dump_options {
my ( $name, $options ) = @{$sources}[$i, $i + 1];
if($name eq 'ARGV') {
my $dump;
- Getopt::Long::Configure('default', 'pass_through');
+ Getopt::Long::Configure('default', 'pass_through', 'no_auto_help', 'no_auto_version');
Getopt::Long::GetOptionsFromArray($options,
'dump' => \$dump,
);
@@ -368,7 +364,7 @@ sub explode_sources {
my @new_sources;
- Getopt::Long::Configure('default', 'pass_through');
+ Getopt::Long::Configure('default', 'pass_through', 'no_auto_help', 'no_auto_version');
my %opt;
my $arg_spec = get_arg_spec(\%opt);
@@ -475,7 +471,7 @@ sub remove_default_options_if_needed {
my $should_remove = 0;
- Getopt::Long::Configure('default'); # start with default options
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version'); # start with default options, minus some annoying ones
Getopt::Long::Configure(
'no_ignore_case',
'no_auto_abbrev',
@@ -499,6 +495,7 @@ sub remove_default_options_if_needed {
}
Getopt::Long::Configure('default');
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version');
return $sources unless $should_remove;
View
16 ack
@@ -19,17 +19,7 @@ use App::Ack::Filter::Inverse;
use App::Ack::Filter::Is;
use App::Ack::Filter::Match;
-use Getopt::Long ();
-=for Explanation
- Getopt::Long stores the requested version and uses it to
- generate --help and --version handlers if requested. Interestingly
- enough, we don't request them, but we get a fun error message from
- Getopt::Long anyway. This BEGIN block (and others like it) gets
- around the issue, but we should probably fix it for real some day.
-=cut
-BEGIN {
- UNIVERSAL::VERSION('Getopt::Long', '2.36');
-}
+use Getopt::Long 2.36 ();
use Carp 1.22 ();
@@ -65,14 +55,14 @@ MAIN: {
}
App::Ack::load_colors();
- Getopt::Long::Configure('defaults');
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version');
Getopt::Long::Configure('pass_through', 'no_auto_abbrev');
Getopt::Long::GetOptions(
'help' => sub { App::Ack::show_help(); exit; },
'version' => sub { App::Ack::print_version_statement(); exit; },
'man' => sub { App::Ack::show_man(); exit; },
);
- Getopt::Long::Configure('defaults');
+ Getopt::Long::Configure('default', 'no_auto_help', 'no_auto_version');
if ( !@ARGV ) {
App::Ack::show_help();

0 comments on commit c59eae2

Please sign in to comment.