diff --git a/lib/App/Cmd/Command/commands.pm b/lib/App/Cmd/Command/commands.pm index 9b6fa9e..a7b5835 100644 --- a/lib/App/Cmd/Command/commands.pm +++ b/lib/App/Cmd/Command/commands.pm @@ -29,9 +29,6 @@ sub execute { my $target = $opt->stderr ? *STDERR : *STDOUT; - local $@; - eval { print { $target } $self->app->_usage_text . "\n" }; - print { $target } "Available commands:\n\n"; my @primary_commands = diff --git a/lib/App/Cmd/Command/help.pm b/lib/App/Cmd/Command/help.pm index f17c191..6740507 100644 --- a/lib/App/Cmd/Command/help.pm +++ b/lib/App/Cmd/Command/help.pm @@ -86,21 +86,7 @@ sub execute { my ($self, $opts, $args) = @_; if (!@$args) { - my $usage = $self->app->usage->text; - my $command = $0; - - # chars normally used to describe options - my $opt_descriptor_chars = qr/[\[\]<>\(\)]/; - - if ($usage =~ /^(.+?) \s* (?: $opt_descriptor_chars | $ )/x) { - # try to match subdispatchers too - $command = $1; - } - - # evil hack ;-) - bless - $self->app->{usage} = sub { return "$command help \n" } - => "Getopt::Long::Descriptive::Usage"; + print $self->app->usage->text . "\n"; $self->app->execute_command( $self->app->_prepare_command("commands") ); } else {