12 marzo 2015

Cómo instalar módulos de Perl vía CPAN

CPAN (Comprehensive Perl Archive Network) es una gran colección de software y documentación PERL, que permite de un modo extremadamente sencillo la instalación de módulos Perl.

El modo de instalación es bastante sencillo, en primera instancia, lanza como root el siguiente comando para seguir un asistente con una serie de preguntas bastante intuitivas y que en principio, con los parámetros que sugieren es posible seguir la instalación:

root@gostir (32bit):~# perl -MCPAN -e shell

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]

Autoconfigured everything but 'urllist'.

Now you need to choose your CPAN mirror sites.  You can let me
pick mirrors for you, you can select them from a list or you
can enter them by hand.

Would you like me to automatically choose some CPAN mirror
sites for you? (This means connecting to the Internet) [yes]
Trying to fetch a mirror list from the Internet
Fetching with HTTP::Tiny:
http://www.perl.org/CPAN/MIRRORED.BY

Looking for CPAN mirrors near you (please be patient)
........................ done!

New urllist
  http://cpan.mmgdesigns.com.ar/
  http://cpan.kinghost.net/
  http://linorg.usp.br/CPAN/

Autoconfiguration complete.

commit: wrote '/root/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.00)
Enter 'h' for help.

cpan[1]>


Una vez finalizadas las preguntas, automáticamente llegaremos a la consola de CPAN a través de la cual podemos instalar módulos de forma sencilla:

cpan[1]> install MODULE::NAME

ejemplo:

cpan[1]> install Date::Calc

Una vez hecho esto, CPAN automáticamente compilará el módulo.
Por supuesto, podemos instalar CPAN2TGZ de un modo rápido y sencillo si no estuviera instalado por defecto, para empaquetar el modulo que queramos e instalarlo directamente como paquete:

vampii@gostir:[~]$ cpan2tgz
bash: cpan: no se encontró la orden

root@gostir:[~]# slapt-get --install cpan2tgz

Basado en: http://rm-rf.es/como-instalar-modulos-de-perl-via-cpan/

No hay comentarios:

Publicar un comentario