Skip to content

Commit

Permalink
fixed warning with missing fields param
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Nov 30, 2015
1 parent 65d3b5b commit 070ef32
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/MetaCPAN/Client.pm
Expand Up @@ -177,7 +177,7 @@ sub _get {
my $fields_filter = $self->_read_fields( $params );

my $response = $self->fetch(
sprintf("%s/%s%s", $type ,$arg, $fields_filter)
sprintf("%s/%s%s", $type ,$arg, $fields_filter||'')
);
ref $response eq 'HASH'
or croak sprintf( 'Failed to fetch %s (%s)', ucfirst($type), $arg );
Expand All @@ -189,9 +189,10 @@ sub _get {
sub _read_fields {
my $self = shift;
my $params = shift;
$params or return '';
$params or return;

my $fields = delete $params->{fields};
$fields or return;

if ( ref $fields eq 'ARRAY' ) {
grep { ref $_ } @$fields
Expand Down

0 comments on commit 070ef32

Please sign in to comment.