CPAN
Hans Dieter Pearcey (hdp@cpan.org)
needs
- don't reinvent wheels
- keep code fresh
- be pragmatic
- some complete solutions
- some toolkit pieces
- some flying cars

human factors
- sysadmins
- managers
- yourself
sysadmins
- shouldn't have to learn Perl
- don't want to deal with install failures
- want to use tools they know
- like consistency
managers
- politics are sometimes incomprehensible
- they're still your problem
yourself
- finite amount of time & energy
- not an expert on everything
lowest common denominator
$ cpan Foo::Bar
problems
- requires root
- few management tools
- missing information:
- file list (sometimes)
- dist version
- runs tests each time
vendor packages
- "can't you just?"
- often stale
- often nonexistant
- wrong priorities
- vendor/sysadmin vs. developer
Pull from a newer version
- e.g. Debian apt preferences
apt-get install -t unstable libmoose-perl- may pull in too much
- the 5.8 -> 5.10 change
- (re)build from source packages?
- may not be available for your OS
build vendor packages
- dh-make-perl
- or something else vendor-specific
- cpan2dist
- backends for Debian, RPM, Gentoo, etc.
cpan2dist --format CPANPLUS::Dist::Gentoo Foo::Bar
caveats
- upgrading dual-life modules
- vendor versions vs. CPAN versions
- version.pm 0.74 is libversion-perl 1:0.7400
- 0.33 <=> 0.2802?
wrap site_perl (Debian)
cpan2dist --format CPANPLUS::Dist::Deb
--defaults --dist-opts distdir=`pwd`/debs
Foo::Bar
- install into site_perl
- named
cpan-libfoo-bar-perl - provides
cpan-libfoo-bar-perllibfoo-bar-perl
- automatically prefers Debian's packages
caveats
- silent conflicts with vendor packages
- site_perl > vendor in
@INC - /usr/local/bin > /usr/bin in
$PATH
- miss out on vendor QA
bonus: PAR
Foo-Bar-1.23$ make && perl -MPAR::Dist -e blib_to_par
PAR::Dist::install_par -- unpack and make install/path/to/file.parhttp://my.dist.host/file.parcpan://AUTHOR/file.par
- keeps (but does not install) META.yml
- glue potential
flying cars

- seamless use of vendor vs. auto-built packages
- richer dependencies
- external libraries
- Alien::
unsolved problems
- requires root
- per-machine, not per-application
- metaphor shear
local::lib
~$ eval $(perl -Mlocal::lib)
- gives you a private library directory
- API / glue for
- prereqs (consistancy)
- installation
use lib$PATH
default
~/perl5- shared webhost
- shared developer machine
echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)'
>> ~/.bashrc
per-application libraries
in your shell
~/code/MyApp$ eval $(perl -Mlocal::lib=./local)
in scripts/*
use FindBin ();
use local::lib "$FindBin::Bin/../local";
per-application libraries
- bundle dependencies
- rsync, tarball, etc.
- useful for:
- multiple disparate programmers or teams
- large applications with independent lifecycles
- stability / mission-criticality
- standalone applications
generate MyApp::local
make-local-lib.pl
use MyApp::local in scripts or MyApp.pm
use MyApp::local;
- or, like Catalyst scripts
use FindBin;
use lib "$FindBin::Bin/../lib";
use MyApp::local;
self-contained
~/code/MyApp$ perl
-Mlocal::lib=--self-contained,./local
-MCPAN -e 'install q(.)'
- all non-core dependencies
- note:
--self-contained affects only that process + children- no affect on the environment
- cannot be transmitted by the shell
ups and downs
- bugfixes applied per-application
- only break one application at a time
- repeated installing and testing
bonus: distroprefs
- YAML, Data::Dumper, Storable
- automate installs via CPAN.pm
- match: dist filename, module, perl version,
%Config, %ENV - change: commandlines, environment, CPAN config
- apply patches, drive Expect
distroprefs rock
- capture a dist's build process
- make it repeatable
- local::lib + distroprefs = win
flying cars

- tools for per-application local::lib
- Platypus (remedie)
- installer integration
- bundle dependencies with your dist
push @INC, File::ShareDir::dist_dir('My-Dist');
client vs. server
- so far all client-side
- seize the means of production
client vs. server
- so far all client-side
- seize the means of production distribution
mirror CPAN
cpan CPAN::Miniminicpan -l ~/cpan -r http://www.perl.org/CPAN- repeat as needed to update
- latest non-development release of every module
benefits
- speed
- network connectivity
- upgrades fit your schedule
- consistency between installs
still lacking
- fine control over upgrades
- changelog
filter / augment
- CPAN::Mini::Inject
- CPAN::Mini::Devel
- CPAN::Mini::Tested / CPxxxAN
- all of the above
flying cars

- CPAN mirror filtering tools
- test vs. internal code
- test reverse dependents
- external criteria (RT bugs, CPAN ratings, etc.)
- create CPAN mirror from Debian perl sources
bonus ideas
- vendor packages + local::lib
- automate local::lib for upgrade testing
- distribute your own perl