From: Tomas Doran Date: Thu, 26 Nov 2009 00:32:36 +0000 (+0000) Subject: And more overrideable X-Git-Tag: 0.25~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=07d7ec054e914c2687455ff823410104605689c1;p=gitmo%2FMooseX-Getopt.git And more overrideable --- diff --git a/ChangeLog b/ChangeLog index d039416..147de7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Revision history for Perl extension MooseX-Getopt * MooseX::Getopt - Split out the warnings and the exception from Getopt so that they can be overridden. + - Split out calling ->die on Getopt::Long::Descriptive::Usage so that + it can be overridden. 0.24 Fri. Oct 23 2009 * MooseX::Getopt diff --git a/lib/MooseX/Getopt.pm b/lib/MooseX/Getopt.pm index 5c72fcd..3e28e45 100644 --- a/lib/MooseX/Getopt.pm +++ b/lib/MooseX/Getopt.pm @@ -67,7 +67,7 @@ sub new_with_options { # did the user request usage information? if ( $processed{usage} && ($params->{'?'} or $params->{help} or $params->{usage}) ) { - $processed{usage}->die(); + $class->_getopt_full_usage($processed{usage}); } $class->new( @@ -128,6 +128,11 @@ sub _getopt_spec_exception { die @$warnings, $exception; } +sub _getopt_full_usage { + my ($self, $usage) = @_; + $usage->die; +} + sub _usage_format { return "usage: %c %o"; }