Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use the result method in the get command too
  • Loading branch information
kraih committed Jan 29, 2017
1 parent eea826a commit 10ca377
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/Mojolicious/Command/get.pm
Expand Up @@ -63,16 +63,14 @@ sub run {
$verbose = 1 if $method eq 'HEAD';
STDOUT->autoflush(1);
my $tx = $ua->start($ua->build_tx($method, $url, \%headers, $content));
my $err = $tx->error;
warn qq{Problem loading URL "@{[$tx->req->url]}": $err->{message}\n}
if $err && !$err->{code};
my $res = $tx->result;

# JSON Pointer
return unless defined $selector;
return _json($buffer, $selector) if !length $selector || $selector =~ m!^/!;

# Selector
$charset //= $tx->res->content->charset || $tx->res->default_charset;
$charset //= $res->content->charset || $res->default_charset;
_select($buffer, $selector, $charset, @args);
}

Expand Down

0 comments on commit 10ca377

Please sign in to comment.