From: Yuval Kogman Date: Tue, 22 Jan 2008 13:52:52 +0000 (+0000) Subject: remove the FakeUsage thing, not needed after all X-Git-Tag: 0_09~1^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3cc60720e3d5ebb69597dca707763a661ccca1ea;p=gitmo%2FMooseX-Getopt.git remove the FakeUsage thing, not needed after all --- diff --git a/lib/MooseX/Getopt.pm b/lib/MooseX/Getopt.pm index 19bebe5..cb0d141 100644 --- a/lib/MooseX/Getopt.pm +++ b/lib/MooseX/Getopt.pm @@ -62,7 +62,7 @@ sub _parse_argv { } else { my %options; Getopt::Long::GetOptions(\%options, @$opt_spec); - return ( \%options, MooseX::Getopt::FakeUsage->new(%params) ); + return ( \%options, undef ); } }; @@ -81,7 +81,7 @@ sub _parse_argv { params => \%constructor_args, argv_copy => $argv_copy, argv => $argv_mangled, - usage => $usage + ( defined($usage) ? ( usage => $usage ) : () ), ); } @@ -173,39 +173,6 @@ sub _attrs_to_options { return @options; } -{ - package MooseX::Getopt::FakeUsage; - use Moose; - # fakes Getopt::Long::Descriptive::Usage - - has text => ( - isa => "Str", - is => "rw", - default => "In order to get a usage text please install Getopt::Long::Descriptive\n", - ); - - sub warn { - my $self = shift; - warn $self->text; - } - - sub die { - my $self = shift; - my $arg = shift || {}; - - die( - join( - "", - grep { defined } $arg->{pre_text}, $self->text, $arg->{post_text}, - ) - ); - } - - use overload ( - q{""} => "text", - ); -} - no Moose::Role; 1; __END__