From: Karen Etheridge Date: Sat, 5 Jan 2013 11:42:27 +0000 (-0800) Subject: work with MooseX::Getopt 0.48 by using the new public method for printing usage X-Git-Tag: 5.90020~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=8ba2999969105bb9079e0c42473d88e4b73e079a work with MooseX::Getopt 0.48 by using the new public method for printing usage This reverts commit f831720babc4818823ec8628dcc1bd032ed8220c, which reverted commit cd61f3ab24b7dcc59068c35d62ddb4bb9b9162c8, but with version dependency added and pod coverage fixed. --- diff --git a/Makefile.PL b/Makefile.PL index 58f73ea..8e6c2c9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -63,7 +63,7 @@ requires 'URI' => '1.35'; requires 'Task::Weaken'; requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness requires 'MRO::Compat'; -requires 'MooseX::Getopt' => '0.30'; +requires 'MooseX::Getopt' => '0.48'; requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace requires 'Plack' => '0.9991'; # IIS6+7 fix middleware requires 'Plack::Middleware::ReverseProxy' => '0.04'; diff --git a/lib/Catalyst/Script/Create.pm b/lib/Catalyst/Script/Create.pm index 1308acd..593323d 100644 --- a/lib/Catalyst/Script/Create.pm +++ b/lib/Catalyst/Script/Create.pm @@ -39,13 +39,13 @@ sub _build_helper_class { 'Catalyst::Helper' } sub run { my ($self) = @_; - $self->_getopt_full_usage if !$self->ARGV->[0]; + $self->print_usage_text if !$self->ARGV->[0]; my $helper_class = $self->helper_class; Class::MOP::load_class($helper_class); my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } ); - $self->_getopt_full_usage unless $helper->mk_component( $self->application_name, @{$self->extra_argv} ); + $self->print_usage_text unless $helper->mk_component( $self->application_name, @{$self->extra_argv} ); } diff --git a/lib/Catalyst/ScriptRole.pm b/lib/Catalyst/ScriptRole.pm index b1ddc27..2b46097 100644 --- a/lib/Catalyst/ScriptRole.pm +++ b/lib/Catalyst/ScriptRole.pm @@ -14,10 +14,11 @@ coerce 'Catalyst::ScriptRole::LoadableClass', via { ensure_class_loaded($_); 1 }; with 'MooseX::Getopt' => { + -version => 0.48, -excludes => [qw/ _getopt_spec_warnings _getopt_spec_exception - _getopt_full_usage + print_usage_text /], }; @@ -56,7 +57,10 @@ sub _getopt_spec_warnings { warn @_; } -sub _getopt_full_usage { +=for Pod::Coverage + print_usage_text +=cut +sub print_usage_text { my $self = shift; pod2usage(); exit 0; diff --git a/t/aggregate/unit_core_script_create.t b/t/aggregate/unit_core_script_create.t index 68e2458..d492fd9 100644 --- a/t/aggregate/unit_core_script_create.t +++ b/t/aggregate/unit_core_script_create.t @@ -12,7 +12,7 @@ use lib "$Bin/../lib"; use Moose; extends 'Catalyst::Script::Create'; our $help; - sub _getopt_full_usage { $help++ } + sub print_usage_text { $help++ } } { diff --git a/t/aggregate/unit_core_script_help.t b/t/aggregate/unit_core_script_help.t index d3a6fab..00d24da 100644 --- a/t/aggregate/unit_core_script_help.t +++ b/t/aggregate/unit_core_script_help.t @@ -12,7 +12,7 @@ use lib "$Bin/../lib"; use Moose; with 'Catalyst::ScriptRole'; our $help; - sub _getopt_full_usage { $help++ } + sub print_usage_text { $help++ } } test('--help');