Skip to content

Commit

Permalink
use tap in version command too
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 22, 2014
1 parent af22682 commit 29ecbc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

5.44 2014-09-22
5.44 2014-09-23
- Fixed bug in Mojolicious::Renderer that prevented proxy objects from being
reused.

Expand Down
5 changes: 2 additions & 3 deletions lib/Mojolicious/Command/cgi.pm
Expand Up @@ -9,9 +9,8 @@ has usage => sub { shift->extract_usage };

sub run {
my ($self, @args) = @_;
my $cgi = Mojo::Server::CGI->new(app => $self->app);
GetOptionsFromArray \@args, nph => sub { $cgi->nph(1) };
$cgi->run;
GetOptionsFromArray \@args, nph => \(my $nph = 0);
Mojo::Server::CGI->new(app => $self->app, nph => $nph)->run;
}

1;
Expand Down
8 changes: 3 additions & 5 deletions lib/Mojolicious/Command/version.pm
Expand Up @@ -32,12 +32,10 @@ EOF

# Check latest version on CPAN
my $latest = eval {
my $ua = Mojo::UserAgent->new(max_redirects => 10);
$ua->proxy->detect;
$ua->get('api.metacpan.org/v0/release/Mojolicious')->res->json->{version};
};
Mojo::UserAgent->new(max_redirects => 10)->tap(sub { $_->proxy->detect })
->get('api.metacpan.org/v0/release/Mojolicious')->res->json->{version};
} or return;

return unless $latest;
my $msg = 'This version is up to date, have fun!';
$msg = 'Thanks for testing a development release, you are awesome!'
if $latest < $Mojolicious::VERSION;
Expand Down

0 comments on commit 29ecbc0

Please sign in to comment.