Comprehensive Perl Archive Network
collection centralisée et distribuée de modules
21 Go, plus de 33 mille distributions, plus de 12 mille auteurs
241 miroirs
« CPAN is the language, Perl is just its syntax » — Audrey Tang
véritable richesse de Perl
connaître les bons modules
CPAN Search — http://search.cpan.org/
écrit par Graham Barr
longtemps le site de référence
mais code pas libre
CPAN Search Lite
écrit par Randy Kobes
alternative libre à CPAN Search
MetaCPAN — https://metacpan.org/
nouveau site de référence
séparé en une API et un site web
permet d'écrire ses propres interfaces
cpan
le shell classique d'installation
fournit en standard
un peu vieillot mais toujours efficace
cpanp
(CPANPLUS)
devait être plus mieux
cpanm
(cpanminus)
simple, léger, rapide
bonus : permet d'installer depuis un dépôt Git
version autonome :
curl -L https://cpanmin.us/ -o cpanm
liste de modules
vaguement regroupés par thème
disparate, pas exhaustif
mais un point de départ
List::Util
first max maxstr min minstr reduce sum shuffle uniq
List::MoreUtils
any all none notall one apply each_array natatime pairwise mesh zip uniq distinct minmax ...
Sort::Key
, ::Natural
, ::Radix
, ::OID
, ::IPv4
, ::DateTime
...
Hash::Merge
Regexp::Common
while (<>) { /$RE{num}{real}/ and print "got a number"; /$RE{net}{IPv4}/ and print "got an IP address"; }
Regexp::Assemble
my $ra = Regexp::Assemble->new; $ra->add( "cra+ck", "cru+nch", "clu+n+ck" ); print $ra->re; # "(?-xism:c(?:r(?:u+nch|a+ck)|lu+n+ck))"
Text::Match::FastAlternatives
join "|", @words
en bien plus efficace
Date::Parse
$date = "Wed, 9 Nov 1994 09:50:32 -0500"; $time = str2time($date); ($sec, $min, $hour, $day, $month, $year, $zone) = strptime($date);
Time::Duration
duration(130) => "2 minutes and 10 seconds"; ago(243550) => "2 days and 20 hours ago"; ago(243550, 1) => "3 days ago";
existe en français, Time::Duration::fr
duration(130) => "2 minutes et 10 secondes"; ago(243550) => "il y a 2 jours et 20 heures"; ago(243550, 1) => "il y a 3 jours";
DateTime
DateTime::Set
, DateTime::Span
DateTime::Calendar::
Chinese, Christian, Coptic, FrenchRevolutionary,
Hebrew, Japanese, Mayan, Pataphysical
bignum
, bigint
, bigrat
PDL (Perl Data Language == MatLab en Perl)
Archivage
Archive::Tar
, Archive::Zip
IO::Compress
(::Zip
, ::Gzip
, ::Bzip2
, ::Lzf
,
::Lzop
, ::Lzma
, ::Xz
)
Chemins
File::Spec
, Path::Class
File::Find::Rule
, File::Next
, File::Wildcard
File::HomeDir
, File::ShareDir
Contenu
File::Slurper
, File::Tail
, File::Temp
Encode
Deep::Encode
Unicode::Casing
, Unicode::Normalize
,
Unicode::LineBreak
, Unicode::GCString
Unicode::Tussle
Unicode::Debug
/ Devel::Unicode
Text::Unidecode
Data::Fake
, Data::Random
Data::Pwgen
, Text::Password::Pronounceable
Getopt::Long
Pod::Usage
my %options = ( debug => 0, ); GetOptions(\%options, qw{ help|h! version|V! debug|d! config|c=s }) or pod2usage(0); pod2usage({ -verbose => 2, -exitval => 0, -noperldoc => 1 }) if $options{help};
Proc::Daemon
, Proc::UID
Proc::Background
, Proc::ProcessTable
IPC::Run
my @cmd = qw< ps auwx >; run \@cmd, \$input, \$output, \$errors or die "$cmd[0]: $?";
my @cmd1 = qw< ps auwx >; my @cmd2 = qw< grep perl >; run \@cmd1, "|", \@cmd2, \$output;
Moops
use Moops; role NamedThing { has name => (is => "ro", isa => Str); } class Person with NamedThing; class Company with NamedThing; class Employee extends Person { has job_title => (is => "rwp", isa => Str); has employer => (is => "rwp", isa => InstanceOf["Company"]); method change_job ( Object $employer, Str $title ) { $self->_set_job_title($title); $self->_set_employer($employer); } }
XML::Parser
XML::LibXML
, XML::LibXSLT
my $parser = XML::LibXML->new; my $doc = $parser->parse_file($file); my ($node) = $doc->findnodes("/root/path/node[1]");
XML::SAX
, XML::Twig
XML::Tiny
, XML::TreePP
Data::Dumper
, Storable
YAML
, YAML::XS
YAML::DumpFile($file, \%complex_structure); my $struct = YAML::LoadFile($file);
JSON
, JSON::XS
, JSON::Tiny
my $struct = from_json( $request->content_decoded ); $response->add_content( to_json(\%data) );
BSON (Binary JSON)
CBOR (RFC 7049) — CBOR::XS
Sereal
AMF — Storable::AMF
Accès
DBI
MySQL, PostgreSQL, SQLite, Oracle, JDBC, ODBC, Sybase, ADO DB, Unify et plus encore...
DBI::Proxy
, DBD::Gofer
DBIx::Simple
DBIx::Connect::FromConfig
Abstraction du SQL
SQL::Abstract
Data::Phrasebook::SQL
DBIx::Class
Rose::DB::Object
, DBIx::DataModel
, Fey::ORM
MIME::Lite
, MIME::Parser
Net::SMTP
, Net::POP3
Email::Simple
, Email::MIME
, Email::Folder
et tous les
modules du Perl Email Project
Mail::IMAPClient
, Mail::Box
Bureautique
Text::CSV_XS
Spreadsheet::WriteExcel
, Spreadsheet::ParseExcel
OpenOffice::OODoc
, Spreadsheet::ReadSXC
Spreadsheet::Read
, Spreadsheet::Write
MsOffice::Word::HTML::Writer
PDF::API2
Images
GD
, Image::Magick
, Gimp
, Imager
PDL (Perl Data Language)
Protocoles réseau
Net::FTP
, Net::SSH
, Net::SCP
Net::DNS
, Net::Ping
, Net::DHCP
Net::LDAP
, Net::NNTP
, Net::RADIUS
Net::SMPP
, Net::SIP
, Net::STOMP
...
Net::SSLGlue
Réseau bas niveau
Net::Pcap
, Net::Frame
, Net::Packet
POE — http://poe.perl.org
AnyEvent
IO::Async
Côté client
LWP::UserAgent
, LWP::Simple
my $page = get($url);
HTML::Parser
HTML::TreeBuilder
WWW::Mechanize
WWW::Scripter
Côté serveur
CGI
CGI::Fast
CGI::Application
Génération
HTML::Template
Petal
Mason
Template Toolkit 2
PSGI / Plack — http://plackperl.org/
Mojo
Catalyst
Test::More
, Test::Builder
Devel::Cover
Test::Deep
, Test::LongString
Test::Exception
, Test::NoWarnings
Test::MockModule
, Test::MockObject
Test::Class
(xUnit)
Test::LectroTest
Module::Starter
, Dist::Zilla
ack
Perl::Tidy
Perl::Critic
Perl::Metrics::Simple
Data::Dump
, XXX
Smart::Comments
Devel::SimpleTrace
Devel::Graph
Devel::TraceLoad
, Devel::TraceUse
Devel::LeakTrace
Devel::ptkdb
: perl -d:ptkdb ...
Devel::ebug
: perl -d:ebug ...
Langages
Inline : C, Java, Python, Ruby, Tcl, Befunge, Lua
Bibliothèques externes
XS, Devel::PPPort
SWIG
P5NCI
Interfaces graphiques
Tk, Gtk, WxWidgets, Qt, Prima
OpenGL, SDL
GUI natives : Win32, X11
Pilotage natif des OS
Mac::Carbon
, Mac::Glue
Win32
, Win32::OLE
, W2RK::WMI
CPAN, c'est bon, mangez-en