The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MetaCPAN::Client::Request - Object used for making requests to MetaCPAN

VERSION

version 1.002000

ATTRIBUTES

domain

    $mcpan = MetaCPAN::Client->new( domain => 'localhost' );

What domain to use for all requests.

Default: api.metacpan.org.

version

    $mcpan = MetaCPAN::Client->new( version => 'v0' );

What version of MetaCPAN should be used?

Default: v0.

base_url

    my $mcpan = MetaCPAN::Client->new(
        base_url => 'http://localhost:9999/v2',
    );

Instead of overriding the base_url, you should override the domain and version. The base_url will be set appropriately automatically.

Default: http://$domain/$version.

ua

    my $mcpan = MetaCPAN::Client->new( ua => HTTP::Tiny->new(...) );

The user agent object for running requests.

It must provide an interface that matches HTTP::Tiny. Explicitly:

  • Implement post()

    Method post must be available that accepts a request URL and a hashref of options.

  • Implement get()

    Method get must be available that accepts a request URL.

  • Return result hashref

    Must return a result hashref which has key success and key content.

Default: HTTP::Tiny,

ua_args

    my $mcpan = MetaCPAN::Client->new(
        ua_args => [ agent => 'MyAgent' ],
    );

Arguments sent to the user agent.

Default: user agent string: MetaCPAN::Client/$version.

METHODS

fetch

    my $result = $mcpan->fetch('/release/Moose');

    # with parameters
    my $more = $mcpan->fetch(
        '/release/Moose',
        { param => 'value' },
    );

Fetches a path from MetaCPAN (post or get), and returns the decoded result.

ssearch

Calls an Elastic Search query (using Search::Elasticsearch and returns an Search::Elasticsearch::Scroll scroller object.

AUTHORS

  • Sawyer X <xsawyerx@cpan.org>

  • Mickey Nasriachi <mickey@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 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.