Perl6のモジュールインストール(zef版)

Perl6のモジュールをインストールする`panda`:panda_face:コマンドがDEPRECATEDになり、代わりに`zef`というコマンドを使うようになりました。

今回はその `zef` の使い方を紹介します。 
※ `panda` の使い方は[こちら](http://qiita.com/B73W56H84/items/9fbaad672e16ea61640c)。

## 使い方

```text
$ zef
Zef - Perl6 Module Management

USAGE

    zef [flags|options] command [args]


COMMANDS

    install                 Install specific dependencies by name or path
    uninstall               Uninstall specified distributions
    test                    Run tests on a given module's path
    fetch                   Fetch and extract module's source
    build                   Run the Build.pm in a given module's path
    look                    Fetch followed by shelling into the module's path
    update                  Update package indexes for repositories
    upgrade (BETA)          Upgrade specific distributions (or all if no arguments)
    search                  Show a list of possible distribution candidates for the given terms
    info                    Show detailed distribution information
    list                    List known available distributions, or installed distributions with `--installed`
    rdepends                List all distributions directly depending on a given identity
    locate                  Lookup installed module information by short-name, name-path, or sha1 (with --sha1 flag)
    smoke                   Run smoke testing on available modules
    nuke                    Delete directory/prefix containing matching configuration path or CURLI name

OPTIONS

    --install-to=[name]     Short name or spec of CompUnit::Repository to install to
    --config-path=[path]    Load a specific Zef config file

VERBOSITY LEVEL (from least to most verbose)
    --error, --warn, --info (default), --verbose, --debug

FLAGS
    --depsonly              Install only the dependency chains of the requested distributions
    --force                 Continue each phase regardless of failures
    --dry                   Run all phases except the actual installations
    --serial                Install each dependency after passing testing and before building/testing the next dependency

    --/test                 Skip the testing phase
    --/build                Skip the building phase

    --/depends              Do not fetch runtime dependencies
    --/test-depends         Do not fetch test dependencies
    --/build-depends        Do not fetch build dependencies

CONFIGURATION /usr/local/Cellar/rakudo-star/2017.01/share/perl6/site/resources/C2537734F744EDFED0E1CF62B481DC8145E63E2F.json
    Enable or disable plugins that match the configuration that has field `short-name` that matches <short-name>

    --<short-name>  # `--cpan`  Enable plugin with short-name `cpan`
    --/<short-name> # `--/cpan` Disable plugin with short-name `cpan`
```

(BETA) とのことですが、`upgrade`がうれしいですね。

## インストール済モジュール一覧

出力が `panda` と全然違いますが、どのディレクトリにインストールされたのか判るようになって助かります。
普段使いでは`--verbose`は不要でしょう。

```text
$ zef list --installed --verbose
===> Found via /usr/local/Cellar/rakudo-star/2017.01/share/perl6/site
Template::Mojo:ver('0.1')
#	Template::Mojo
Template::Mustache:auth('github:softmoth')
#	Template::Mustache
Terminal::ANSIColor:ver('0.2')
#	Terminal::ANSIColor
SVG::Plot
#	SVG::Box
#	SVG::Plot
#	SVG::Plot::AxisPosition
#	SVG::Plot::Pie
NativeHelpers::Blob:ver('0.1.10'):auth('github:salortiz')
#	MoarVM::Guts::REPRs
#	NativeHelpers::Blob
#	NativeHelpers::CStruct
#	NativeHelpers::Pointer
PSGI:ver('1.2.0')
#	PSGI
HTTP::Easy:ver('1.1.0')
#	HTTP::Easy
#	HTTP::Easy::PSGI
File::Which
#	File::Which
#	File::Which::MacOSX
#	File::Which::Unix
#	File::Which::Win32
OpenCV:ver('0.0.5'):auth('github:azawawi')
#	OpenCV
#	OpenCV::Highgui
#	OpenCV::Mat
#	OpenCV::NativeCall
#	OpenCV::Photo
URI:ver('0.1.2')
#	IETF::RFC_Grammar
#	IETF::RFC_Grammar::IPv6
#	IETF::RFC_Grammar::URI
#	URI
#	URI::DefaultPort
#	URI::Escape
Grammar::Debugger
#	Grammar::Debugger
#	Grammar::Tracer
LWP::Simple:ver('0.090'):auth('Cosimo Streppone')
#	LWP::Simple
Shell::Command
#	Shell::Command
panda:ver('2016.02')
#	Panda
#	Panda::App
#	Panda::Builder
#	Panda::Bundler
#	Panda::Common
#	Panda::Ecosystem
#	Panda::Fetcher
#	Panda::Installer
#	Panda::Project
#	Panda::Reporter
#	Panda::Tester
p6doc
#	Perl6::Documentable
#	Perl6::Documentable::Registry
#	Perl6::Type
#	Perl6::TypeGraph
#	Perl6::TypeGraph::Viz
#	Pod::Convenience
#	Pod::Htmlify
#	Pod::To::SectionFilter
File::Find:ver('0.1')
#	File::Find
Pod::To::BigPage:ver('0.2.1'):auth('Wenzel P. P. Peppmeyer')
#	Pod::To::BigPage
Pod::To::HTML:ver('0.3.7')
#	Pod::To::HTML
Linenoise:ver('0.1.1'):auth('Rob Hoelz')
#	Linenoise
XML::Writer
#	XML::Writer
Digest::MD5:ver('0.05'):auth('Cosimo Streppone')
#	Digest::MD5
JSON::RPC:ver('0.17.1'):auth('Pawel Pabian')
#	JSON::RPC::Client
#	JSON::RPC::Server
#	X::JSON::RPC
LibraryMake:ver('1.0.0'):auth('github:retupmoca')
#	LibraryMake
zef:auth('github:ugexe')
#	Zef
#	Zef::Build
#	Zef::CLI
#	Zef::Client
#	Zef::Config
#	Zef::Distribution
#	Zef::Distribution::DependencySpecification
#	Zef::Distribution::Local
#	Zef::Extract
#	Zef::Fetch
#	Zef::Identity
#	Zef::Repository
#	Zef::Repository::Ecosystems
#	Zef::Repository::LocalCache
#	Zef::Repository::MetaCPAN
#	Zef::Service::FetchPath
#	Zef::Service::Shell::Build
#	Zef::Service::Shell::PowerShell
#	Zef::Service::Shell::PowerShell::download
#	Zef::Service::Shell::PowerShell::unzip
#	Zef::Service::Shell::Test
#	Zef::Service::Shell::curl
#	Zef::Service::Shell::git
#	Zef::Service::Shell::p5tar
#	Zef::Service::Shell::prove
#	Zef::Service::Shell::tar
#	Zef::Service::Shell::unzip
#	Zef::Service::Shell::wget
#	Zef::Service::TAP
#	Zef::Shell
#	Zef::Test
#	Zef::Utils::FileSystem
#	Zef::Utils::SystemInfo
#	Zef::Utils::URI
File::Temp
#	File::Temp
Debugger::UI::CommandLine
#	Debugger::UI::CommandLine
Test::Mock:ver('1.3')
#	Test::Mock
DBIish:ver('0.5.9')
#	DBDish
#	DBDish::Connection
#	DBDish::ErrorHandling
#	DBDish::Oracle
#	DBDish::Oracle::Connection
#	DBDish::Oracle::Native
#	DBDish::Oracle::StatementHandle
#	DBDish::Pg
#	DBDish::Pg::Connection
#	DBDish::Pg::Native
#	DBDish::Pg::StatementHandle
#	DBDish::SQLite
#	DBDish::SQLite::Connection
#	DBDish::SQLite::Native
#	DBDish::SQLite::StatementHandle
#	DBDish::StatementHandle
#	DBDish::TestMock
#	DBDish::TestMock::Connection
#	DBDish::TestMock::StatementHandle
#	DBDish::mysql
#	DBDish::mysql::Connection
#	DBDish::mysql::Native
#	DBDish::mysql::StatementHandle
#	DBIish
#	DBIish::Common
#	DBIish::CommonTesting
#	NativeLibs
MIME::Base64:ver('1.2'):auth('github:retupmoca')
#	MIME::Base64
#	MIME::Base64::Perl
Grammar::Profiler::Simple:ver('0.01'):auth('Jonathan Scott Duff')
#	Grammar::Profiler::Simple
JSON::Tiny
#	JSON::Tiny
#	JSON::Tiny::Actions
#	JSON::Tiny::Grammar
SVG
#	SVG
Native::Resources:ver('0.1.0'):auth('Rob Hoelz')
#	Native::Resources
#	Native::Resources::Build
File::Directory::Tree:auth('labster')
#	File::Directory::Tree
HTTP::Status
#	HTTP::Status
TAP::Harness::Prove6:ver('0.0.1'):auth('Leon Timmermans')
JSON::Fast:ver('0.7')
#	JSON::Fast
===> Found via /usr/local/Cellar/rakudo-star/2017.01/share/perl6
CORE:ver('6.c'):auth('perl')
#	CompUnit::Repository::Staging
#	NativeCall
#	NativeCall::Compiler::GNU
#	NativeCall::Compiler::MSVC
#	NativeCall::Types
#	Pod::To::Text
#	TAP
#	Test
#	experimental
#	newline
```

## インストールされたファイルの場所

たとえば、`LWP::Simple`モジュールはどこか というとき。

```text
$ zef locate LWP::Simple
```

## ホストされているモジュール一覧

```text
$ zef list
```

## ホストされているモジュールの検索

たとえば `MongoDB` というモジュールがあるか調べるとき。

```text
$ zef search MongoDB
===> Found 1 results
------------------------------------------------------------------------
ID|From                            |Package              |Description
------------------------------------------------------------------------
1 |Zef::Repository::Ecosystems<p6c>|MongoDB:ver('0.37.0')|MongoDB driver
------------------------------------------------------------------------
```

ありました。

## モジュールのインストール

たとえば`Color`というモジュールをインストールするとき。

```text
$ zef install Color
===> Searching for: Color
===> Fetching: Color
===> Testing: Color:ver('1.001001')
# Short 3-hex
# Short 4-hex
# Full 6-hex
t/01-new-key-value.t .........1/?# Full 8-hex
# RGB tuple
# RGB tuple (decimal form)
# RGBA tuple
t/01-new-key-value.t .........4/?# RGBA tuple (decimal form)
# CMYK tuple
# HSL tuple
# HSV tuple
t/01-new-key-value.t ......... ok
# Short 3-hex
# Short 4-hex
# Full 6-hex
t/02-new-short-form.t ........1/?# Full 8-hex
# RGB tuple
# CMYK tuple
t/02-new-short-form.t ........ ok
t/03-new-overflows.t ......... ok
t/04-new-invalid.t ...........1/?# Key-value forms
t/04-new-invalid.t ........... ok
t/05-methods.t ............... ok
# Operator tests on rgb nums
# Operator tests (alpha-math turned off on rgba nums)
t/06-operators.t .............1/?# Try again with enabled alpha math
# Try again with enabled alpha math
# Our fancy-pants unicode ops
t/06-operators.t ............. ok
t/07-bugs-and-regressions.t .. ok
All tests successful.
Files=7, Tests=62,  13 wallclock secs
Result: PASS
===> Testing [OK] for Color:ver('1.001001')
===> Installing: Color:ver('1.001001')
```

## おわり

おわりです:whale:

## 参考と注釈

* [Perl 6 Modules](https://modules.perl6.org/)
* [Perl6のモジュールインストール(panda版)](http://qiita.com/B73W56H84/items/9fbaad672e16ea61640c)