SlideShare a Scribd company logo
Introduction to CPAN
    Living off other people’s code
Nitpicking
• “Perl” is the language specification
• and the noun (“the Perl community”, “a
  Perl program”)
• and the distribution (“the Perl tar ball”)
• “perl” is a compiler implementing the
  language specification (currently, Perl 5)
• There is no “PERL”
Running Perl

• Compiler
• Tools
• Standard library
• CPAN
 • and its configuration
Running Perl
          Compiler
• the “perl” bit
• jit compiler
• configuration assembled at build time, most
  (all?) of it can be overridden at runtime
• namely, the library path to use
Running Perl
           Tools
• documentation
• header extraction
• module jump-starters
• debugger
• profiler
Running Perl
     Standard Library

• modules distributed with Perl
• Module::CoreList
• 602 modules as of 5.8.8
Running Perl
         Local build
• Perl pre-installed everywhere
• vendor may overwrite your modifications
• you may break stuff
• always use a local package
Running Perl
          Local build
• Compile:
  sh Configure -de -Dusethreads
  make && make test && make install
  (cd /usr/include && /usr/local/
  bin/h2ph *.h sys/*.h)

• uses /usr/local by default
• good enough most of the times
Running Perl
         Local build
• Common options:
 • -Dcc=gcc
 • -Dprefix=/opt/builds/perl
 • -Dlocincpth=”/foo/bar/include”
 • -Dloclibpth=”/foo/bar/lib”
Running Perl
         Local build

•Module lookup paths:
 lib/perl5
      /5.8.8
          /darwin-thread-multi
      /site_perl
Running Perl
           CPAN
• Comprehensive Perl Archive Network
• Source code repository for everything Perl
• Modules, but also...
 • Perl itself
 • Several tools/programs written in Perl
http://www.cpan.org/
Why CPAN
• laziness
• re-inventing the wheel (not)
• code reuse
• tested and tried
• around 250 mirrors worldwide
• approximately 13000 modules
 • lots of crap...
How to use CPAN

• Manually
• There’s a module for it
  perl -MCPAN -e shell

• There’s a script for it
  cpan
CPAN manual usage
• Search for a module
  • http://search.cpan.org/
• Search for its dependencies
  • http://cpandeps.cantrell.org.uk/
• Start with dependencies and install one by
  one
• Tedious and time-consuming (e.g., Catalyst
  depends on hundreds of modules)
http://search.cpan.org/
http://kobesearch.cpan.org/
http://cpandeps.cantrell.org.uk/
cpandeps: version
CPAN manual usage
                  (continued)


• Organization:
  authors
  modules
      by-author
      by-category
      by-module
  ports
  src
  scripts
  doc
CPAN manual usage
              (continued)


•Procedure:
  tar zxf Sample-Module-1.0.tar.gz
  cd Sample-Module-1.0
  perl Makefile.PL
  make
  make test
  make install
The CPAN module
• Lots of built-in facilities
 • search
 • automatic installation of dependencies
 • look inside a distribution’s tar ball
 • highly configurable
• You can use it in your programs (have a
  look at the source for cpandeps)
The CPAN module
              (continued)


•Usage:
  perl -MCPAN -e shell
  i Sample::Module
  i /ample/i
  look Sample::Module
  install Sample::Module
  force install Sample::Module (!!!)
CPAN Configuration

• in $PERL5LIB/CPAN/Config.pm
• can be hand-edited or...
• using o conf in the CPAN shell
• it’s just a Perl module
CPAN Configuration
                 (continued)




• Location of several utilities CPAN uses
  ftp, gpg, gzip, lynx, make, ncftp, pager,
  tar, unzip

• Parameters for some of these
  e.g., make_arg, ftp_passive
CPAN Configuration
                (continued)



• CPAN parameters
  auto_commit, build_dir, cpan_home,
  histfile, prerequisites, scan_cache

• build parameters
  makepl_arg

• other
CPAN Configuration
                (continued)


• the urllist lists the CPAN mirrors we’ll
  use
• kept in a hash, %CPAN::Config
• the configuration is itself Perl code
• override system-wide parameters via
  MyConfig.pm
The CPAN module
               (continued)

•More usage:
  perl -MCPAN -e ‘install A::Module’
  o conf
  o conf http_proxy http://proxy:port/
  o conf commit
  o conf init /REGEXP/
  $PERL5LIB/CPAN/Config.pm
  failed
  test
The cpan script


• $PERL5BIN/cpan
 cpan Some::Module
 cpan .
Mirroring CPAN

• A full mirror is around 7gb
• CPAN::Mini and minicpan
 • only the newest version of every module
 • ~800mb
More usage

• Passing arguments to perl Makefile.PL
• Finding outdated modules
• Adding to $PERL5LIB
• Maintaining your own $PERL5LIB
• Smart urllist
Passing arguments to
perl Makefile.pl
• no standard
• remember Makefile.PL is a Perl program :)
• and there’s usually a README file or
  similar :)
• usually you’ll be able do define environment
  variables
  CC=gcc perl Makefile.pl
  CC=gcc cpan Some::Module
Finding outdated
         modules

• r command on the CPAN shell
• upgrade command to perform the actual
  upgrade
• take a string or a regexp as parameters
Adding to $PERL5LIB

• in your code:
  use lib qw( /opt/permodules /home/pfig/perllib );


• set PERL5LIB in your profile or startup
  scripts:
  export PERL5LIB=/opt/perlmodules:/home/pfig/perllib
Maintaining your own
   $PERL5LIB

• Override the default system installation
• How can i still enjoy the CPAN goodness?
• Don’t piss off your sysadmin
Maintaining your own
   $PERL5LIB
• Getting -p ~/perl/bin
  mkdir
          ready:
                      
    ~/perl/man/man1 ~/perl/man/man3
  mkdir -p ~/.cpan/CPAN
  cp $PERL5LIB/CPAN/Config.pm 
    ~/.cpan/CPAN/MyConfig.pm

• Debian uses /etc/perl. There’s a special
  place in hell for them.
Maintaining your own
   $PERL5LIB
• Edit MyConfig.pm
  ‘build_dir’         => q[/home/pfig/.cpan/build]
  ‘cpan_home’         => q[/home/pfig/.cpan]
  ‘histfile’          => q[/home/pfig/.cpan/histfile]
  ‘keep_source_where’ => q[/home/pfig/.cpan/sources]
  ‘makepl_arg’ => q[PREFIX=~/perl
                    LIB=~/perl/lib
                    INSTALLMAN1DIR=~/perl/man/man1
                    INSTALLMAN3DIR=~/perl/man/man3
                    INSTALLSCRIPT=~/perl/bin
                    INSTALLBIN=~/perl/bin]
  ‘mbuildpl_arg’      => q[--prefix ~/perl]
Maintaining your own
   $PERL5LIB
• Set up your environment
  PERL5LIB=~/perl/lib
  PERL5MAN=~/perl/man
  PATH=$PATH:~/perl/bin

  export PERL5LIB PERL5MAN PATH

• Done!
• You now have all the CPAN shininess and
  you can get rid of use lib pragmas
Smart urllist
• have a local mini mirror
• have the last url of your urllist point to
  it via file://
• CPAN will always download its indexes
  from one of the sites but it will try to get
  the package from your local disk.
• you get up-to-date indexes with no need to
  remember to refresh the mirror.
Danger, Will Robinson!
• if you run cpan without checking your
  path, you may be running the vendor’s cpan
  (because chances are /usr/bin appears in
  your path before /usr/local/bin)
• the same goes for perl -MCPAN
• And, if installing manually, the perl you use
  to run Makefile.PL
Which modules to use
• CPAN testers
  • http://www.cpantesters.org/
• CPANTS
  • http://cpants.perl.org/
• Kwalitee
  • http://cpants.perl.org/kwalitee.html
• Reviews on CPAN
• Ask around. Really.
CPAN testers
Kwalitee
Other stuff

• Bugs
  http://rt.cpan.org/
• Contributing to CPAN
  PAUSE
http://rt.cpan.org/
http://pause.cpan.org/
Resources
•   http://search.cpan.org/

•   http://cpan.org/misc/cpan-faq.html

•   http://qa.perl.org/

•   http://cpandeps.cantrell.org.uk/

•   http://use.perl.org/

•   http://perlmonks.org/

•   perldoc
Thanks to...
• In no particular order:
 • David Cantrell
    http://www.cantrell.org.uk/david/tech/

 • London.pm
 • Pedro Melo
    http://simplicidade.org/notes/

 • Simon Wistow
    http://thegestalt.org/simon/

 • And Wizards Larry Wall and the other
    Perl
          of course
A local shop, for local
         people
•http://london.pm.org/
• Free beer every month!
• London Perl Workshop (yearly, free)
• london.pm’s tech meetings (free, twice a
  year or thereabouts)

More Related Content

What's hot

Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.ar
Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.arArquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.ar
Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.arjcbenitezp
 
6g wireless communication systems
6g wireless communication systems6g wireless communication systems
6g wireless communication systems
SAIALEKHYACHITTURI
 
Security In LTE Access Network
Security In LTE Access NetworkSecurity In LTE Access Network
Security In LTE Access Network
Sukhvinder Singh Malik
 
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
Bruno Teixeira
 
Vlsi design main ppt 1
Vlsi design main ppt 1Vlsi design main ppt 1
Vlsi design main ppt 1
Semi Design
 
Introduction to communication system lecture1
Introduction to communication system lecture1Introduction to communication system lecture1
Introduction to communication system lecture1
Jumaan Ally Mohamed
 
CDMA
CDMACDMA
Sangoma SS7 Gateway Training
Sangoma SS7 Gateway TrainingSangoma SS7 Gateway Training
Sangoma SS7 Gateway Training
Empatiq İletişim Teknolojileri AŞ.
 
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
Chih-Chan Tu
 
07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)
Akhila Dakshina
 
Pace PPT.pptx
Pace PPT.pptxPace PPT.pptx
Pace PPT.pptx
ssuser502d85
 
Introduction to OFDM
Introduction to OFDMIntroduction to OFDM
Introduction to OFDM
John Thomas
 
digital audio broadcasting
digital audio broadcastingdigital audio broadcasting
digital audio broadcastingRam B
 
BiCMOS Technology
BiCMOS TechnologyBiCMOS Technology
BiCMOS Technology
Mithileysh Sathiyanarayanan
 
Wireless Application Protocol ppt
Wireless Application Protocol pptWireless Application Protocol ppt
Wireless Application Protocol ppt
go2project
 
Intermediate: 5G Network Architecture Options (Updated)
Intermediate: 5G Network Architecture Options (Updated)Intermediate: 5G Network Architecture Options (Updated)
Intermediate: 5G Network Architecture Options (Updated)
3G4G
 
Trends and challenges in IP based SOC design
Trends and challenges in IP based SOC designTrends and challenges in IP based SOC design
Trends and challenges in IP based SOC design
AishwaryaRavishankar8
 
TDMA, FDMA, and CDMA
TDMA, FDMA, and CDMATDMA, FDMA, and CDMA
TDMA, FDMA, and CDMA
Najeeb Khan
 
Gsm architecture and signalling techniques
Gsm architecture and signalling techniquesGsm architecture and signalling techniques
Gsm architecture and signalling techniques
kanisthika chauhan
 

What's hot (20)

Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.ar
Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.arArquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.ar
Arquitecturas pasivas de_fibra_optica_-_www.tecnoredsa.com.ar
 
6g wireless communication systems
6g wireless communication systems6g wireless communication systems
6g wireless communication systems
 
Security In LTE Access Network
Security In LTE Access NetworkSecurity In LTE Access Network
Security In LTE Access Network
 
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
Passive Optical Networks - PON: Customer Case Study, Design, Implementation a...
 
Vlsi design main ppt 1
Vlsi design main ppt 1Vlsi design main ppt 1
Vlsi design main ppt 1
 
Introduction to communication system lecture1
Introduction to communication system lecture1Introduction to communication system lecture1
Introduction to communication system lecture1
 
CDMA
CDMACDMA
CDMA
 
Sangoma SS7 Gateway Training
Sangoma SS7 Gateway TrainingSangoma SS7 Gateway Training
Sangoma SS7 Gateway Training
 
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
Design of Energy- and Area-Efficient Sensor Readout Circuits (Chih-Chan Tu)
 
07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)07. Mainboard (System Board, Motherboard)
07. Mainboard (System Board, Motherboard)
 
Pace PPT.pptx
Pace PPT.pptxPace PPT.pptx
Pace PPT.pptx
 
makalah-cdma
makalah-cdmamakalah-cdma
makalah-cdma
 
Introduction to OFDM
Introduction to OFDMIntroduction to OFDM
Introduction to OFDM
 
digital audio broadcasting
digital audio broadcastingdigital audio broadcasting
digital audio broadcasting
 
BiCMOS Technology
BiCMOS TechnologyBiCMOS Technology
BiCMOS Technology
 
Wireless Application Protocol ppt
Wireless Application Protocol pptWireless Application Protocol ppt
Wireless Application Protocol ppt
 
Intermediate: 5G Network Architecture Options (Updated)
Intermediate: 5G Network Architecture Options (Updated)Intermediate: 5G Network Architecture Options (Updated)
Intermediate: 5G Network Architecture Options (Updated)
 
Trends and challenges in IP based SOC design
Trends and challenges in IP based SOC designTrends and challenges in IP based SOC design
Trends and challenges in IP based SOC design
 
TDMA, FDMA, and CDMA
TDMA, FDMA, and CDMATDMA, FDMA, and CDMA
TDMA, FDMA, and CDMA
 
Gsm architecture and signalling techniques
Gsm architecture and signalling techniquesGsm architecture and signalling techniques
Gsm architecture and signalling techniques
 

Viewers also liked

Perl in Teh Cloud
Perl in Teh CloudPerl in Teh Cloud
Perl in Teh Cloud
Pedro Figueiredo
 
My life as a beekeeper
My life as a beekeeperMy life as a beekeeper
My life as a beekeeper
Pedro Figueiredo
 
The problem with Perl
The problem with PerlThe problem with Perl
The problem with Perl
Pedro Figueiredo
 
Perl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReducePerl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReduce
Pedro Figueiredo
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
daoswald
 
PERL Unit 6 regular expression
PERL Unit 6 regular expressionPERL Unit 6 regular expression
PERL Unit 6 regular expressionBinsent Ribera
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
Curtis Poe
 

Viewers also liked (7)

Perl in Teh Cloud
Perl in Teh CloudPerl in Teh Cloud
Perl in Teh Cloud
 
My life as a beekeeper
My life as a beekeeperMy life as a beekeeper
My life as a beekeeper
 
The problem with Perl
The problem with PerlThe problem with Perl
The problem with Perl
 
Perl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReducePerl on Amazon Elastic MapReduce
Perl on Amazon Elastic MapReduce
 
30 Minutes To CPAN
30 Minutes To CPAN30 Minutes To CPAN
30 Minutes To CPAN
 
PERL Unit 6 regular expression
PERL Unit 6 regular expressionPERL Unit 6 regular expression
PERL Unit 6 regular expression
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
 

Similar to CPAN Training

Smoking docker
Smoking dockerSmoking docker
Smoking docker
Workhorse Computing
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
Kang-min Liu
 
MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )
brian d foy
 
MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)brian d foy
 
perlall
perlallperlall
perlall
Reini Urban
 
CPAN Packager
CPAN PackagerCPAN Packager
CPAN Packagertechmemo
 
Perl in RPM-Land
Perl in RPM-LandPerl in RPM-Land
Perl in RPM-Land
Dave Cross
 
Perlmania_Study - CPAN
Perlmania_Study - CPANPerlmania_Study - CPAN
Perlmania_Study - CPAN
Jeen Lee
 
Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)
Jose Luis Martínez
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
PHPBelgium
 
cPanel conf 2017 - How to Speak cPanel
cPanel conf 2017 - How to Speak cPanelcPanel conf 2017 - How to Speak cPanel
cPanel conf 2017 - How to Speak cPanel
cPanel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
 
Modern Commandline Tool
Modern Commandline ToolModern Commandline Tool
Modern Commandline ToolYuji Shimada
 
Revisiting ppm
Revisiting ppmRevisiting ppm
Revisiting ppm
charsbar
 
21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci
Mike Friedman
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package manager
Timur Safin
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
Kris Buytaert
 

Similar to CPAN Training (20)

Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
perlbrew yapcasia 2010
perlbrew yapcasia 2010perlbrew yapcasia 2010
perlbrew yapcasia 2010
 
MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )MyCPAN ( LA.pm, September 2007 )
MyCPAN ( LA.pm, September 2007 )
 
MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)MyCPAN (Frozen Perl 2008 Lightning Talk)
MyCPAN (Frozen Perl 2008 Lightning Talk)
 
Perlbrew
PerlbrewPerlbrew
Perlbrew
 
perlall
perlallperlall
perlall
 
CPAN Packager
CPAN PackagerCPAN Packager
CPAN Packager
 
Perl in RPM-Land
Perl in RPM-LandPerl in RPM-Land
Perl in RPM-Land
 
Perlmania_Study - CPAN
Perlmania_Study - CPANPerlmania_Study - CPAN
Perlmania_Study - CPAN
 
Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)Modern Perl toolchain (help building microservices)
Modern Perl toolchain (help building microservices)
 
Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009Prepare for PHP Test Fest 2009
Prepare for PHP Test Fest 2009
 
cPanel conf 2017 - How to Speak cPanel
cPanel conf 2017 - How to Speak cPanelcPanel conf 2017 - How to Speak cPanel
cPanel conf 2017 - How to Speak cPanel
 
Programming
ProgrammingProgramming
Programming
 
Os Treat
Os TreatOs Treat
Os Treat
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
Modern Commandline Tool
Modern Commandline ToolModern Commandline Tool
Modern Commandline Tool
 
Revisiting ppm
Revisiting ppmRevisiting ppm
Revisiting ppm
 
21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci
 
Approaching package manager
Approaching package managerApproaching package manager
Approaching package manager
 
How I hack on puppet modules
How I hack on puppet modulesHow I hack on puppet modules
How I hack on puppet modules
 

Recently uploaded

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

CPAN Training

  • 1. Introduction to CPAN Living off other people’s code
  • 2. Nitpicking • “Perl” is the language specification • and the noun (“the Perl community”, “a Perl program”) • and the distribution (“the Perl tar ball”) • “perl” is a compiler implementing the language specification (currently, Perl 5) • There is no “PERL”
  • 3. Running Perl • Compiler • Tools • Standard library • CPAN • and its configuration
  • 4. Running Perl Compiler • the “perl” bit • jit compiler • configuration assembled at build time, most (all?) of it can be overridden at runtime • namely, the library path to use
  • 5. Running Perl Tools • documentation • header extraction • module jump-starters • debugger • profiler
  • 6. Running Perl Standard Library • modules distributed with Perl • Module::CoreList • 602 modules as of 5.8.8
  • 7. Running Perl Local build • Perl pre-installed everywhere • vendor may overwrite your modifications • you may break stuff • always use a local package
  • 8. Running Perl Local build • Compile: sh Configure -de -Dusethreads make && make test && make install (cd /usr/include && /usr/local/ bin/h2ph *.h sys/*.h) • uses /usr/local by default • good enough most of the times
  • 9. Running Perl Local build • Common options: • -Dcc=gcc • -Dprefix=/opt/builds/perl • -Dlocincpth=”/foo/bar/include” • -Dloclibpth=”/foo/bar/lib”
  • 10. Running Perl Local build •Module lookup paths: lib/perl5 /5.8.8 /darwin-thread-multi /site_perl
  • 11. Running Perl CPAN • Comprehensive Perl Archive Network • Source code repository for everything Perl • Modules, but also... • Perl itself • Several tools/programs written in Perl
  • 13. Why CPAN • laziness • re-inventing the wheel (not) • code reuse • tested and tried • around 250 mirrors worldwide • approximately 13000 modules • lots of crap...
  • 14. How to use CPAN • Manually • There’s a module for it perl -MCPAN -e shell • There’s a script for it cpan
  • 15. CPAN manual usage • Search for a module • http://search.cpan.org/ • Search for its dependencies • http://cpandeps.cantrell.org.uk/ • Start with dependencies and install one by one • Tedious and time-consuming (e.g., Catalyst depends on hundreds of modules)
  • 20. CPAN manual usage (continued) • Organization: authors modules by-author by-category by-module ports src scripts doc
  • 21. CPAN manual usage (continued) •Procedure: tar zxf Sample-Module-1.0.tar.gz cd Sample-Module-1.0 perl Makefile.PL make make test make install
  • 22. The CPAN module • Lots of built-in facilities • search • automatic installation of dependencies • look inside a distribution’s tar ball • highly configurable • You can use it in your programs (have a look at the source for cpandeps)
  • 23. The CPAN module (continued) •Usage: perl -MCPAN -e shell i Sample::Module i /ample/i look Sample::Module install Sample::Module force install Sample::Module (!!!)
  • 24. CPAN Configuration • in $PERL5LIB/CPAN/Config.pm • can be hand-edited or... • using o conf in the CPAN shell • it’s just a Perl module
  • 25. CPAN Configuration (continued) • Location of several utilities CPAN uses ftp, gpg, gzip, lynx, make, ncftp, pager, tar, unzip • Parameters for some of these e.g., make_arg, ftp_passive
  • 26. CPAN Configuration (continued) • CPAN parameters auto_commit, build_dir, cpan_home, histfile, prerequisites, scan_cache • build parameters makepl_arg • other
  • 27. CPAN Configuration (continued) • the urllist lists the CPAN mirrors we’ll use • kept in a hash, %CPAN::Config • the configuration is itself Perl code • override system-wide parameters via MyConfig.pm
  • 28. The CPAN module (continued) •More usage: perl -MCPAN -e ‘install A::Module’ o conf o conf http_proxy http://proxy:port/ o conf commit o conf init /REGEXP/ $PERL5LIB/CPAN/Config.pm failed test
  • 29. The cpan script • $PERL5BIN/cpan cpan Some::Module cpan .
  • 30. Mirroring CPAN • A full mirror is around 7gb • CPAN::Mini and minicpan • only the newest version of every module • ~800mb
  • 31. More usage • Passing arguments to perl Makefile.PL • Finding outdated modules • Adding to $PERL5LIB • Maintaining your own $PERL5LIB • Smart urllist
  • 32. Passing arguments to perl Makefile.pl • no standard • remember Makefile.PL is a Perl program :) • and there’s usually a README file or similar :) • usually you’ll be able do define environment variables CC=gcc perl Makefile.pl CC=gcc cpan Some::Module
  • 33. Finding outdated modules • r command on the CPAN shell • upgrade command to perform the actual upgrade • take a string or a regexp as parameters
  • 34. Adding to $PERL5LIB • in your code: use lib qw( /opt/permodules /home/pfig/perllib ); • set PERL5LIB in your profile or startup scripts: export PERL5LIB=/opt/perlmodules:/home/pfig/perllib
  • 35. Maintaining your own $PERL5LIB • Override the default system installation • How can i still enjoy the CPAN goodness? • Don’t piss off your sysadmin
  • 36. Maintaining your own $PERL5LIB • Getting -p ~/perl/bin mkdir ready: ~/perl/man/man1 ~/perl/man/man3 mkdir -p ~/.cpan/CPAN cp $PERL5LIB/CPAN/Config.pm ~/.cpan/CPAN/MyConfig.pm • Debian uses /etc/perl. There’s a special place in hell for them.
  • 37. Maintaining your own $PERL5LIB • Edit MyConfig.pm ‘build_dir’ => q[/home/pfig/.cpan/build] ‘cpan_home’ => q[/home/pfig/.cpan] ‘histfile’ => q[/home/pfig/.cpan/histfile] ‘keep_source_where’ => q[/home/pfig/.cpan/sources] ‘makepl_arg’ => q[PREFIX=~/perl LIB=~/perl/lib INSTALLMAN1DIR=~/perl/man/man1 INSTALLMAN3DIR=~/perl/man/man3 INSTALLSCRIPT=~/perl/bin INSTALLBIN=~/perl/bin] ‘mbuildpl_arg’ => q[--prefix ~/perl]
  • 38. Maintaining your own $PERL5LIB • Set up your environment PERL5LIB=~/perl/lib PERL5MAN=~/perl/man PATH=$PATH:~/perl/bin export PERL5LIB PERL5MAN PATH • Done! • You now have all the CPAN shininess and you can get rid of use lib pragmas
  • 39. Smart urllist • have a local mini mirror • have the last url of your urllist point to it via file:// • CPAN will always download its indexes from one of the sites but it will try to get the package from your local disk. • you get up-to-date indexes with no need to remember to refresh the mirror.
  • 40. Danger, Will Robinson! • if you run cpan without checking your path, you may be running the vendor’s cpan (because chances are /usr/bin appears in your path before /usr/local/bin) • the same goes for perl -MCPAN • And, if installing manually, the perl you use to run Makefile.PL
  • 41. Which modules to use • CPAN testers • http://www.cpantesters.org/ • CPANTS • http://cpants.perl.org/ • Kwalitee • http://cpants.perl.org/kwalitee.html • Reviews on CPAN • Ask around. Really.
  • 44. Other stuff • Bugs http://rt.cpan.org/ • Contributing to CPAN PAUSE
  • 47. Resources • http://search.cpan.org/ • http://cpan.org/misc/cpan-faq.html • http://qa.perl.org/ • http://cpandeps.cantrell.org.uk/ • http://use.perl.org/ • http://perlmonks.org/ • perldoc
  • 48. Thanks to... • In no particular order: • David Cantrell http://www.cantrell.org.uk/david/tech/ • London.pm • Pedro Melo http://simplicidade.org/notes/ • Simon Wistow http://thegestalt.org/simon/ • And Wizards Larry Wall and the other Perl of course
  • 49. A local shop, for local people •http://london.pm.org/ • Free beer every month! • London Perl Workshop (yearly, free) • london.pm’s tech meetings (free, twice a year or thereabouts)