Para usar o
CPAN, no shell root e digite:
# perl -MCPAN -e shell
Para atualizar o CPAN e instalar alguns
módulos extras, que farão com que o mesmo trabalhe melhor, execute:
cpan[*]>
install Bundle::CPAN
Que, no meu caso, apresentou a seguinte lista:
Reading '/root/.cpan/Metadata'
Database was generated on Tue, 21 Apr 2015 22:41:02 GMT
ExtUtils::MakeMaker is up to date (7.04).
Test::Harness is up to date (3.35).
ExtUtils::CBuilder is up to date (0.280220).
File::Temp is up to date (0.2304).
Test::More is up to date (1.001014).
Data::Dumper is up to date (2.154).
IO::Compress::Base is up to date (2.068).
Compress::Zlib is up to date (2.068).
IO::Zlib is up to date (1.10).
Archive::Tar is up to date (2.04).
Module::Build is up to date (0.4211).
File::Spec is up to date (3.47).
Digest::SHA is up to date (5.95).
File::HomeDir is up to date (1.00).
Archive::Zip is up to date (1.46).
Net::FTP is up to date (3.06).
Term::ReadKey is up to date (2.32).
Term::ReadLine::Perl is up to date (1.0303).
YAML is up to date (1.15).
Parse::CPAN::Meta is up to date (1.4414).
Text::Glob is up to date (0.09).
CPAN is up to date (2.10).
File::Which is up to date (1.16).
cpan[*]>
Se quiser também, instale o módulo "Bundle::CPANxxl", mas antes veremos como pesquisar por módulos, digite aí no seu shell CPAN:
cpan[*]>
i Bundle::CPANxxl
Que apresentou o seguinte:
cpan[*]> i Bundle::CPANxxl
Checksum for /root/.cpan/sources/authors/id/A/AN/ANDK/Bundle-CPAN-1.861.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE
Bundle id = Bundle::CPANxxl
CPAN_USERID ANDK (Andreas J. Koenig <andreas.koenig.7os6vvqr@franz.ak.mind.de>)
CPAN_VERSION 0.3
CPAN_FILE A/AN/ANDK/Bundle-CPAN-1.861.tar.gz
UPLOAD_DATE 2012-03-02
MANPAGE Bundle::CPANxxl - Bundle with a few more components than Bundle::CPAN
CONTAINS YAML::Syck IO::Tty Expect YAML Bundle::CPAN Module::Signature CPAN::Reporter Kwalify
INST_FILE /root/.cpan/Bundle/CPANxxl.pm
INST_VERSION 0.3
cpan[*]>
Então, vamos instalá-lo (vejam somente as partes inicial e final do log):
cpan[*]>
install Bundle::CPANxxl
Running install for module 'YAML::Syck'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/T/TO/TODDR/YAML-Syck-1.29.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/T/TO/TODDR/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/T/TO/TODDR/YAML-Syck-1.29.tar.gz ok
Configuring T/TO/TODDR/YAML-Syck-1.29.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for YAML::Syck
Writing MYMETA.yml and MYMETA.json
TODDR/YAML-Syck-1.29.tar.gz
/usr/bin/perl5.18.1 Makefile.PL -- OK
Running make for T/TO/TODDR/YAML-Syck-1.29.tar.gz
....
....
/usr/bin/make install -- OK
ExtUtils::MakeMaker is up to date (7.04).
Test::Harness is up to date (3.35).
ExtUtils::CBuilder is up to date (0.280220).
File::Temp is up to date (0.2304).
Test::More is up to date (1.001014).
Data::Dumper is up to date (2.154).
IO::Compress::Base is up to date (2.068).
Compress::Zlib is up to date (2.068).
IO::Zlib is up to date (1.10).
Archive::Tar is up to date (2.04).
Module::Build is up to date (0.4211).
File::Spec is up to date (3.47).
Digest::SHA is up to date (5.95).
File::HomeDir is up to date (1.00).
Archive::Zip is up to date (1.46).
Net::FTP is up to date (3.06).
Term::ReadKey is up to date (2.32).
Term::ReadLine::Perl is up to date (1.0303).
YAML is up to date (1.15).
Parse::CPAN::Meta is up to date (1.4414).
Text::Glob is up to date (0.09).
CPAN is up to date (2.10).
File::Which is up to date (1.16).
cpan[*]>
Ao término da instalação, reinicie o CPAN com:
cpan[*]>
reload cpan
E veja:
cpan[*]>
reload cpan
(CPAN__unchanged__v2.10)(CPAN::Author__unchanged__v5.5002)(CPAN::CacheMgr__unchanged__v5.5002)(CPAN::Complete__unchanged__v5.5001)(CPAN::Debug__unchanged__v5.5001)(CPAN::DeferredCode__unchanged__v5.50)(CPAN::Distribution__unchanged__v2.04)(CPAN::Distroprefs__unchanged__v6.0001)(CPAN::Distrostatus__unchanged__v5.5)(CPAN::Exception::RecursiveDependency..v5.5)(CPAN::Exception::yaml_not_installed..v5.5)(CPAN::FTP__unchanged__v5.5006)(CPAN::FTP::netrc__unchanged__v1.01)(CPAN::HandleConfig__unchanged__v5.5006)(CPAN::Index__unchanged__v1.9601)(CPAN::InfoObj__unchanged__v5.5)(CPAN::LWP::UserAgent....v1.9601)(CPAN::Module__unchanged__v5.5002)(CPAN::Prompt__unchanged__v5.5)(CPAN::Queue__unchanged__v5.5002)(CPAN::Shell__unchanged__v5.5005)(CPAN::Tarzip__unchanged__v5.5012)(CPAN::Version__unchanged__v5.5003)
8 subroutines redefined
cpan[*]>
Aproveitemos também para pesquisar por termos, strings, módulos etc, como por exemplo o módulo "APT.pm":
cpan[*]>
i /APT.pm/
Cujo resultado foi esse:
cpan[*]>
i /APT.pm/
Distribution JKUTEJ/Alien-Debian-Apt-PM-0.03.tar.gz
Distribution JKUTEJ/Debian-Apt-PM-0.09.tar.gz
2 items found
cpan[*]>
readme Apt::PM
Com o comando acima, podemos ler o README do módulo citado (veja apenas uma parte dele):
NAME
Debian::Apt::PM - locate Perl Modules in Debian repositories
NOTE
Needs following extra Debian packages `libdpkg-perl' and `libapt-pkg-perl'.
SYNOPSIS
command line:
apt-pm update
apt-pm find Moose
dpkg-scanpmpackages /path/to/debian/repository
# print out all dependencies of an unpacked distribution that are pa
ckaged for Debian
perl -MDebian::Apt::PM -MModule::Depends -le \
'$apm=Debian::Apt::PM->new();$md=Module::Depends->new->dist_
dir(".")->find_modules; %r=(%{$md->requires},%{$md->build_requires}); while (($m
, $v) = each %r) { $f=$apm->find($m, $v); print $f->{"min"}->{"package"} if $f->
{"min"} }' \
| sort \
| uniq \
cpan[*]>
Para sair do shell CPAN, use:
cpan[*]>
exit
# exit
exit
Diferentemente das partes subsequentes, as partes 1, 2 e 3 deste artigo não foram publicadas em meu blog, fiz um ajuntado do que fora publicado lá, para fazer publicar num único artigo aqui. Ao final de cada página a seguir, estará o link da postagem original.
Continua...