NAME

App::cpm::Resolver - resolving everything

SYNOPSIS

Prepare your resolver first:

# resolver.pl
package Your::Custom::Resolver {
  sub new {
    bless {}, shift;
  }

  # resolver **must** implement resolve method
  sub resolve {
    my ($self, $job) = @_;
    # $job = { package => "Your::Module", version => "> 1.00, < 2.00" }

    retrun {
      source => "git",
      uri => "git://github.com/you/Your-Module.git",
      ref => "develop",
      version => "1.52",
      package => "Your::Module",
    };
  }
}

use App::cpm::Resolver::Cascade;
use App::cpm::Resolver::MetaDB;
my $cascade = App::cpm::Resolver::Cascade->new;
$cascade->add(Your::Custom::Resolver->new); # resolve dist with your resolver first
$cascade->add(App::cpm::Resolver::MetaDB->new); # fallback to normal resolver
return $cascade

Then you can install Your::Module with cpm.

> cpm install --custom-resolver resolver.pl Your::Module

DESCRIPTION

It seems that "resolving distribution names/locations via 02packages.details.txt" and "fetching distributions via cpan" are de facto standards, and a lot of cpan clients and cpan local mirror (darkpan) follow that convention (or fake that convention).

But people sometimes want more flexible cpan clients / darkpans.

For example, people want to resolve distribution names/locations via:

  • 02packages.details.txt in remote or local

  • cpanmetadb

  • metacpan v1 download url API

  • your custom API (http server)

  • your custom file format

  • arbitrary db (elasticsearch, mysql, sqlite, PostgreSQL, etc)

and want to fetch distributions via:

  • cpan (www.cpan.org, etc)

  • metacapn

  • backpan

  • arbitrary http server

  • remote git repository (such as github.com)

  • remote svn repository

  • local tar.gz

  • local directory

Now cpm has not only the following resolvers

  • App::cpm::Resolver::MetaDB

  • App::cpm::Resolver::MetaCPAN

  • App::cpm::Resolver::O2Packages

  • App::cpm::Resolver::Snapshot

  • App::cpm::Resolver::Cascade

but also --custom-resolver option so that you can use your own resolver.

SEE ALSO

Menlo

CPAN::Common::Index

Plack::App::Cascade

App::CPANIDX

App::opan