Skip to content

Latest commit

 

History

History
118 lines (86 loc) · 2.8 KB

README.md

File metadata and controls

118 lines (86 loc) · 2.8 KB

go-cpanm

A Go implementation of cpanminus, a lightweight CPAN client.

Overview

THIS IS A WORK IN PROGRESS

go-cpanm aims to provide the same functionality as cpanminus (the Perl-based CPAN client), but implemented as a single Go executable with no external dependencies. It allows you to download, build, and install Perl modules from CPAN.

Features

  • Download Perl modules from CPAN
  • Resolve dependencies
  • Build and install modules1
  • Support for various installation targets (local, global)2
  • Single binary executable with no runtime dependencies
  • [ ]Works with standard Perl module installation (ExtUtils::MakeMaker and Module::Build)

Installation

From Source

  1. Clone the repository:

    git clone https://github.com/perigrin/go-cpanm.git
    cd go-cpanm
    
  2. Build the executable:

    go build -o go-cpanm ./cmd/cpanm
    
  3. Install to your PATH:

    sudo cp go-cpanm /usr/local/bin/
    

Usage

go-cpanm [options] Module::Name

Options:
  --local-lib, -l DIR      Specify the install base to install modules
  --target DIR             Specify the target directory to install modules
  --sudo                   sudo to install modules to system directories
  --force                  Force install modules
  --verbose                Verbose output
  --quiet                  Suppress output
  --notest                 Skip the testing
  --installdeps            Only install dependencies
  --help                   Show this help message
  --version                Show version

Examples

Install a module:

go-cpanm Moose

Install multiple modules:

go-cpanm Moose Plack DBI

Install a module and its dependencies in a local directory:

go-cpanm --local-lib=~/perl5 Moose

Force installation even if tests fail:

go-cpanm --force Moose

Show verbose output:

go-cpanm --verbose Moose

Skip running tests:

go-cpanm --notest Moose

Only install dependencies:

go-cpanm --installdeps Moose

Implementation Details

go-cpanm is implemented in Go and consists of several components:

  1. Fetcher: Downloads module metadata and tarballs from CPAN
  2. Parser: Parses module metadata and extracts tarballs
  3. Builder: Builds Perl modules
  4. Installer: Installs Perl modules

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Tatsuhiko Miyagawa for creating the original cpanminus
  • The Perl community for maintaining CPAN

Footnotes

  1. Currently it can only parse dependencies from META.json and META.yml files

  2. Currently when installing to a local::lib it forgets to update the PERL5LIB environment variable and can't find the installed dependencies