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

NAME

CPAN::Local - Manage your local CPAN mirror

VERSION

This document describes version 0.01 of CPAN::Local (from Perl distribution CPAN-Local), released on 2015-01-13.

SYNOPSIS

See lcpan script.

FUNCTIONS

list_local_cpan_authors(%args) -> any

List authors in local CPAN.

Examples:

 list_local_cpan_authors();

List all authors.

 list_local_cpan_authors( query => "MICHAEL%"); # -> ["MICHAEL", "MICHAELW"]

Find CPAN IDs which start with something.

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • detail => bool

  • query => str

    Search query.

Return value: (any)

By default will return an array of CPAN ID's. If you set detail to true, will return array of records.

list_local_cpan_deps(%args) -> [status, msg, result, meta]

List dependencies of a module, data from local CPAN.

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • include_core => bool (default: 0)

    Include Perl core modules.

  • level => int (default: 1)

    Recurse for a number of levels (-1 means unlimited).

  • module* => str

  • perl_version => str (default: "v5.18.4")

    Set base Perl version for determining core modules.

  • phase => str (default: "runtime")

  • rel => str (default: "requires")

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

list_local_cpan_dists(%args) -> any

List distributions in local CPAN.

Examples:

 list_local_cpan_dists( cpan => "/cpan");

List all distributions.

 list_local_cpan_dists( cpan => "/cpan", query => "data-table");

Grep by distribution name, return detailed record.

 list_local_cpan_dists();

Filter by author, return JSON.

Arguments ('*' denotes required arguments):

  • author => str

    Filter by author.

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • detail => bool

  • query => str

    Search query.

Return value: (any)

By default will return an array of distribution names. If you set detail to true, will return array of records.

list_local_cpan_modules(%args) -> any

List packages in local CPAN.

Arguments ('*' denotes required arguments):

  • author => str

    Filter by author.

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • detail => bool

  • dist => str

    Filter by distribution.

  • query => str

    Search query.

Return value: (any)

By default will return an array of package names. If you set detail to true, will return array of records.

list_local_cpan_packages(%args) -> any

List packages in local CPAN.

Arguments ('*' denotes required arguments):

  • author => str

    Filter by author.

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • detail => bool

  • dist => str

    Filter by distribution.

  • query => str

    Search query.

Return value: (any)

By default will return an array of package names. If you set detail to true, will return array of records.

list_local_cpan_rev_deps(%args) -> [status, msg, result, meta]

List reverse dependencies of a module, data from local CPAN.

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • module* => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

stat_local_cpan(%args) -> [status, msg, result, meta]

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

update_local_cpan(%args) -> [status, msg, result, meta]

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

update_local_cpan_files(%args) -> [status, msg, result, meta]

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

  • max_file_size => int

  • remote_url => str

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

update_local_cpan_index(%args) -> [status, msg, result, meta]

Arguments ('*' denotes required arguments):

  • cpan => str

    Location of your local CPAN mirror, e.g. /path/to/cpan.

    Defaults to ~/cpan.

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HISTORY

This application began as CPAN::SQLite::CPANMeta, an extension of CPAN::SQLite. CPAN::SQLite parses 02packages.details.txt.gz and 01mailrc.txt.gz and puts the parse result into a SQLite database. CPAN::SQLite::CPANMeta parses the META.json/META.yml files in individual release files and adds it to the SQLite database.

In order to simplify things for the users (one-step indexing) and get more freedom in database schema, CPAN::Local skips using CPAN::SQLite and creates the SQLite database itself. It also parses 02packages.details.txt.gz but does not parse distribution names from it but instead uses META.json and META.yml files extracted from the release files.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/CPAN-Local.

SOURCE

Source repository is at https://github.com/perlancar/perl-CPAN-Local.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Local

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by perlancar@cpan.org.

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