Code Monkey home page Code Monkey logo

metacpan-client's Introduction

NAME

MetaCPAN::Client - A comprehensive, DWIM-featured client to the MetaCPAN API

VERSION

version 2.031001

SYNOPSIS

# simple usage
my $mcpan  = MetaCPAN::Client->new();
my $author = $mcpan->author('XSAWYERX');
my $dist   = $mcpan->distribution('MetaCPAN-Client');

# advanced usage with cache (contributed by Kent Fredric)
use CHI;
use WWW::Mechanize::Cached;
use HTTP::Tiny::Mech;
use MetaCPAN::Client;

my $mcpan = MetaCPAN::Client->new(
  ua => HTTP::Tiny::Mech->new(
    mechua => WWW::Mechanize::Cached->new(
      cache => CHI->new(
        driver   => 'File',
        root_dir => '/tmp/metacpan-cache',
      ),
    ),
  ),
);

# now $mcpan caches results

DESCRIPTION

This is a hopefully-complete API-compliant client to MetaCPAN (https://metacpan.org) with DWIM capabilities, to make your life easier.

ATTRIBUTES

request

Internal attribute representing the request object making the request to MetaCPAN and analyzing the results. You probably don't want to set this, nor should you have any usage of it.

ua

If provided, MetaCPAN::Client::Request will use the user agent object instead of the default, which is HTTP::Tiny.

Then it can be used to fetch the user agent object used by MetaCPAN::Client::Request.

domain

If given, will be used to alter the API domain.

debug

If given, errors will include some low-level detailed message.

METHODS

author

my $author = $mcpan->author('XSAWYERX');
my $author = $mcpan->author($search_spec);

Finds an author by either its PAUSE ID or by a search spec defined by a hash reference. Since it is common to many other searches, it is explained below under SEARCH SPEC.

Returns a MetaCPAN::Client::Author object on a simple search (PAUSE ID), or a MetaCPAN::Client::ResultSet object populated with MetaCPAN::Client::Author objects on a complex (search spec based) search.

cover

my $cover = $mcpan->cover('Moose-2.2007');

Returns a MetaCPAN::Client::Cover object.

distribution

my $dist = $mcpan->distribution('MetaCPAN-Client');
my $dist = $mcpan->distribution($search_spec);

Finds a distribution by either its distribution name or by a search spec defined by a hash reference. Since it is common to many other searches, it is explained below under SEARCH SPEC.

Returns a MetaCPAN::Client::Distribution object on a simple search (distribution name), or a MetaCPAN::Client::ResultSet object populated with MetaCPAN::Client::Distribution objects on a complex (search spec based) search.

file

Returns a MetaCPAN::Client::File object.

favorite

my $favorite = $mcpan->favorite({ distribution => 'Moose' });

Returns a MetaCPAN::Client::ResultSet object containing MetaCPAN::Client::Favorite results.

rating

my $rating = $mcpan->rating({ distribution => 'Moose' });

Returns a MetaCPAN::Client::ResultSet object containing MetaCPAN::Client::Rating results.

release

my $release = $mcpan->release('MetaCPAN-Client');
my $release = $mcpan->release($search_spec);

Finds a release by either its distribution name or by a search spec defined by a hash reference. Since it is common to many other searches, it is explained below under SEARCH SPEC.

Returns a MetaCPAN::Client::Release object on a simple search (release name), or a MetaCPAN::Client::ResultSet object populated with MetaCPAN::Client::Release objects on a complex (search spec based) search.

mirror

my $mirror = $mcpan->mirror('kr.freebsd.org');

Returns a MetaCPAN::Client::Mirror object.

module

my $module = $mcpan->module('MetaCPAN::Client');
my $module = $mcpan->module($search_spec);

Finds a module by either its module name or by a search spec defined by a hash reference. Since it is common to many other searches, it is explained below under SEARCH SPEC.

Returns a MetaCPAN::Client::Module object on a simple search (module name), or a MetaCPAN::Client::ResultSet object populated with MetaCPAN::Client::Module objects on a complex (search spec based) search.

package

my $package = $mcpan->package('MooseX::Types');

Returns a MetaCPAN::Client::Package object.

permission

my $permission = $mcpan->permission('MooseX::Types');

Returns a MetaCPAN::Client::Permission object.

reverse_dependencies

my $deps = $mcpan->reverse_dependencies('Search::Elasticsearch');

all MetaCPAN::Client::Release objects of releases that are directly dependent on a given module, returned as MetaCPAN::Client::ResultSet.

rev_deps

Alias to reverse_dependencies described above.

autocomplete

my $ac = $mcpan->autocomplete('Danc');

Call the search/autocomplete endpoint with a query string.

Returns an array reference.

autocomplete_suggest

my $ac = $mcpan->autocomplete_suggest('Moo');

Call the search/autocomplete/suggest endpoint with a query string.

Returns an array reference.

recent

my $recent = $mcpan->recent(10);
my $recent = $mcpan->recent('today');

return the latest N releases, or all releases from today.

returns a MetaCPAN::Client::ResultSet of MetaCPAN::Client::Release.

pod

Get POD for given file/module name. returns a MetaCPAN::Client::Pod object, which supports various output formats (html, plain, x_pod & x_markdown).

my $pod = $mcpan->pod('Moo')->html;
my $pod = $mcpan->pod('Moo', { url_prefix => $prefix })->html;

download_url

Retrieve information from the 'download_url' endpoint

my $download_url = $mcpan->download_url($distro, [$version_or_range, $dev]);

# request the last available version
my $download_url = $mcpan->download_url('Moose');

# request an older version
my $download_url = $mcpan->download_url('Moose', '1.01');

# using a range
my $download_url = $mcpan->download_url('Moose', '<=1.01');
my $download_url = $mcpan->download_url('Moose', '>1.01,<=2.00');

Range operators are '== != <= >= < > !'. You can use a comma ',' to add multiple rules.

# requesting dev release
my $download_url = $mcpan->download_url('Moose', '>1.01', 1);

Returns a MetaCPAN::Client::DownloadURL object

all

Retrieve all matches for authors/modules/distributions/favorites or releases.

my $all_releases = $mcpan->all('releases')

When called with a second parameter containing a hash ref, will support the following keys:

fields

See SEARCH PARAMS.

my $all_releases = $mcpan->all('releases', { fields => [...] })

_source

See SEARCH PARAMS.

my $all_releases = $mcpan->all('releases', { _source => [...] })

es_filter

Pass a raw Elasticsearch filter structure to reduce the number of elements returned by the query.

my $some_releases = $mcpan->all('releases', { es_filter => {...} })

BUILDARGS

Internal construction wrapper. Do not use.

SEARCH PARAMS

Most searches take params as an optional hash-ref argument. these params will be passed to the search action.

In non-scrolled searches, 'fields' filter is the only supported parameter ATM.

fields

Filter the fields to reduce the amount of data pulled from MetaCPAN. can be passed as a csv list or an array ref.

my $module = $mcpan->module('Moose', { fields => "version,author" });
my $module = $mcpan->module('Moose', { fields => [qw/version author/] });

_source

Note: this param and its description are a bit too Elasticsearch specific. just like 'es_filter' - use only if you know what you're dealing with.

Some fields are not indexed in Elasticsearch but stored as part of the entire document.

These fields can still be read, but without the internal Elasticsearch optimizations and the server will internally read the whole document.

Why do we even need those? because we don't index everything and some things we can't to begin with (like non-leaf fields that hold a structure)

my $module = $mcpan->all('releases', { _source => "stat" });

scroller_time

Note: please use with caution.

This parameter will set the maximum lifetime of the Elasticsearch scroller on the server (default = '5m'). Normally you do not need to set this value (as tweaking this value can affect resources on the server). In case you do, you probably need to check the efficiency of your code/queries. (Feel free to reach out to us for assistance).

my $module = $mcpan->all('releases', { scroller_time => '3m' });

scroller_size

Note: please use with caution.

This parameter will set the buffer size to be pulled from Elasticsearch when scrolling (default = 1000). This will affect query performance and memory usage, but you will still get an iterator back to fetch one object at a time.

my $module = $mcpan->all('releases', { scroller_size => 500 });

sort

Pass a raw Elasticsearch sort specification for the query.

my $some_releases = $mcpan->all('releases', { sort => [{ date => { order => 'desc' } }] })

Note: this param and is a bit too specific to Elasticsearch. Just like "es_filter", only use this if you know what you're dealing with.

SEARCH SPEC

The hash-based search spec is common to many searches. It is quite feature-rich and allows you to disambiguate different types of searches.

Basic search specs just contain a hash of keys and values:

my $author = $mcpan->author( { name => 'Micha Nasriachi' } );

# the following is the same as ->author('MICKEY')
my $author = $mcpan->author( { pauseid => 'MICKEY' } );

# find all people named Dave, not covering Davids
# will return a resultset
my $daves = $mcpan->author( { name => 'Dave *' } );

OR

If you want to do a more complicated query that has an OR condition, such as "this or that", you can use the following syntax with the either key:

# any author named "Dave" or "David"
my $daves = $mcpan->author( {
    either => [
        { name => 'Dave *'  },
        { name => 'David *' },
    ]
} );

AND

If you want to do a more complicated query that has an AND condition, such as "this and that", you can use the following syntax with the all key:

# any users named 'John' with a Gmail account
my $johns = $mcpan->author( {
    all => [
        { name  => 'John *'     },
        { email => '*gmail.com' },
    ]
} );

Or, to get either the given version of a release, or the latest:

my $releases = $mcpan->release( {
    all => [
      { distribution => 'GraphViz2' },
      ($version ? { version => $version } : { status => 'latest' }),
    ],
} );

If you want to do something even more complicated, You can also nest your queries, e.g.:

my $gmail_daves_or_cpan_sams = $mcpan->author( {
    either => [
        { all => [ { name => 'Dave *'  },
                   { email => '*gmail.com' } ]
        },
        { all => [ { name => 'Sam *' },
                   { email => '*cpan.org' } ]
        },
    ],
} );

NOT

If you want to filter out some of the results of an either/all query adding a NOT filter condition, such as "not these", you can use the following syntax with the not key:

# any author named "Dave" or "David"
my $daves = $mcpan->author( {
    either => [
        { name => 'Dave *'  },
        { name => 'David *' },
    ],
    not => [
        { email => '*gmail.com' },
    ],
} );

DESIGN

This module has three purposes:

  • Provide 100% of the MetaCPAN API

    This module will be updated regularly on every MetaCPAN API change, and intends to provide the user with as much of the API as possible, no shortcuts. If it's documented in the API, you should be able to do it.

    Because of this design decision, this module has an official MetaCPAN namespace with the blessing of the MetaCPAN developers.

    Notice this module currently only provides the beta API, not the old soon-to-be-deprecated API.

  • Be lightweight, to allow flexible usage

    While many modules would help make writing easier, it's important to take into account how they affect your compile-time, run-time, overall memory consumption, and CPU usage.

    By providing a slim interface implementation, more users are able to use this module, such as long-running processes (like daemons), CLI or GUI applications, cron jobs, and more.

  • DWIM

    While it's possible to access the methods defined by the API spec, there's still a matter of what you're really trying to achieve. For example, when searching for "Dave", you want to find both Dave Cross and Dave Rolsky (and any other Dave), but you also want to search for a PAUSE ID of DAVE, if one exists.

    This is where DWIM comes in. This module provides you with additional generic methods which will try to do what they think you want.

    Of course, this does not prevent you from manually using the API methods. You still have full control over that, if that's what you wish.

    You can (and should) read up on the general methods, which will explain how their DWIMish nature works, and what searches they run.

AUTHORS

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Sawyer X.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

metacpan-client's People

Contributors

alexmv avatar atoomic avatar autarch avatar gregoa avatar grinnz avatar haarg avatar jorol avatar karenetheridge avatar kentfredric avatar kevindawson avatar logie17 avatar mickeyn avatar mohawk2 avatar oalders avatar pghmcfc avatar reneeb avatar sineswiper avatar ssoriche avatar stigtsp avatar szabgab avatar tsibley avatar wchristian avatar wolfsage avatar xsawyerx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metacpan-client's Issues

Q, pod suggestion

I think you need a POD example to show, attribute usage for module data

do this

use MetaCPAN::Client;
my $mcpan = MetaCPAN::Client->new();
my $mc = $mcpan->module('Digest::MD5');
my $mc_version = $mc->version();

instead of this

use MetaCPAN::Client;
my $mcpan = MetaCPAN::Client->new();
my $mc = $mcpan->module('Digest::MD5');
my $mc_version = $mc->{data}{version};

ps it tock me a while to figure the above out from the code, when using Data-Printer you can see the exported methods for $mcpan->distribution, but not for $mcpan->module

hope the above helps, from a newbe perspective to MC-C

autocomplete is not as good as the real thing

When I do: my $ac = $mcpan->autocomplete('mojoli access'); I get 10 results, 8 of which are from the Mojolicious distribution, and none of them is "Mojolicious::Plugin::AccessLog".

On the other hand, when I do: GET https://fastapi.metacpan.org/v1/search/autocomplete?q=mojoli+access, I get very varied and interesting results, the first many of which contain both Mojolicious and Access in their names.

->modules query prematurely flattens to scalar

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.

dead attributes in objects when 'fields' used as param

Using an example provided by @neilbowers I see the following problem in objects creation:

If we take the extra parameter 'fields' and pass it to the query, thus limiting the result we get back, the object we create (e.g. ::Release) is going to miss information in attributes which were not in 'fields' (undef is returned for those).

We can prevent that by restricting/ignoring the use of 'fields' as a parameter when we return objects (but not in future raw results mode) - any reasons why we shouldn't do it? any suggestions for the solution?

MetaCPAN::Client does not cache results with WWW::Mechanize::Cached

Hi! Not sure if this should address to MetaCPAN::Client directly , but it seems caching does not happen from time to time. Sometimes it works fine and sometimes client try to download stuff from internet over and over again.

My set up:

            my $meta_client = MetaCPAN::Client->new(
              ua => HTTP::Tiny::Mech->new(
                mechua => WWW::Mechanize::Cached->new(
                  cache => CHI->new(
                    driver   => 'File',
                    root_dir => "$ENV{HOME}/.swatman/metacpan/cache/",
                  ),
                ),
              ),
            );

methods implemented in terms of _get_or_search constraint author, module, distribution, and release names too much

_get_or_search, which is used in the implementation of several other methods, will only delegate to ->_get for arguments that are both defined and match the regular expression /^[A-Za-z-:]+$/.

There are valid module, distribution, and release names that aren't matched by the above regex. There's also invalid module names that are matched by it.

It would seem appropriate to me to always dispatch to ->_get if the argument is both not a reference and defined at the same time.

Search::Elasticsearch 5.x compatibility

As a follow-on from #48, I have got my own usage of MetaCPAN::Client working again in conjunction with Search::Elasticsearch 5.x by installing Search-Elasticsearch-Client-2_0 and making the following changes in MetaCPAN::Client:

diff -up /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm.orig /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm
--- /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm.orig
+++ /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm
@@ -129,6 +129,7 @@ sub ssearch {
     my $params = shift;
 
     my $es = Search::Elasticsearch->new(
+        client           => '2_0::Direct',
         nodes            => [ 'https://' . $self->domain ],
         cxn_pool         => 'Static::NoPing',
         send_get_body_as => 'POST',
diff -up /usr/share/perl5/vendor_perl/MetaCPAN/Client/ResultSet.pm.orig /usr/share/perl5/vendor_perl/MetaCPAN/Client/ResultSet.pm
--- /usr/share/perl5/vendor_perl/MetaCPAN/Client/ResultSet.pm.orig
+++ /usr/share/perl5/vendor_perl/MetaCPAN/Client/ResultSet.pm
@@ -22,7 +22,7 @@ has scroller => (
     is        => 'ro',
     isa       => sub {
         use Safe::Isa;
-        $_[0]->$_isa('Search::Elasticsearch::Scroll')
+        $_[0]->$_isa('Search::Elasticsearch::Client::2_0::Scroll')
             or croak 'scroller must be an Search::Elasticsearch::Scroll object';
     },
     predicate => 'has_scroller',

I've tried it successfully with both the v0 and v1 APIs. I haven't tried the 5_0 or older clients to see if they would also work. Obviously this is just a proof of concept and a proper fix would probably entail supporting different client versions, but that's currently beyond my coding ability.

Pod Coverage test failing with Moo 1.005

Not sure if this is an issue with MetaCPAN-Client, Moo or Pod-Coverage so I'll start here and see where it goes. Since update Moo from 1.003x to 1.005, MetaCPAN-Client's Pod Coverage test fails like this:

$ make test AUTHOR_TESTING=1 RELEASE_TESTING=1
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/api/*.t
t/00-compile.t ............ ok
t/api/_get.t .............. ok
t/api/_get_or_search.t .... ok
t/api/_search.t ........... ok
t/api/author.t ............ ok
t/api/distribution.t ...... ok
t/api/favorite.t .......... ok
t/api/file.t .............. ok
t/api/module.t ............ ok
t/api/pod.t ............... ok
t/api/rating.t ............ ok
t/api/release.t ........... ok
t/author-critic.t ......... ok
t/entity.t ................ ok
#   Failed test 'Pod coverage on MetaCPAN::Client::ResultSet'
#   at /usr/share/perl5/vendor_perl/Test/Pod/Coverage.pm line 133.
# Coverage for MetaCPAN::Client::ResultSet is 87.5%, with 1 naked subroutine:
#       has_scroller
# Looks like you failed 1 test of 12.
t/release-pod-coverage.t ..
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/12 subtests
t/release-pod-syntax.t .... ok
t/request.t ............... ok
t/resultset.t ............. ok
Test Summary Report
-------------------
t/release-pod-coverage.t (Wstat: 256 Tests: 12 Failed: 1)
  Failed test:  4
  Non-zero exit status: 1
Files=18, Tests=203, 10 wallclock secs ( 0.07 usr  0.01 sys +  6.20 cusr  0.35 csys =  6.63 CPU)
Result: FAIL
Failed 1/18 test programs. 1/203 subtests failed.
Makefile:838: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255

has_scroller seems to be being pulled in from Search::Elasticsearch so I don't really think there should be pod for it in MetaCPAN::Client. Perhaps Pod-Coverage should be ignoring this somehow? Any suggestions?

(yes, I know I don't need to run the author/release tests but there's a bug here somewhere and I'd like to help get it fixed)

t/scroll.t failing in 2.008000

$ cd MetaCPAN-Client-2.008000
$ make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/api/*.t
# 
# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module                Want Have
#     ------------------- ------ ----
#     ExtUtils::MakeMaker 7.1101 7.04
# 
# === Build Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.04
# 
# === Test Requires ===
# 
#     Module              Want     Have
#     ------------------- ---- --------
#     ExtUtils::MakeMaker  any     7.04
#     File::Spec           any     3.47
#     Test::Fatal          any    0.014
#     Test::More           any 1.302078
#     Test::Requires       any     0.10
#     base                 any     2.22
#     blib                1.01     1.06
# 
# === Test Recommends ===
# 
#     Module                     Want     Have
#     ---------------------- -------- --------
#     CPAN::Meta             2.120900 2.150010
#     HTTP::Tiny::Mech            any  missing
#     LWP::Protocol::https        any     6.06
#     WWW::Mechanize::Cached     1.48  missing
# 
# === Runtime Requires ===
# 
#     Module           Want     Have
#     --------------- ----- --------
#     Carp              any     1.38
#     HTTP::Tiny      0.056    0.070
#     IO::Socket::SSL  1.42    2.047
#     JSON::MaybeXS     any 1.003009
#     JSON::PP          any  2.27400
#     Moo               any 2.003001
#     Moo::Role         any 2.003001
#     Net::SSLeay      1.49     1.80
#     Ref::Util         any    0.113
#     Safe::Isa         any 1.000006
#     Type::Tiny        any 1.000006
#     URI::Escape       any     3.31
#     strict            any     1.08
#     warnings          any     1.23
# 
# 
# *** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***
# 
# The following REQUIRED prerequisites were not satisfied:
# 
# ExtUtils::MakeMaker version '7.04' is not in required range '7.1101'
# 
t/00-report-prereqs.t ... ok
t/api/_get.t ............ ok
t/api/_get_or_search.t .. ok
t/api/_search.t ......... ok
t/api/author.t .......... ok
t/api/distribution.t .... ok
t/api/download_url.t .... ok
t/api/favorite.t ........ ok
t/api/file.t ............ ok
t/api/module.t .......... ok
t/api/pod.t ............. ok
t/api/rating.t .......... ok
t/api/release.t ......... ok
t/entity.t .............. ok
t/request.t ............. ok
t/resultset.t ........... ok

#   Failed test 'can read all matching docs'
#   at t/scroll.t line 36.
#          got: '52'
#     expected: '51'
# Looks like you failed 1 test of 6.
t/scroll.t .............. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/6 subtests 
t/ua_trap.t ............. skipped: Test requires module 'WWW::Mechanize::Cached' but it's not found

Test Summary Report
-------------------
t/scroll.t            (Wstat: 256 Tests: 6 Failed: 1)
  Failed test:  6
  Non-zero exit status: 1
Files=18, Tests=174, 18 wallclock secs ( 0.04 usr  0.02 sys +  1.93 cusr  0.17 csys =  2.16 CPU)
Result: FAIL
Failed 1/18 test programs. 1/174 subtests failed.
Makefile:939: recipe for target 'test_dynamic' failed
make: *** [test_dynamic] Error 255

This is happening consistently for me.

t/ua_trap.t fails (if WWW::Mechanize::Cached is too old?)

Some of my smokers show the following test failure:

Use of uninitialized value in concatenation (.) or string at /usr/perl5.18.4p/lib/site_perl/5.18.4/HTTP/Tiny.pm line 593.

#   Failed test 'No illegal methods called'
#   at t/ua_trap.t line 45.
#          got: 'Can't use string ("default_expires_in") as a HASH ref while "strict refs" in use at /usr/perl5.18.4p/lib/site_perl/5.18.4/Cache/BaseCache.pm line 430.
# '
#     expected: undef
# Can't use string ("default_expires_in") as a HASH ref while "strict refs" in use at /usr/perl5.18.4p/lib/site_perl/5.18.4/Cache/BaseCache.pm line 430.
# Looks like you failed 1 test of 1.
t/ua_trap.t ............. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 

This seems to happen if all prereqs for running ua_trap.t are met, but WWW::Mechanize::Cached is too old (<1.50?). Statistical analysis:

(1)
****************************************************************
Regression 'fail:t/ua_trap.t'
****************************************************************
Name                   Theta          StdErr     T-stat
[0='const']           1.0000          0.0000    38772244432185280.00
[1='eq_1']           -1.0000          0.0000    -7078810960203983.00

R^2= 1.000, N= 60, K= 2
****************************************************************
(2)
****************************************************************
Regression 'qr:(Failed test\s+\S+.*)'
****************************************************************
Name                   Theta          StdErr     T-stat
[0='const']           1.0000          0.0000    38772244432185280.00
[1='eq_Failed test 'No illegal methods called'']             -1.0000          0.0000    -7078810960203983.00

R^2= 1.000, N= 60, K= 2
****************************************************************
(3)
****************************************************************
Regression 'qr:WWW::Mechanize::Cached\s+\S+\s+(.*)'
****************************************************************
Name                   Theta          StdErr     T-stat
[0='const']           0.0000          0.0000       5.07
[1='eq_1.50']         1.0000          0.0000    6859754891225717.00
[2='eq_missing']              1.0000          0.0000    6668443905700334.00

R^2= 1.000, N= 60, K= 3
****************************************************************

Fails tests without '.' in @INC

On 5.25.10 with -Ddefault_inc_excludes_dot

PERL_DL_NONLAZY=1 "/home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/bin/perl5.25.10" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/api/*.t
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/_search.t line 8.
BEGIN failed--compilation aborted at t/api/_search.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/_search.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 19/19 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/_get_or_search.t line 8.
BEGIN failed--compilation aborted at t/api/_get_or_search.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/_get_or_search.t .. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 10/10 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/_get.t line 8.
BEGIN failed--compilation aborted at t/api/_get.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/_get.t ............ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 13/13 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/author.t line 9.
BEGIN failed--compilation aborted at t/api/author.t line 9.
t/api/author.t .......... 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/download_url.t line 8.
BEGIN failed--compilation aborted at t/api/download_url.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/download_url.t .... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 7/7 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/file.t line 8.
BEGIN failed--compilation aborted at t/api/file.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/file.t ............ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 11/11 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/distribution.t line 9.
BEGIN failed--compilation aborted at t/api/distribution.t line 9.
# Looks like your test exited with 2 before it could output anything.
t/api/distribution.t .... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 9/9 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/favorite.t line 8.
BEGIN failed--compilation aborted at t/api/favorite.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/favorite.t ........ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 10/10 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/pod.t line 7.
BEGIN failed--compilation aborted at t/api/pod.t line 7.
# Looks like your test exited with 2 before it could output anything.
t/api/pod.t ............. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 5/5 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/module.t line 8.
BEGIN failed--compilation aborted at t/api/module.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/module.t .......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 10/10 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/rating.t line 8.
BEGIN failed--compilation aborted at t/api/rating.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/rating.t .......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 7/7 subtests 
Can't locate t/lib/Functions.pm in @INC (you may need to install the t::lib::Functions module) (@INC contains: /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/lib /home/kent/.cpanm/work/1488804455.843/MetaCPAN-Client-2.006000/blib/arch /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10) at t/api/release.t line 8.
BEGIN failed--compilation aborted at t/api/release.t line 8.
# Looks like your test exited with 2 before it could output anything.
t/api/release.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 5/5 subtests 
# 
# Versions for all modules listed in MYMETA.json (including optional ones):
# 
# === Configure Requires ===
# 
#     Module                Want Have
#     ------------------- ------ ----
#     ExtUtils::MakeMaker 7.1101 7.24
# 
# === Build Requires ===
# 
#     Module              Want Have
#     ------------------- ---- ----
#     ExtUtils::MakeMaker  any 7.24
# 
# === Test Requires ===
# 
#     Module              Want     Have
#     ------------------- ---- --------
#     ExtUtils::MakeMaker  any     7.24
#     File::Spec           any     3.66
#     Test::Fatal          any    0.014
#     Test::More           any 1.302073
#     Test::Requires       any     0.10
#     base                 any     2.24
#     blib                1.01     1.06
# 
# === Test Recommends ===
# 
#     Module                     Want     Have
#     ---------------------- -------- --------
#     CPAN::Meta             2.120900 2.150010
#     HTTP::Tiny::Mech            any 1.001001
#     LWP::Protocol::https        any     6.07
#     WWW::Mechanize::Cached     1.48     1.50
# 
# === Runtime Requires ===
# 
#     Module           Want       Have
#     --------------- ----- ----------
#     Carp              any       1.42
#     HTTP::Tiny      0.056      0.070
#     IO::Socket::SSL  1.42      2.047
#     JSON::MaybeXS     any   1.003008
#     JSON::PP          any 2.27400_02
#     Moo               any   2.003000
#     Moo::Role         any   2.003000
#     Net::SSLeay      1.49       1.80
#     Ref::Util         any      0.113
#     Safe::Isa         any   1.000006
#     Type::Tiny        any   1.000006
#     URI::Escape       any       3.31
#     strict            any       1.11
#     warnings          any       1.37
# 
t/entity.t .............. ok
t/00-report-prereqs.t ... ok
t/resultset.t ........... ok
t/request.t ............. ok
Use of uninitialized value in concatenation (.) or string at /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/HTTP/Tiny.pm line 593.
t/ua_trap.t ............. ok
t/scroll.t .............. ok

Test Summary Report
-------------------
t/api/_search.t       (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 19 tests but ran 0.
t/api/_get_or_search.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 10 tests but ran 0.
t/api/_get.t          (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 13 tests but ran 0.
t/api/author.t        (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/api/download_url.t  (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 7 tests but ran 0.
t/api/file.t          (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 11 tests but ran 0.
t/api/distribution.t  (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 9 tests but ran 0.
t/api/favorite.t      (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 10 tests but ran 0.
t/api/pod.t           (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 5 tests but ran 0.
t/api/module.t        (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 10 tests but ran 0.
t/api/rating.t        (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 7 tests but ran 0.
t/api/release.t       (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 5 tests but ran 0.
Files=18, Tests=24, 11 wallclock secs ( 0.07 usr  0.03 sys +  3.06 cusr  0.61 csys =  3.77 CPU)
Result: FAIL
Failed 12/18 test programs. 0/24 subtests failed.
make: *** [Makefile:902: test_dynamic] Error 255

examples/es_filter.pl is broken

olaf$ perl examples/es_filter.pl
[Request] ** [https://fastapi.metacpan.org:443/v1]-[500] {"message":"[Request] ** [http://127.0.0.1:9200]-[400] Bad Request, called from sub Search::Elasticsearch::Role::Client::Direct::ANON at /home/metacpan/metacpan-api/lib/MetaCPAN/Server/Controller/Scroll.pm line 43. With vars: {'request' => {'method' => 'GET','qs' => {'scroll' => '5m'},'path' => '/_search/scroll/c2NhbjszOzEzNjA1NTA2Ol9UTkpwOElSVGF5X0lYeTJUTzhDT2c7MjIxNDE5MTU6bnh2MXI3MUNTZU9xQTlTcWxHVWtEUTsxMzYwNTUwNzpfVE5KcDhJUlRheV9JWHkyVE84Q09nOzE7dG90YWxfaGl0czo5Mzs%3D','serialize' => 'std','body' => undef,'ignore' => []},'status_code' => 400,'body' => {'took' => 18,'timed_out' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),'_shards' => {'successful' => 0,'failed' => 3,'total' => 3,'failures' => [{'index' => undef,'reason' => {'reason' => 'field [tests] isn\'t a leaf field','type' => 'illegal_argument_exception'},'shard' => -1}]},'_scroll_id' => 'c2NhbjswOzE7dG90YWxfaGl0czo5Mzs=','hits' => {'total' => 93,'max_score' => '0','hits' => []}}}\n"}, called from sub Search::Elasticsearch::Scroll::next at /Users/olaf/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/MetaCPAN/Client/ResultSet.pm line 65. With vars: {'status_code' => 500,'request' => {'body' => 'c2NhbjszOzEzNjA1NTA2Ol9UTkpwOElSVGF5X0lYeTJUTzhDT2c7MjIxNDE5MTU6bnh2MXI3MUNTZU9xQTlTcWxHVWtEUTsxMzYwNTUwNzpfVE5KcDhJUlRheV9JWHkyVE84Q09nOzE7dG90YWxfaGl0czo5Mzs=','ignore' => [],'path' => '/_search/scroll','method' => 'POST','mime_type' => 'application/json','qs' => {'scroll' => '5m'},'serialize' => 'std'}}

Question: best approach to get links to all POD documentation

I'm working on writing a docset for Dash.app and I need to get a list of all of the modules that have pod documentation on metacpan. Don't have enough code done yet to share, but my basic approach is this:

my $mcpan = MetaCPAN::Client->new();
my $all_modules = $mcpan->all( 'modules', { fields => [ "name", "module" ] } );

while ( $module = $all_modules->next )
 {
     my $mod_list = $module->module;
     next unless defined( $mod_list->[0]{name} );

      foreach my $mod ( @{$mod_list} )
      {
          HEAD request for metacpan.org/pod/$mod->{name} to check for existance

      } 
      pause 1/4 second for each 100 of these processed
}

write to database where appropriate etc. Is there a better way to do this?

Edit: Leaving the above in place for context. I think the root of my problem/confusion is that it seems that I'm taking a fairly round-about path to do what I think would be a pretty common task: get a list of packages(?).
I'm not 100% sure I grok the relationship between module/file/package/release etc, which is likely why I'm asking this in the first place. Anyway, is there a direct way to get a list of all things in cpan in the form "MetaCPAN::Client" or at least in a format where I can link to the pod documentation url.

RT and GitHub issues side-by-side

$ perl -MMetaCPAN::Client -MDP -wE'DDumper (MetaCPAN::Client->new (version => "v1")->distribution ("Text-CSV_XS")->bugs)'
{   active           => 2,
    closed           => 100,
    new              => 0,
    open             => 1,
    patched          => 1,
    rejected         => 19,
    resolved         => 81,
    source           => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Text-CSV_XS',
    stalled          => 0,
    type             => 'rt'
    }

Discussion on IRC learned that github issues might have returned a similar struct, but if RT was also found, it got overwritten. Maybe better would be to add a level

$ perl -MMetaCPAN::Client -MDP -wE'DDumper (MetaCPAN::Client->new (version => "v1")->distribution ("Text-CSV_XS")->bugs)'
{ rt => {
    active           => 2,
    closed           => 100,
    new              => 0,
    open             => 1,
    patched          => 1,
    rejected         => 19,
    resolved         => 81,
    source           => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Text-CSV_XS',
    stalled          => 0,
    },
  gh => {
    active           => 0,
    closed           => 1,
    new              => 0,
    open             => 0,
    source           => 'https://github.com/Tux/Text-CSV_XS/issues',
    },
  };

Handling of HTTP/transport errors

If HTTP::Tiny receives an HTTP error (like server error 500) or encounters a connection error, it will set the error code in the response (599 for connection errors). The documentation should mention if and how MetaCPAN::Client deals with these error conditions.

Example on getting # favourites for all dists

I can't work out how to query favourites. Can you add an example showing how you can iterate over all dists that have one or more favourites please, getting back just the dist name?

Cheers,
Neil

LWP::Protocol::https not specified as a prereq

Tests fail if LWP::Protocol::https is not installed:

Use of uninitialized value in concatenation (.) or string at /opt/perl-5.24.0t/lib/5.24.0/HTTP/Tiny.pm line 526.

#   Failed test 'No illegal methods called'
#   at t/ua_trap.t line 45.
#          got: 'Failed to fetch 'https://api.metacpan.org/v0/author/KENTNL': Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at /tmpfs/.cpan-build-cpansand/2016080518/MetaCPAN-Client-1.022001-AMgyxF/blib/lib/MetaCPAN/Client.pm line 201.
# '
#     expected: undef
# Failed to fetch 'https://api.metacpan.org/v0/author/KENTNL': Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at /tmpfs/.cpan-build-cpansand/2016080518/MetaCPAN-Client-1.022001-AMgyxF/blib/lib/MetaCPAN/Client.pm line 201.
# Looks like you failed 1 test of 1.
t/ua_trap.t .............. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 

Can't locate object method "dist" via package "MetaCPAN::Client"

is this a pod issue -> https://metacpan.org/pod/MetaCPAN::Client#distribution

#!perl

use strict;
use warnings;
use Carp::Always::Color;
use Data::Printer;

use MetaCPAN::Client;
my $mcpan  = MetaCPAN::Client->new();

my $dist = $mcpan->dist('MetaCPAN-Client');
##Can't locate object method "dist" via package "MetaCPAN::Client" at mcc_01.pl line 11.

__END__

p $mcpan;

MetaCPAN::Client  {
    Parents       Moo::Object
    public methods (15) : author, BUILDARGS, distribution, favorite, fetch, file, module, new, post, rating, release, request, reverse_dependencies, ssearch, ua
    private methods (5) : _assert_request, _get, _get_or_search, _reverse_deps, _search
    internals: {
        request   MetaCPAN::Client::Request
    }
}

So I think you mean the following
my $dist = $mcpan->distribution('MetaCPAN-Client');

t/api/author.t fails

t/api/author.t started to fail recently:

Use of uninitialized value $_ in pattern match (m//) at t/api/author.t line 78.

#   Failed test 'This Dave has a Gmail account'
#   at t/api/author.t line 78.

(error repeats a couple of times).

Undeclared dependency LWP::Protocol::https

It seems that LWP::Protocol::https has to be declared as a prerequisite:

Use of uninitialized value in concatenation (.) or string at /home/cpansand/.cpan/build/2017032321/HTTP-Tiny-0.070-zFPGrC/blib/lib/HTTP/Tiny.pm line 593.

#   Failed test 'No illegal methods called'
#   at t/ua_trap.t line 45.
#          got: 'Failed to fetch 'https://fastapi.metacpan.org/v1//author/KENTNL': Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at /tmpfs/.cpan-build-cpansand/2017032321/MetaCPAN-Client-2.008001-Syu199/blib/lib/MetaCPAN/Client.pm line 212.
# '
#     expected: undef
# Failed to fetch 'https://fastapi.metacpan.org/v1//author/KENTNL': Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) at /tmpfs/.cpan-build-cpansand/2017032321/MetaCPAN-Client-2.008001-Syu199/blib/lib/MetaCPAN/Client.pm line 212.
# Looks like you failed 1 test of 1.
t/ua_trap.t ............. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 

All objects should provide a metacpan_url method

It'd be incredibly useful if we could get URLs to a release, distribution, module, etc. on the metacpan.org website with a simple method. As it is, you have to know the exact URL scheme the website uses and construct it from object attributes.

specifying fields in requests can break array type checking

Elasticsearch isn't always smart about returning an array type field as an array, when field params are specified.

For instance, if you try to search for an array type field such as "provides", and a result only has a single value, Elasticsearch can return this field as a scalar. This breaks the type checking in MetaCPAN::Client::Role::Entity.

$ perl -MMetaCPAN::Client -E 'say MetaCPAN::Client->new->release({name => "App-cpanminus-1.7043"}, {fields => ["provides"]})->next->provides;'

Maybe the type checking should gracefully promote scalars to arrays? Not sure what the best solution would be here.

v1 API does not return the 'authorized' field, even when explictly requested

Sample query using API v0:

$ perl -MData::Dump -MMetaCPAN::Client -e 'my $mcpan = MetaCPAN::Client->new( version => "v0" ); my $results = $mcpan->release( { all => [ { distribution => "MetaCPAN-Client" }, { version => "1.026001" }, ] }, { fields => "authorized,date,name,version" } ); dd($results->next->{'data'});'
{
  authorized => "true",
  date => "2016-10-19T21:45:01.000Z",
  name => "MetaCPAN-Client-1.026001",
  version => 1.026001,
}

Using v1 API:

$ perl -MData::Dump -MMetaCPAN::Client -e 'my $mcpan = MetaCPAN::Client->new( version => "v1" ); my $results = $mcpan->release( { all => [ { distribution => "MetaCPAN-Client" }, { version => "1.026001" }, ] }, { fields => "authorized,date,name,version" } ); dd($results->next->{'data'});'
{
  date    => "2016-10-19T21:45:01",
  name    => "MetaCPAN-Client-1.026001",
  version => 1.026001,
}

I expect this issue is somewhere upstream of MetaCPAN-Client but I don't know where.

Caching doesn't actually work

With this new client, everything is based on running scrolls, as opposed to grabbing a certain sized query. Caching is based on URL+POST information. However, with ElasticSearch scrolls, the exact same URL is used to acquire different results. Thus, trying to cache the page results in an infinite loop of the same results. (I know; I tried. This is how I figured out how scrolling worked...)

Caching is critical to Dist::Zilla::Role::MetaCPANInterfacer, since the queries would be ran on just about every 'dzil' command.

I have a potential solution, but I wanted your opinion of it first. It uses the fact that MetaCPAN::Client::ResultSet->scroller needs a Search::Elasticsearch::Scroll object. I created something called Search::Elasticsearch::FakeScroll, which acts like a scroll, but doesn't actually use the scroll function. Instead, it would be called with a reduced size parameter, and puts the all of the results in the same kind of result set that Scroll would use.

In fact, there isn't much to the code:

package Search::Elasticsearch::FakeScroll;

use Moo;
use namespace::clean;

extends 'Search::Elasticsearch::Scroll';

#===================================
sub BUILDARGS {
#===================================
    my ( $class, $params ) = parse_params(@_);

    delete $params->{scroll};
    delete $params->{scroll_in_body};

    my $es      = delete $params->{es};
    my $results = $es->search($params);

    return {
        es           => $es,
        aggregations => $results->{aggregations},
        facets       => $results->{facets},
        suggest      => $results->{suggest},
        took         => $results->{took},
        total_took   => $results->{took},
        total        => $results->{hits}{total},
        max_score    => $results->{hits}{max_score},
        _buffer      => $results->{hits}{hits},
        is_finished  => 1,
    };
}

1;

Then MetaCPAN::Client would have some sort of switch to enable this mode (passed to MetaCPAN::Client::Request), so that caching doesn't loop.

version_numified should be string, not number

When I do p $release I get version_numified as a number, not a string.

But version_numified can have many many decimal digits (more than Perl can handle in numbers, I believe), so to be precise and not lose precision, we should be able to process it and store it in a database as a string, not a number.

        data   {
            author             "LOCALSHOP",
            date               "2016-11-29T16:57:37",
            distribution       "WebService-Xero",
            maturity           "released",
            name               "WebService-Xero-0.10",
            version            0.10,
            version_numified   0.1
        },
        date   "2016-11-29T16:57:37"

Test::Requires required modules cause a BAIL_OUT

Apparently when the modules aren't available, it just causes a BAIL_OUT. Example:

t/ua_trap.t ............... Bailout called.  Further testing stopped:  Test requires module 'WWW::Mechanize::Cached' but it's not found
FAILED--Further testing stopped: Test requires module 'WWW::Mechanize::Cached' but it's not found

It doesn't skip. :(

is this me or ....

hi mickeyn

#!perl 

use strict;
use warnings;
use Carp::Always::Color;
use Data::Printer {caller_info => 1,};
use Try::Tiny;

use MetaCPAN::Client;
my $mcpan = MetaCPAN::Client->new();

my $mc = $mcpan->module('Digest::MD5');
p $mc;

my $mc_v = $mc->{data}{version};
p $mc_v;

my $mc_vn = $mc->{data}{version_numified};
p $mc_vn;

my $cpan_version = $mc->{data}{version_numified};
$cpan_version = 'core' if $mc->{data}{distribution} eq 'perl';

p $cpan_version;

exit(0);

and you get

module: invalid args (takes scalar value or search parameters hashref) at /home/kevin/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/MetaCPAN/Client.pm line 181.
    MetaCPAN::Client::_get_or_search(MetaCPAN::Client=HASH(0x90112a0), "module", "Digest::MD5", undef) called at /home/kevin/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/MetaCPAN/Client.pm line 43
    MetaCPAN::Client::module(MetaCPAN::Client=HASH(0x90112a0), "Digest::MD5") called at /home/kevin/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/MetaCPAN/Client.pm line 181.
    MetaCPAN::Client::_get_or_search(MetaCPAN::Client=HASH(0x90112a0), "module", "Digest::MD5", undef) called at /home/kevin/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/MetaCPAN/Client.pm line 43
    MetaCPAN::Client::module(MetaCPAN::Client=HASH(0x90112a0), "Digest::MD5") called at mc2.pl line 12

Searches with fields param broken with Search::Elasticsearch 5.01

I'm doing lookups like this:

my $mcpan = MetaCPAN::Client->new();
# Look up latest stable release
my $results = $mcpan->release(
        {       all => [ { distribution => $distro    },
                         { maturity     => 'released' }, ]
        },
        { fields => "authorized,date,name,version" }
);

and that works fine at the moment, but after trying Search::Elasticsearch 5.01 I got:

[Param] ** Unknown param (fields) in (search) request. See docs at: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html, called from sub Search::Elasticsearch::Client::5_0::Direct::scroll_helper at /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm line 147.

I've reverted to S::E 2.03 for now. I'm not even sure if this was supposed to work really; I don't know which version of Elasticsearch is being used with MetaCPAN.

Question: Convert dependency data obtained by MetaCPAN::Client to cpanfile?

I'm just asking this as I would like to get module dependency data in cpanfile (or CPAN::Meta::Prereqs) format from data fetched via MetaCPAN::Client. I guess it's not unusual case, so someone else might have made some shortcut there. If there's no existing stuffs it's fine for me to do it myself. Thanks!

failed to delete scroller at .../MetaCPAN/Client/Scroll.pm line 162.

I have a script which is, in outline:

created MetaCPAN::Client
iterate on releases, collecting information
do a bunch of processing on the information
exit

I came back to see that the script had finished, with the final line of output being:

failed to delete scroller at .../MetaCPAN/Client/Scroll.pm line 162.

I assume resources on the server side time out, which is what's causing this, but given it's cleanup in a DESTROY (another assumption), maybe this could be suppressed?

CPANTESTERS results please

This M::C unrelated snippet currently returns invalid values and often timeouts

    # CPANTESTER results
    $opt_v > 1 and warn " Fetch cpantesters\n";
    !defined $data->{cptst} and
        $data->{cptst} =
          ($r = CPAN::Testers::WWW::Reports::Query::AJAX->new (dist => $dist))
        ? [ $r->pass, $r->na, $r->fail, $r->unknown ]
        : [ "", "", "", "" ];

I would like to see valid actual (recent) values for CPANTESTERS results for a given distribution, somewhat like

$ perl -MMetaCPAN::Client -MData::Peek -wE'DDumper (MetaCPAN::Client->new (version => "v1")->distribution ("Text-CSV_XS")->cpantesters)'
{   pass  => 214,
    fail  => 0,
    na    => 0,
    }

replace current query building with query match_all and filters?

from what I read about ES (not an expert) using:
query => { match_all => {} }
+filters
is more efficient than building our search inside 'query' as we currently do.
also the way we did it doesn't allow queries like 'get all authors'.

any thoughts about such change?

# the following is the same as ->author('MICKEY')

not true

my $mcpan  = MetaCPAN::Client->new();

try{
    my $author = $mcpan->author('BOWTIE');
    p $author; # MetaCPAN::Client::Author
};

try{
    my $author = $mcpan->author( { pauseid => 'BOWTIE'} );
    p $author; # MetaCPAN::Client::ResultSet
};

produces the following

kevin@billy:~/scratch/svn2git/script$ perl authors-02.pl 
Printing in line 23 of authors-02.pl:
MetaCPAN::Client::Author  {
    Parents       Moo::Object
    public methods (14) : blog, city, country, dir, email, gravatar_url, name, new, pauseid, profile, releases, updated, user, website
    private methods (1) : _known_fields
    internals: {
        data   {
            blog           [
                [0] {
                    feed   "",
                    url    "http://kevindawson.github.io/bowtie/"
                }
            ],
            country        "GB",
            dir            "id/B/BO/BOWTIE",
            email          [
                [0] "bowtie@cpan.org"
            ],
            gravatar_url   "https://secure.gravatar.com/avatar/9f27e15605c9a2d35a4f307a0bbf5dbf?s=130&d=identicon",
            name           "Kevin Dawson",
            pauseid        "BOWTIE",
            profile        [
                [0] {
                    id     "kevindawson",
                    name   "coderwall"
                },
                [1] {
                    id     "kevindawson",
                    name   "github"
                },
                [2] {
                    id     "BOWTIE",
                    name   "github-meets-cpan"
                },
                [3] {
                    id     "bowtie",
                    name   "ohloh"
                }
            ],
            updated        "2013-07-31T10:24:57",
            user           "m-AM5x8ZSAmcmUZCGkQVTA",
            website        []
        }
    }
}
Printing in line 28 of authors-02.pl:
MetaCPAN::Client::ResultSet  {
    Parents       Moo::Object
    public methods (9) : BUILDARGS, facets, has_scroller, items, new, next, scroller, total, type
    private methods (0)
    internals: {
        scroller   Search::Elasticsearch::Scroll,
        total      1,
        type       "author"
    }
}

they are not the same to me as I can not extract email from both or from the following

my $author = $mcpan->author({name => 'Kevin Dawson',});

Raw Query construction for Request class

This really aught to be a discussion of some kind, because I don't really know what I'm doing here.

request->ssearch() is presently poorly designed for doing raw queries.

You can hack around it with

request->ssearch('author', { bogus => 1 }, { %raw_query_here });

And it works because you can stuff {body => } there and blow away the annyoingly constrictive generated one.

But its ugly, and the function is not very obvious. You need the bogus stuff because without it, it simply breaks due to the generated query having $args != 1

I've considered various ways of hacking around it, to make the interface slightly more usable, for instance:

https://gist.github.com/kentfredric/22266f846eb6003dc842

But that solution strikes me as pretty dodgy because of the magical behaviour that is dependent on the value of $args

I even considered

diff --git a/lib/MetaCPAN/Client/Request.pm b/lib/MetaCPAN/Client/Request.pm
index 3c58fcf..2c20bb5 100644
--- a/lib/MetaCPAN/Client/Request.pm
+++ b/lib/MetaCPAN/Client/Request.pm
@@ -158,6 +158,9 @@ sub _build_query_rec {
     ref $args eq 'HASH' or croak 'query args must be a hash';

     my %query = ();
+
+    return \%query if not keys %{$args};
+
     my $basic_element = 1;

   KEY: for my $k ( qw/ all either not / ) {

But really, that's the same problem all over again, magical behaviour with a magic token.

I think this, slightly more complex approach would be better:

https://gist.github.com/kentfredric/65295334188a7fba4024

Simply because it keeps the existing API exactly the same, doesn't introduce any magical token behaviour, and gives a useful raw search at the same time.

Incidentally, that approach was the first one I tried, and the other ones are later ideas I had after I realised you could already pass custom params.

How to specify time for scroller?

I create a MetaCPAN::Client object and then run lots of queries through it (current release info for all modules I use locally). Of late, I've been getting errors when doing this:

failed to delete scroller at /usr/share/perl5/vendor_perl/MetaCPAN/Client/Scroll.pm line 160.                                         
failed to create a scrolled search at /usr/share/perl5/vendor_perl/MetaCPAN/Client/Request.pm line 129.                               

I suspect that this is because the scroller has lived longer than the default 5 minutes in MetaCPAN::Client::Scroll. I see that MetaCPAN::Client::Scroll has a 'time' attribute but I don't see any way to set that via MetaCPAN::Client->new / MetaCPAN::Client::Request. Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.