Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

->modules query prematurely flattens to scalar #43

Closed
kentfredric opened this issue Aug 3, 2016 · 2 comments
Closed

->modules query prematurely flattens to scalar #43

kentfredric opened this issue Aug 3, 2016 · 2 comments
Assignees

Comments

@kentfredric
Copy link
Contributor

The following code worked prior to the ES upgrade.

#!perl
use strict;
use warnings;

use MetaCPAN::Client;

my $name   = 'AcePerl-1.92';
my $author = 'LDS';
my $client = MetaCPAN::Client->new();

my $iterator = $client->module(
  {
    all => [
      { release    => $name },                          #
      { author     => $author },
      { authorized => 1 },
      { indexed    => 1 },                              #
      { mime       => 'text/x-script.perl-module' },    #
    ]
  }
);

while ( my $result = $iterator->next ) {
  next unless $result->module;
  for my $module (@{ $result->module }) {
    printf "%s\n", $module->{name};
  }
}

On 1.020000 this specific logic works as expected.
On 1.021000, it gets confused at some point and bails quite early as $result->module no longer returns an arrayref.

kentfredric added a commit to kentnl/Gentoo-Util-VirtualDepend that referenced this issue Aug 3, 2016
@mickeyn
Copy link
Contributor

mickeyn commented Aug 3, 2016

Fixed in https://v1.metacpan.org/release/MICKEY/MetaCPAN-Client-1.022000-TRIAL

also, I'd recommend this small change to the code:

my $client = MetaCPAN::Client->new( version => "v1" );

Please check the trial version and I'll try to release it by the end of the weekend.

@kentfredric
Copy link
Contributor Author

Works for me :) ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants