Skip to content

Commit

Permalink
fixed bug in Mojolicious::Commands where the global Getopt::Long conf…
Browse files Browse the repository at this point in the history
…iguration would be changed after a command had already been loaded
  • Loading branch information
kraih committed Nov 22, 2014
1 parent ff8bd16 commit eb3d8ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,5 +1,7 @@

5.64 2014-11-22
- Fixed bug in Mojolicious::Commands where the global Getopt::Long
configuration would be changed after a command had already been loaded.

5.63 2014-11-21
- Improved portability of some tests.
Expand Down
5 changes: 3 additions & 2 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -54,15 +54,16 @@ sub run {
$name = shift @args if my $help = $name eq 'help';
$help = $ENV{MOJO_HELP} = $ENV{MOJO_HELP} ? 1 : $help;

# Remove options shared by all commands before loading the command
_args(\@args);
my $module;
$module = _command("${_}::$name", 1) and last for @{$self->namespaces};

# Unknown command
die qq{Unknown command "$name", maybe you need to install it?\n}
unless $module;

# Run command (remove options shared by all commands)
_args(\@args);
# Run command
my $command = $module->new(app => $self->app);
return $help ? $command->help(@args) : $command->run(@args);
}
Expand Down

0 comments on commit eb3d8ab

Please sign in to comment.