Skip to content

Commit

Permalink
do not search the obsolete Mojo::Command namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 21, 2012
1 parent 58f5555 commit 16e2636
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
3 changes: 1 addition & 2 deletions lib/Mojolicious/Command/eval.pm
Expand Up @@ -32,8 +32,7 @@ sub run {
no warnings;
my $result = eval "package main; sub app { \$app }; $code";
say $result if $verbose && defined $result;
die $@ if $@;
return $result;
return $@ ? die($@) : $result;
}

1;
Expand Down
7 changes: 3 additions & 4 deletions lib/Mojolicious/Command/generate.pm
Expand Up @@ -12,8 +12,7 @@ usage: $0 generate GENERATOR [OPTIONS]
These generators are currently available:
EOF
has namespaces =>
sub { [qw(Mojolicious::Command::generate Mojo::Command::generate)] };
has namespaces => sub { ['Mojolicious::Command::generate'] };
has usage => "usage: $0 generate GENERATOR [OPTIONS]\n";

sub help { shift->run(@_) }
Expand Down Expand Up @@ -64,10 +63,10 @@ Short usage message shown before listing available generator commands.
=head2 C<namespaces>
my $namespaces = $generator->namespaces;
$generator = $generator->namespaces(['Mojo::Command::generate']);
$generator = $generator->namespaces(['MyApp::Command::generate']);
Namespaces to search for available generator commands, defaults to
L<Mojolicious::Command::generate> and L<Mojo::Command::generate>.
L<Mojolicious::Command::generate>.
=head1 METHODS
Expand Down
18 changes: 9 additions & 9 deletions lib/Mojolicious/Command/get.pm
Expand Up @@ -87,9 +87,9 @@ sub run {
my $tx = pop;

# Prepare request information
my $req = $tx->req;
my $startline = $req->build_start_line;
my $headers = $req->build_headers;
my $req = $tx->req;
my $startline = $req->build_start_line;
my $req_headers = $req->build_headers;

# Verbose callback
my $v = $verbose;
Expand All @@ -100,14 +100,14 @@ sub run {
return unless $v && $res->headers->is_finished;

# Request
warn "$startline$headers";
warn "$startline$req_headers";

# Response
my $version = $res->version;
my $code = $res->code;
my $message = $res->message;
warn "HTTP/$version $code $message\n", $res->headers->to_string,
"\n\n";
my $version = $res->version;
my $code = $res->code;
my $message = $res->message;
my $res_headers = $res->headers->to_string;
warn "HTTP/$version $code $message\n$res_headers\n\n";

# Finished
$v = 0;
Expand Down
7 changes: 3 additions & 4 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -26,7 +26,7 @@ Tip: CGI and PSGI environments can be automatically detected very often and
These commands are currently available:
EOF
has namespaces => sub { [qw(Mojolicious::Command Mojo::Command)] };
has namespaces => sub { ['Mojolicious::Command'] };

sub detect {
my ($self, $guess) = @_;
Expand Down Expand Up @@ -293,10 +293,9 @@ Short usage message shown before listing available commands.
=head2 C<namespaces>
my $namespaces = $commands->namespaces;
$commands = $commands->namespaces(['Mojolicious::Commands']);
$commands = $commands->namespaces(['MyApp::Command']);
Namespaces to load commands from, defaults to C<Mojolicious::Command> and
C<Mojo::Command>.
Namespaces to load commands from, defaults to C<Mojolicious::Command>.
# Add another namespace to load commands from
push @{$commands->namespaces}, 'MyApp::Command';
Expand Down

0 comments on commit 16e2636

Please sign in to comment.