the modern perl toolchain
DESCRIPTION
Tema: The modern perl toolchainCurso de Perl avanzado Barcelona.pm 2012TRANSCRIPT
![Page 1: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/1.jpg)
The Modern
Perl Toolchain
![Page 2: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/2.jpg)
Cómo conseguir Perl
Hay gente que nunca ha instalado Perl– Viene preinstalado en casi todos los
sabores de *N?X
![Page 3: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/3.jpg)
El mundo *N?X tradicional
Paquetes
Compilado a mano
Paquetes
CPAN
A mano
![Page 4: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/4.jpg)
Perl paquetes + Módulos paquetes
PROS• Buena estabilidad• Instalación fácil (e
integrada con el SO)
CONS• Perls antiguos• Módulos antiguos• Alguna distribución
gamberra
![Page 5: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/5.jpg)
Perl paquetes + Modulos CPAN
PROS• Bleeding edge• Instalación fácil
CONS• Perls antiguos• Alguna distribución
gamberra• Peligro de cargarte
módulos del sistema
![Page 6: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/6.jpg)
Perl paquetes + CPAN a mano
PROS• Bleeding edge
CONS• Perls antiguos• Alguna distribución
gamberra• Peligro de cargarte
módulos del sistema• A mano!!!
![Page 7: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/7.jpg)
Modern
Paquetes
Perlbrew
Compilado a mano
Paquetes
local::lib
CPAN
A mano
![Page 8: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/8.jpg)
Perlbrew + local::lib
PROS• Bleeding edge• Personalizar
compilación• Entorno aislado
CONS• Entornos no
reproducibles
![Page 9: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/9.jpg)
Windows
• ActivePerl– PPM -> Paquetes
precompilados de modulos de CPAN
– No CPAN
• Strawberry Perl– CPAN
![Page 10: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/10.jpg)
Perlbrew
perlbrew.pl
admin-free perl installation
management tool
![Page 11: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/11.jpg)
Perlbrew - instalación
monger@onion:~$ wget --no-check-certificate -O - http://install.perlbrew.pl | bash
monger@onion:~$ source ~/perl5/perlbrew/etc/bashrc
![Page 12: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/12.jpg)
Perlbrew - uso
monger@onion:~$ perlbrew available perl-5.15.8 perl-5.14.2 perl-5.12.4 perl-5.10.1 perl-5.8.9 perl-5.6.2 perl5.005_04 perl5.004_05 perl5.003_07
![Page 13: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/13.jpg)
Perlbrew – instalar un perl
monger@onion:~$ perlbrew install perl-5.14.2monger@onion:~$ perlbrew available perl-5.15.8i perl-5.14.2 perl-5.12.4 perl-5.10.1 perl-5.8.9 perl-5.6.2 perl5.005_04 perl5.004_05 perl5.003_07
![Page 14: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/14.jpg)
Perlbrew – instalar un perl
monger@onion:~$ perlbrew list perl-5.14.2monger@onion:~$ perlbrew switch perl-5.14.2monger@onion:~$ perlbrew list* perl-5.14.2monger@onion:~$ perlbrew use perl-5.14.2
![Page 15: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/15.jpg)
Perlbrew – instalar un perl
#!/usr/bin/perl
#!/usr/bin/env perl
![Page 16: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/16.jpg)
Perlbrew – local::lib
monger@onion:~$ perlbrew lib perl-5.14.2@curso lib 'perl-5.14.2@curso' is created.monger@onion:~$ perlbrew list* perl-5.14.2 perl-5.14.2@cursomonger@onion:~$ perlbrew use perl-5.14.2@cursomonger@onion:~$ perlbrew list perl-5.14.2* perl-5.14.2@curso
![Page 17: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/17.jpg)
Dist::Zilla
monger@onion:~$ cpanm Dist::Zilla …monger@onion:~$ dzill setupmonger@onion:~$ dzill new App::Cursomonger@onion:~$ dzill clean
Y ya se puede empezar!
![Page 18: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/18.jpg)
Dist::Zilla
Opciones útiles:
monger@onion:~$ dzill run bash
monger@onion:~$ dzill test
monger@onion:~$ dzil authordeps|cpanm
![Page 19: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/19.jpg)
Cómo conseguir módulos
Ya tenemos Perl instalado. Y ahora, ¿cómo conseguimos los módulos que necesitamos?
![Page 20: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/20.jpg)
Cómo conseguir módulos
monger@onion:~$ perlbrew install-cpanmmonger@onion:~$ cpanm Date::Holidays::CA_ES
![Page 21: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/21.jpg)
Herramientas de la comunidad
![Page 22: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/22.jpg)
CPAN: Comprehensive Perl Archive Network
cpan.orgsearch.cpan.orgmetacpan.org
![Page 23: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/23.jpg)
CPAN: Comprehensive Perl Archive Network
104.551 módulos de Perlen
24.391 distribucionesescritos por
9.569 autoresy replicado en
268 servidores
![Page 24: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/24.jpg)
CPAN Testers
cpantesters.org
![Page 25: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/25.jpg)
Bugsrt.cpan.org
![Page 26: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/26.jpg)
¿Cómo contribuir?
Publicando módulos (http://pause.perl.org)
Participando en perlmonks.orgContribuyendo a módulos existentes
Reportando (y arreglando) bugsRealizando tests
Participando en la lista de mongers local…
![Page 27: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/27.jpg)
Módulos interesantes - Core
CGIData::Dumper
File::*FindBin
Getopt::LongNet::*
![Page 28: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/28.jpg)
Módulos interesantes
Template::ToolkitData::PrinterNet::Server
CatalystMojoliciousDBIx::Class
PlackLWP
WWW::Mechanize
Hemos dicho que hay casi 25.000 distribuciones?
![Page 29: The modern perl toolchain](https://reader036.vdocuments.net/reader036/viewer/2022062419/558a399bd8b42aa51d8b46ac/html5/thumbnails/29.jpg)
Ejercicios
1. Instalar un perl 5.14.2 con perlbrew1. Hacer un script que diga “Hello World!” y el
intérprete de perl que lo ha ejecutado
2. Instalar Mojolicious en un local::lib llamado mojo
3. Instalar Catalyst, DBI, DBIx::Class y DBD::Sqlite en un local::lib llamado catalyst
4. Crear un nuevo modulo con Dist::Zilla1. Instalar el modulo con cpanm