LIFE WITHOUT CPAN 
Reinventing the Wheel 
Bob Ernst 
BobErnstStl@gmail.com 
ST. LOUIS PERL MONGERS 
July 17, 2013 
Bob Ernst Life Without CPAN
Comprehensive Perl Archive Network 
http://www.cpan.org/ 
22,938 Perl modules (and growing!) 
10,781 authors (and growing!) 
Possibly the best feature of Perl 
... and sometimes you can't use it 
Bob Ernst Life Without CPAN
$677 Million 
In 2004, CPAN had 15.4 million lines of code, which would cost 
$677,000,000 to develop 
http://developers.slashdot.org/story/04/07/30/1229239/cpan-677-million-of-perl 
Bob Ernst Life Without CPAN
Handy tools 
cpan 
cpanm 
cpanp 
perlbrew 
Bob Ernst Life Without CPAN
Why don't people use CPAN? 
And how did I become one of them?? 
Bob Ernst Life Without CPAN
But I don't have root..." 
No root access? That is an easy one: 
us e l o c a l : : l i b ; 
Bob Ernst Life Without CPAN
Why is this so complicated?" 
CPAN often has objected-oriented Perl 
Embarrassment of riches 
More & Better module documentation couldn't hurt 
Bob Ernst Life Without CPAN
I don't have enough disk space..." 
Who doesn't have lots of disk space in 2013? 
SSD drives - fast, but small 
Raspberry Pi 
Embedded systems 
Shared hosting 
Virtual Machines 
Disk quotas 
Bob Ernst Life Without CPAN
NIH - Not Invented Here 
Pretty silly, but unfortunately common 
Bob Ernst Life Without CPAN
Security Concerns 
Some organizations are serious about security 
What company wrote this software? 
You want to connect to the internet?? 
Bob Ernst Life Without CPAN
Local Mirror & Packing 
CPAN::Mini 
CPAN::Mini::Inject 
Pinto 
Carton 
Bob Ernst Life Without CPAN
Licensing 
What is this FOSS / open source / shareware / freeware stu? 
We need to review that license... 
Sometimes it is easier to buy software 
Bob Ernst Life Without CPAN
Mix of licenses 
Most, though not all, modules on CPAN are licensed 
under the GNU Public License (GPL) or the Artistic 
license 
{ CPAN FAQ 
Bob Ernst Life Without CPAN
GPL 
The GNU Public License is a 
negative 
in some organizations 
Bob Ernst Life Without CPAN
CPAN::Meta::Spec 
agpl_3 GNU Affero General Public License, Version 3 
apache_1_1 Apache Software License, Version 1.1 
apache_2_0 Apache License, Version 2.0 
artistic_1 Artistic License, (Version 1) 
artistic_2 Artistic License, Version 2.0 
bsd BSD License (three-clause) 
freebsd FreeBSD License (two-clause) 
gfdl_1_2 GNU Free Documentation License, Version 1.2 
gfdl_1_3 GNU Free Documentation License, Version 1.3 
gpl_1 GNU General Public License, Version 1 
gpl_2 GNU General Public License, Version 2 
gpl_3 GNU General Public License, Version 3 
lgpl_2_1 GNU Lesser General Public License, Version 2.1 
lgpl_3_0 GNU Lesser General Public License, Version 3.0 
mit MIT (aka X11) License 
mozilla_1_0 Mozilla Public License, Version 1.0 
mozilla_1_1 Mozilla Public License, Version 1.1 
openssl OpenSSL License 
perl_5 The Perl 5 License (Artistic 1  GPL 1 or later) 
qpl_1_0 Q Public License, Version 1.0 
ssleay Original SSLeay License 
sun Sun Internet Standards Source License (SISSL) 
zlib zlib License 
Bob Ernst Life Without CPAN
And... 
open_source Other Open Source Initiative (OSI) approved license 
restricted Requires special permission from copyright holder 
unrestricted Not an OSI approved license, but not restricted 
unknown License not provided in metadata 
May be hard to get approval! 
Bob Ernst Life Without CPAN
Missing licenses 
16.6% of CPAN uploads this year don't have a license in 
META.yml 
(Older modules are worse!) 
http://cpants.cpanauthors.org/kwalitee/metayml has license 
Bob Ernst Life Without CPAN
Get the modules without CPAN 
Perhaps you have access to another source of modules that is 
already approved 
ActiveState Perl's PPO 
Linux package installer (yum, apt, etc.) 
Bob Ernst Life Without CPAN
This stu is broken! 
Perl  CPAN have a strong culture of quality and testing... But 
there are buggy modules 
Look for recommended modules 
http://cpanratings.perl.org/ 
Check outstanding bug list for modules 
Report the bug! 
Fix the bug yourself (and share the patch) 
Fork the module 
Bob Ernst Life Without CPAN
Who am I going to call for support? 
Submit a bug report 
IRC 
Perl Monks 
Stack Over
ow 
Mailing lists 
ActiveState 
Bob Ernst Life Without CPAN
Deploying to Production 
No internet access (in secure environments) 
Slow installs 
Missing dependencies 
Broken installs 
Bob Ernst Life Without CPAN
Building on Quicksand 
CPAN modules typically have dependencies, modules are updated 
all the time 
A
x in one module might break the module you are counting on! 
Bob Ernst Life Without CPAN
Make it solid 
perlbrew to get the right version of Perl 
CPAN::Mini to get the right version of everything else 
Bob Ernst Life Without CPAN
You've fought the political battle and lost... 
What do you do? 
Bob Ernst Life Without CPAN
Reinvent the Wheel 
Bob Ernst Life Without CPAN
You aren't alone 
If you google XYZ Perl, you'll
nd a lot of questions like: 
How do I XYZ in Perl without using CPAN? 
Bob Ernst Life Without CPAN
XML Parsing 
Writing an XML parser is hard work 
XML isn't a regular language so it can't be parsed with 
regular expressions 
But in a pinch... 
i f ( $ i n p u t =~ qr f ( t i t l e ) ( .  ) (/ t i t l e ) gx 
) f 
$ t i t l e = $2 ; 
g 
Bob Ernst Life Without CPAN
Date and Time 
Date::Manip and Date::Calc are so powerful... 
what to do when they aren't available? 
Bob Ernst Life Without CPAN
The Next Eight Sundays (Date::Calc) 
us e Date : : Cal c qw( Add De l ta Days Da t e t o Te x t 
Day of Week Today ) ; 
my @date = Today ( ) ; 
my $ d a y s u n t i l s u n d a y = 7  Day of Week ( @date 
) ; 
i f ( $ d a y s u n t i l s u n d a y == 0 ) f 
$ d a y s u n t i l s u n d a y = 7 ; 
g 
f o r ( my $ i =0; $i 8; $ i++ ) f 
@date = Add De l ta Days ( @date , 
$ d a y s u n t i l s u n d a y ) ; 
say Da t e t o Te x t ( @date ) ; 
$ d a y s u n t i l s u n d a y = 7 ; 
g 
Bob Ernst Life Without CPAN
The Next Eight Sundays (POSIX) 
us e POSIX qw( mktime s t r f t ime ) ; 
us e c o n s t a n t f 
MDAY = 3 , 
WDAY = 6 , 
g ; 
my @date = l o c a l t ime ( t ime ( ) ) ; 
f o r (my $ i =0; $i 8; $ i++) f 
$dat e [MDAY] += 7  $dat e [WDAY] ; 
@date = l o c a l t ime ( mktime ( @date ) ) ; 
say s t r f t ime ( %a %d%b%Y , @date ) ; 
g 
Bob Ernst Life Without CPAN
Parallel Processing 
Modules like Parallel::Queue are great... 
if you have CPAN. 
Bob Ernst Life Without CPAN
Old Fashion Fork 
our @c h i l d r e n = ( ) ; 
sub spawn command f 
my $command = s h i f t ; 
my $pid = f o r k ( ) ; 
i f ( $pid ) f 
push @c h i l d r e n , $pid ; 
g 
e l s i f ( $pid == 0 ) f 
sys tem ( @f$commandg ) ; 
e x i t 0 ; 
g 
g 
Bob Ernst Life Without CPAN
Fork continued 
f o r ( my $ i =1; $ i = 5 2 ; $ i++ ) f 
spawn command ( [ what e v e r  , $ i ] ) ; 
g 
f o r e a c h my $pid ( @c h i l d r e n ) f 
wa i t p i d ( $pid , 0 ) ; 
g 
Bob Ernst Life Without CPAN

More Related Content

PPTX
Qt Translations
PPT
PHP-FIG: Past, Present and Future
PDF
What we can learn from Rebol?
PDF
Understanding PyPy - PyConEs 14
PDF
Introduction to Programming in Go
PDF
Bash in theory and in practice - part one
PPT
Douglas Crockford Presentation Jsonsaga
PPT
Jsonsaga
Qt Translations
PHP-FIG: Past, Present and Future
What we can learn from Rebol?
Understanding PyPy - PyConEs 14
Introduction to Programming in Go
Bash in theory and in practice - part one
Douglas Crockford Presentation Jsonsaga
Jsonsaga

What's hot (16)

PDF
Bash in theory and in practice - part two
PDF
DO YOU WANT TO USE A VCS
PPT
The JSON Saga
PDF
Hits For Kids Pop Party Vol. 2
PDF
PyCon 2013 : Scripting to PyPi to GitHub and More
PDF
Ruby on rails, 4 code smells : un guide de simplification
PDF
10 more-things-you-can-do-with-python
PPT
TAUS USER CONFERENCE 2009, Normalization of translation memories
PDF
Learning Python from Data
PDF
pyconjp2015_talk_Translation of Python Program__
PDF
Why Python (for Statisticians)
PDF
Intro to Python
PDF
Simple Data Engineering in Python 3.5+ — Pycon.DE 2017 Karlsruhe — Bonobo ETL
PDF
Hitchikers guide handout
ODP
Embed--Basic PERL XS
PDF
Using TypeScript at Dashlane
Bash in theory and in practice - part two
DO YOU WANT TO USE A VCS
The JSON Saga
Hits For Kids Pop Party Vol. 2
PyCon 2013 : Scripting to PyPi to GitHub and More
Ruby on rails, 4 code smells : un guide de simplification
10 more-things-you-can-do-with-python
TAUS USER CONFERENCE 2009, Normalization of translation memories
Learning Python from Data
pyconjp2015_talk_Translation of Python Program__
Why Python (for Statisticians)
Intro to Python
Simple Data Engineering in Python 3.5+ — Pycon.DE 2017 Karlsruhe — Bonobo ETL
Hitchikers guide handout
Embed--Basic PERL XS
Using TypeScript at Dashlane
Ad

Similar to Life without CPAN (20)

PDF
CPANci: Continuous Integration for CPAN
PPTX
In the desert, without a camel
PDF
21st Century CPAN Testing: CPANci
PDF
Searching CPAN Offline
PDF
Perl University: Getting Started with Perl
PDF
CPAN Training
PDF
MyCPAN ( LA.pm, September 2007 )
KEY
Modern Commandline Tool
ODP
Why do so many companies ...
PDF
Managing Perl Installations: A SysAdmin's View
PDF
Perl for System Automation - 01 Advanced File Processing
ODP
30 Minutes To CPAN
PDF
Perl Myths 200802 with notes (OUTDATED, see 200909)
PDF
Managing Modules Without Going Crazy (NPW 2007)
PDF
Perl Myths 200909
PDF
perlbrew yapcasia 2010
PDF
Perl Development Environment Tooling
PDF
Perl Programming - 01 Basic Perl
PDF
Modern Perl for the Unfrozen Paleolithic Perl Programmer
PPT
perlall
CPANci: Continuous Integration for CPAN
In the desert, without a camel
21st Century CPAN Testing: CPANci
Searching CPAN Offline
Perl University: Getting Started with Perl
CPAN Training
MyCPAN ( LA.pm, September 2007 )
Modern Commandline Tool
Why do so many companies ...
Managing Perl Installations: A SysAdmin's View
Perl for System Automation - 01 Advanced File Processing
30 Minutes To CPAN
Perl Myths 200802 with notes (OUTDATED, see 200909)
Managing Modules Without Going Crazy (NPW 2007)
Perl Myths 200909
perlbrew yapcasia 2010
Perl Development Environment Tooling
Perl Programming - 01 Basic Perl
Modern Perl for the Unfrozen Paleolithic Perl Programmer
perlall
Ad

Recently uploaded (20)

PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Chapter 5: Probability Theory and Statistics
PPT
What is a Computer? Input Devices /output devices
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Hindi spoken digit analysis for native and non-native speakers
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Five Habits of High-Impact Board Members
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
A contest of sentiment analysis: k-nearest neighbor versus neural network
Getting Started with Data Integration: FME Form 101
Chapter 5: Probability Theory and Statistics
What is a Computer? Input Devices /output devices
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Enhancing emotion recognition model for a student engagement use case through...
A review of recent deep learning applications in wood surface defect identifi...
Hindi spoken digit analysis for native and non-native speakers
Benefits of Physical activity for teenagers.pptx
1 - Historical Antecedents, Social Consideration.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
A novel scalable deep ensemble learning framework for big data classification...
Five Habits of High-Impact Board Members
Zenith AI: Advanced Artificial Intelligence
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
CloudStack 4.21: First Look Webinar slides
Web Crawler for Trend Tracking Gen Z Insights.pptx

Life without CPAN

  • 1. LIFE WITHOUT CPAN Reinventing the Wheel Bob Ernst BobErnstStl@gmail.com ST. LOUIS PERL MONGERS July 17, 2013 Bob Ernst Life Without CPAN
  • 2. Comprehensive Perl Archive Network http://www.cpan.org/ 22,938 Perl modules (and growing!) 10,781 authors (and growing!) Possibly the best feature of Perl ... and sometimes you can't use it Bob Ernst Life Without CPAN
  • 3. $677 Million In 2004, CPAN had 15.4 million lines of code, which would cost $677,000,000 to develop http://developers.slashdot.org/story/04/07/30/1229239/cpan-677-million-of-perl Bob Ernst Life Without CPAN
  • 4. Handy tools cpan cpanm cpanp perlbrew Bob Ernst Life Without CPAN
  • 5. Why don't people use CPAN? And how did I become one of them?? Bob Ernst Life Without CPAN
  • 6. But I don't have root..." No root access? That is an easy one: us e l o c a l : : l i b ; Bob Ernst Life Without CPAN
  • 7. Why is this so complicated?" CPAN often has objected-oriented Perl Embarrassment of riches More & Better module documentation couldn't hurt Bob Ernst Life Without CPAN
  • 8. I don't have enough disk space..." Who doesn't have lots of disk space in 2013? SSD drives - fast, but small Raspberry Pi Embedded systems Shared hosting Virtual Machines Disk quotas Bob Ernst Life Without CPAN
  • 9. NIH - Not Invented Here Pretty silly, but unfortunately common Bob Ernst Life Without CPAN
  • 10. Security Concerns Some organizations are serious about security What company wrote this software? You want to connect to the internet?? Bob Ernst Life Without CPAN
  • 11. Local Mirror & Packing CPAN::Mini CPAN::Mini::Inject Pinto Carton Bob Ernst Life Without CPAN
  • 12. Licensing What is this FOSS / open source / shareware / freeware stu? We need to review that license... Sometimes it is easier to buy software Bob Ernst Life Without CPAN
  • 13. Mix of licenses Most, though not all, modules on CPAN are licensed under the GNU Public License (GPL) or the Artistic license { CPAN FAQ Bob Ernst Life Without CPAN
  • 14. GPL The GNU Public License is a negative in some organizations Bob Ernst Life Without CPAN
  • 15. CPAN::Meta::Spec agpl_3 GNU Affero General Public License, Version 3 apache_1_1 Apache Software License, Version 1.1 apache_2_0 Apache License, Version 2.0 artistic_1 Artistic License, (Version 1) artistic_2 Artistic License, Version 2.0 bsd BSD License (three-clause) freebsd FreeBSD License (two-clause) gfdl_1_2 GNU Free Documentation License, Version 1.2 gfdl_1_3 GNU Free Documentation License, Version 1.3 gpl_1 GNU General Public License, Version 1 gpl_2 GNU General Public License, Version 2 gpl_3 GNU General Public License, Version 3 lgpl_2_1 GNU Lesser General Public License, Version 2.1 lgpl_3_0 GNU Lesser General Public License, Version 3.0 mit MIT (aka X11) License mozilla_1_0 Mozilla Public License, Version 1.0 mozilla_1_1 Mozilla Public License, Version 1.1 openssl OpenSSL License perl_5 The Perl 5 License (Artistic 1 GPL 1 or later) qpl_1_0 Q Public License, Version 1.0 ssleay Original SSLeay License sun Sun Internet Standards Source License (SISSL) zlib zlib License Bob Ernst Life Without CPAN
  • 16. And... open_source Other Open Source Initiative (OSI) approved license restricted Requires special permission from copyright holder unrestricted Not an OSI approved license, but not restricted unknown License not provided in metadata May be hard to get approval! Bob Ernst Life Without CPAN
  • 17. Missing licenses 16.6% of CPAN uploads this year don't have a license in META.yml (Older modules are worse!) http://cpants.cpanauthors.org/kwalitee/metayml has license Bob Ernst Life Without CPAN
  • 18. Get the modules without CPAN Perhaps you have access to another source of modules that is already approved ActiveState Perl's PPO Linux package installer (yum, apt, etc.) Bob Ernst Life Without CPAN
  • 19. This stu is broken! Perl CPAN have a strong culture of quality and testing... But there are buggy modules Look for recommended modules http://cpanratings.perl.org/ Check outstanding bug list for modules Report the bug! Fix the bug yourself (and share the patch) Fork the module Bob Ernst Life Without CPAN
  • 20. Who am I going to call for support? Submit a bug report IRC Perl Monks Stack Over ow Mailing lists ActiveState Bob Ernst Life Without CPAN
  • 21. Deploying to Production No internet access (in secure environments) Slow installs Missing dependencies Broken installs Bob Ernst Life Without CPAN
  • 22. Building on Quicksand CPAN modules typically have dependencies, modules are updated all the time A
  • 23. x in one module might break the module you are counting on! Bob Ernst Life Without CPAN
  • 24. Make it solid perlbrew to get the right version of Perl CPAN::Mini to get the right version of everything else Bob Ernst Life Without CPAN
  • 25. You've fought the political battle and lost... What do you do? Bob Ernst Life Without CPAN
  • 26. Reinvent the Wheel Bob Ernst Life Without CPAN
  • 27. You aren't alone If you google XYZ Perl, you'll
  • 28. nd a lot of questions like: How do I XYZ in Perl without using CPAN? Bob Ernst Life Without CPAN
  • 29. XML Parsing Writing an XML parser is hard work XML isn't a regular language so it can't be parsed with regular expressions But in a pinch... i f ( $ i n p u t =~ qr f ( t i t l e ) ( . ) (/ t i t l e ) gx ) f $ t i t l e = $2 ; g Bob Ernst Life Without CPAN
  • 30. Date and Time Date::Manip and Date::Calc are so powerful... what to do when they aren't available? Bob Ernst Life Without CPAN
  • 31. The Next Eight Sundays (Date::Calc) us e Date : : Cal c qw( Add De l ta Days Da t e t o Te x t Day of Week Today ) ; my @date = Today ( ) ; my $ d a y s u n t i l s u n d a y = 7 Day of Week ( @date ) ; i f ( $ d a y s u n t i l s u n d a y == 0 ) f $ d a y s u n t i l s u n d a y = 7 ; g f o r ( my $ i =0; $i 8; $ i++ ) f @date = Add De l ta Days ( @date , $ d a y s u n t i l s u n d a y ) ; say Da t e t o Te x t ( @date ) ; $ d a y s u n t i l s u n d a y = 7 ; g Bob Ernst Life Without CPAN
  • 32. The Next Eight Sundays (POSIX) us e POSIX qw( mktime s t r f t ime ) ; us e c o n s t a n t f MDAY = 3 , WDAY = 6 , g ; my @date = l o c a l t ime ( t ime ( ) ) ; f o r (my $ i =0; $i 8; $ i++) f $dat e [MDAY] += 7 $dat e [WDAY] ; @date = l o c a l t ime ( mktime ( @date ) ) ; say s t r f t ime ( %a %d%b%Y , @date ) ; g Bob Ernst Life Without CPAN
  • 33. Parallel Processing Modules like Parallel::Queue are great... if you have CPAN. Bob Ernst Life Without CPAN
  • 34. Old Fashion Fork our @c h i l d r e n = ( ) ; sub spawn command f my $command = s h i f t ; my $pid = f o r k ( ) ; i f ( $pid ) f push @c h i l d r e n , $pid ; g e l s i f ( $pid == 0 ) f sys tem ( @f$commandg ) ; e x i t 0 ; g g Bob Ernst Life Without CPAN
  • 35. Fork continued f o r ( my $ i =1; $ i = 5 2 ; $ i++ ) f spawn command ( [ what e v e r , $ i ] ) ; g f o r e a c h my $pid ( @c h i l d r e n ) f wa i t p i d ( $pid , 0 ) ; g Bob Ernst Life Without CPAN
  • 36. Core Modules Don't forget the core modules! Benchmark Carp Cwd Data::Dumper File::stat Getopt::Long IO::Handle IO::Socket Log::Message Math::BigInt Memoize Pod::Usage POSIX Test::More Time::Local 682 altogether! Bob Ernst Life Without CPAN
  • 37. REMEMBER There are three great virtues of a programmer: laziness, impatience and hubris { Larry Wall Be lazy and impatient { use CPAN! Bob Ernst Life Without CPAN