3. The distribution perl is not what you
think it is
For Debian Perl 5.14
$ /usr/bin/perl -V | grep DEBPKG | wc -l
57
4. The distribution perl is not what you
think it is
http://perlbuzz.com/2008/08/red-hats-patch-slows-down-overloading-in-perl.
html
Some investigation revealed that there’s a long standing bug in Redhat Perl that
causes *severe* performance degradation on code that uses the bless/overload
combo. The thread on this is here:
https://bugzilla.redhat.com/show_bug.cgi?id=379791
5. The distribution perl is not what you
think it is
http://perlbuzz.com/2008/08/red-hats-patch-slows-down-overloading-in-perl.
html
Some investigation revealed that there’s a long standing bug in Redhat Perl that
causes *severe* performance degradation on code that uses the bless/overload
combo. The thread on this is here:
https://bugzilla.redhat.com/show_bug.cgi?id=379791
6. Compile my own perl? Hard???
In the olden days it could be a challenge
7. Compile my own perl: Now
No need for root!
You only need compiler (and libs)
apt-get install build-essential
Now you choose: perlbrew / plenv
I’ll use plenv today… (like it more)
9. A Word of Caution
#!/usr/bin/perl is soooooooooooo 2010…
#!/usr/bin/env perl is the new #!/usr/bin/perl
It’ll help your programs find the correct perl!
10. Switching perls
(At the directory level)
plenv global 5.16.2
cd project1
plenv local 5.14.0
./my_project
12. Carton
cpanm Carton
vi cpanfile
requires ‘Module1’;
requires ‘Module2’;
carton install
# Magic happens… All modules get installed
# Also generates a cpanfile.snapshot with all modules and versions
installed
carton exec ./my_project
13. Trick
carton exec $SHELL –l
#Perl will find your modules
without invoking carton
15. Handling failures
Look at the log
Normally some headers missing
DBD::mysql requires libmysqlclient-dev to be installed (Debian/Ubuntu)
SSL related modules usually require OpenSSL: libssl-dev (Debian/Ubuntu)
Some XML related modules require libexpat1-dev libxml2-dev
Find a missing .h file in the compiler errors, and find which package it belongs to
Rinse and Repeat “carton install”
16. BUNDLE!!!
carton bundle
- Look at your vendor/cache dir!
- Look at vendor/bin!
./vendor/bin/carton (fat packed version)
I personally add the vendor directory to version control
Smells like we get repeatable
17. DEPLOY!!!
carton install
# install all modules that don’t meet cpanfile requirements
carton install --deployment
# installs all versions from cpanfile.snapshot
carton install --deployment --cached
# installs versions from the vendor/cache
18. Conclusions
plenv controls your Perl version
carton controls your dependencies
Enables
Repeatablility
Independant interpreters for different needs (think of microservices)
Testing new versions
Using up-to-date modules with no fear of CPAN breakage