SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
Perl Development
Environment Tooling
Jason Crome
Technical Lead, All Around the World
August 25, 2016 Copyright 2016, Jason A. Crome
Who’s this for?
• Devs who need to work with multiple versions of Perl
(module authors, large enterprises, masochists, etc.)
• Devs who have been through dependency hell
• Devs who need a specific Perl setup but system restrictions
interfere
• Devs looking to make deployment easier
• People frustrated with bugs in system Perl
• People who want to use/test the latest Perl features
Copyright 2016, Jason A. CromeAugust 25, 2016
What We’ll Cover
• local::lib
• perlbrew
• plenv
• Carton
• Carmel and Pinto (very minimally)
Copyright 2016, Jason A. CromeAugust 25, 2016
local::lib
• Helps work with system Perl
• Helps avoid sysadmins
• Makes deployments easier
• Installs Perl modules to home (or another) directory,
rather than updating the system lib/ directory.
Copyright 2016, Jason A. CromeAugust 25, 2016
local::lib… But why?
• Sometimes you can’t install the Perl you need
• Sometimes you install from packages (Debian,
FreeBSD, etc.) that don’t update often.
• Sometimes your sysadmin is cautious and prevents
you from installing what you need
Copyright 2016, Jason A. CromeAugust 25, 2016
About local::lib
• Your local modules take precedence
• Your local modules have no effect on other users
• System Perl doesn’t even need local::lib
installed for you to use it! (to do this, look at the
bootstrapping technique)
Copyright 2016, Jason A. CromeAugust 25, 2016
Using local::lib
# Initialize local::lib (.bashrc, etc.)
eval $( perl -Mlocal::lib );
# Install a module
cpanm Dancer2
# In your code:
# Nothing, you already set this up in your shell :)
Copyright 2016, Jason A. CromeAugust 25, 2016
perlbrew and plenv
• Helps avoid system Perl
• Helps avoid system admins
• Makes deployments easier
• Useful for testing an app against other Perl versions
• Install one or more Perl versions to your home directory
• More flexible than local::lib
Copyright 2016, Jason A. CromeAugust 25, 2016
perlbrew and plenv
jason@darwin PerlDancer/Dancer2-official (master)
7:22:47 git » plenv versions
system
aaw-5.22.0
bump-5.24.0
crome-plated
dancer-5.10.1
* dancer-5.22.0 (set by ~/Projects/PerlDancer/.perl-version)
fifo-5.22.0
pearlbee-5.18.4
vetminder-5.22.0
vetminder-5.24.0
veure-5.18.4
veure-5.22.1
veure-5.24.0
waste-classic
waste-tng
Copyright 2016, Jason A. CromeAugust 25, 2016
perlbrew and plenv
• Not compatible with each other
• If you want to switch after you have installed one of
these, you must completely uninstall the other
Copyright 2016, Jason A. CromeAugust 25, 2016
perlbrew - Pros and Cons
• It’s easy
• Don’t need sudo to install Perl modules
• Onus is placed on dev to change Perl versions
when it is appropriate to do so
• When you switch Perl versions, you stay on that
version until you switch to another
Copyright 2016, Jason A. CromeAugust 25, 2016
How perlbrew Works
• By abusing your $PATH, that’s how.
• When you switch versions of Perl, perlbrew changes
your path to point to the desired version of Perl
• Does this by exporting some shell functions that
switches $PATH when needed
• Easy to understand
• Written in Perl
Copyright 2016, Jason A. CromeAugust 25, 2016
Installing perlbrew
# From the shell (all you should really need)
curl -L https://install.perlbrew.pl | bash
perlbrew init
# Or, from CPAN
sudo cpan App::perlbrew
Copyright 2016, Jason A. CromeAugust 25, 2016
Using perlbrew
# What versions can be installed?
perlbrew available
# Install a version
perlbrew install perl-5.24.0
# List installed versions
perlbrew list
# Change versions
perlbrew switch perl-5.18.4
# Test against all installed versions
perlbrew exec dzil test
Copyright 2016, Jason A. CromeAugust 25, 2016
plenv - Pros and Cons
• Lets you set local and global Perl configs
• This leaves .perl-version files in its wake. Add
to .gitignore
• No $PATH munging to work
• Less functionality than perlbrew out of the box
Copyright 2016, Jason A. CromeAugust 25, 2016
How plenv works
• Installs to one location and adds it to your path
• Creates a shim for each executable (base Perl plus
those added through CPAN)
• Implemented in bash (no global shell functions)
• Shim looks at the appropriate .perl-version file
to determine which Perl version to use
Copyright 2016, Jason A. CromeAugust 25, 2016
What’s in .perl-version?
jason@darwin Projects/veure (master*)
10:57:21 git » cat .perl-version
veure-5.24.0
Copyright 2016, Jason A. CromeAugust 25, 2016
Installing plenv
# On mac?
brew install plenv
brew install perlbuild
Copyright 2016, Jason A. CromeAugust 25, 2016
Installing plenv
# Otherwise
git clone https://github.com/tokuhirom/plenv.git ~/.plenv
echo 'export PATH="$HOME/.plenv/bin:$PATH"' >>
~/.bash_profile
echo 'eval "$(plenv init -)"' >> ~/.bash_profile
exec $SHELL -l
git clone https://github.com/tokuhirom/Perl-Build.git
~/.plenv/plugins/perl-build/
Copyright 2016, Jason A. CromeAugust 25, 2016
Using plenv
# What versions can be installed?
plenv install --list
# Install a version
plenv install 5.24.0
plenv install 5.24.0 --as dancer2-5.24.0
# List installed versions
plenv versions
# Change versions
plenv local dancer2-5.24.0
plenv global system
# Test against all installed versions (need plenv-contrib)
plenv exec-all dzil test
Copyright 2016, Jason A. CromeAugust 25, 2016
Carton
• Top-notch dependency management
• Can specify a specific range of allowed versions,
or a specific one. This is huge!
• Runs your app with only the modules you specify
• Super-easy to deploy and distribute your app with
no module/dependency hell
Copyright 2016, Jason A. CromeAugust 25, 2016
Why’s this useful?
• Consider Veure (Tau Station, our game)
• Developer stymied by test failures
• Only one on team using Test::Class::Moose 0.77
• Spend inordinate amount of time tracking down to find
it was a version issue
• Better dependency/module management would have
made this a non-issue
Copyright 2016, Jason A. CromeAugust 25, 2016
How Carton works
• Uses cpanfile to specify versions
• Can create a cpanfile.snapshot to pin specific
versions that are currently installed
• Distribute these to other machines with your
application to deploy/run your app
Copyright 2016, Jason A. CromeAugust 25, 2016
What’s in .cpanfile?
# This version and any after
requires “Dancer2", ">= 0.163000”;
# No specific version needed
requires "Dancer2::Plugin::Database" => 0;
on "test" => sub {
requires “Test::More" => "0";
requires “Test::Class::Moose”, ”>= 0.73, < 0.77”;
};
Copyright 2016, Jason A. CromeAugust 25, 2016
Installing Carton
# From CPAN
cpanm Carton
Copyright 2016, Jason A. CromeAugust 25, 2016
Using Carton
# Install module version listed in cpanfile from CPAN
carton install
# Modules are installed to local/
# Version info captured to cpanfile.snapshot
# Commit to github
git add cpanfile.snapshot
git commit -m”Capture module version snapshot.”
git push
# Clone to other machine, then
carton install --deployment
# Now, run your app
carton exec plackup sbin/app.psgi
Copyright 2016, Jason A. CromeAugust 25, 2016
Bundling with Carton
• carton bundle bundles the tarballs for your
modules and their dependencies into a directory
• Easy to distribute across a local network
• Deploy via carton install --cached
• Can install without CPAN or an internet connection
Copyright 2016, Jason A. CromeAugust 25, 2016
A final note
• Carton creates two things in your project directory:
local/ and .carton
• These should not be distributed with your app
• Make it easy: add to .gitignore
Copyright 2016, Jason A. CromeAugust 25, 2016
Carmel and Pinto
Honestly, I have little experience here
Both are marked experimental.
USE AT YOUR OWN RISK
Copyright 2016, Jason A. CromeAugust 25, 2016
Carmel
• Set up your own CPAN-like repositories of modules
• Carmel keeps a repo of all modules you build with
it
• When you need a module, uses cpanfile to
determine what it needs from that repo and builds
@INC appropriately.
• Carmel and Carton are made to work together
Copyright 2016, Jason A. CromeAugust 25, 2016
Pinto
• Pinto works like a self-curated PAUSE/CPAN
• Unlike CPAN, lets you keep different module versions
for dev, prod, test, etc.
• Has version control. Easy to rollback if you add a
broken module release
• Allows you to use only modules and versions you want
• Works when you are offline/CPAN is down
Copyright 2016, Jason A. CromeAugust 25, 2016
Thank you!
Copyright 2016, Jason A. CromeAugust 25, 2016
Resources
• local::lib - https://metacpan.org/pod/local::lib
• perlbrew - https://perlbrew.pl/
• plenv - https://github.com/tokuhirom/plenv
• Carton - https://metacpan.org/pod/Carton
• Carmel - https://metacpan.org/pod/Carmel
• Pinto - https://metacpan.org/pod/Pinto
Copyright 2016, Jason A. CromeAugust 25, 2016

Contenu connexe

Tendances

Succesful testing-continuous-delivery-testnet
Succesful testing-continuous-delivery-testnetSuccesful testing-continuous-delivery-testnet
Succesful testing-continuous-delivery-testnet
Harald Rietman
 
Java build tools
Java build toolsJava build tools
Java build tools
Sujit Kumar
 

Tendances (20)

Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
 
Blazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java UniverseBlazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java Universe
 
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
London Hashicorp Meetup #8 -  Testing Programmable Infrastructure By Matt LongLondon Hashicorp Meetup #8 -  Testing Programmable Infrastructure By Matt Long
London Hashicorp Meetup #8 - Testing Programmable Infrastructure By Matt Long
 
Raffaele Rialdi
Raffaele RialdiRaffaele Rialdi
Raffaele Rialdi
 
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
Alfresco DevCon 2018: SDK 3 Multi Module project using Nexus 3 for releases a...
 
Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)Immutable infrastructure:觀念與實作 (建議)
Immutable infrastructure:觀念與實作 (建議)
 
Karim Fanadka
Karim FanadkaKarim Fanadka
Karim Fanadka
 
Zalenium - Czyli lepszy Selenium Grid
Zalenium - Czyli lepszy Selenium GridZalenium - Czyli lepszy Selenium Grid
Zalenium - Czyli lepszy Selenium Grid
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
At Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in OperationsAt Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in Operations
 
Perforce Helix Never Dies: DevOps at Bandai Namco Studios
Perforce Helix Never Dies: DevOps at Bandai Namco StudiosPerforce Helix Never Dies: DevOps at Bandai Namco Studios
Perforce Helix Never Dies: DevOps at Bandai Namco Studios
 
ELK Stack
ELK StackELK Stack
ELK Stack
 
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoopHadoop Summit 2013 : Continuous Integration on top of hadoop
Hadoop Summit 2013 : Continuous Integration on top of hadoop
 
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeedContinuous Delivery and Zero Downtime: What your architecture needs to succeed
Continuous Delivery and Zero Downtime: What your architecture needs to succeed
 
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
Jenkins Pipeline Tutorial | Continuous Delivery Pipeline Using Jenkins | DevO...
 
Succesful testing-continuous-delivery-testnet
Succesful testing-continuous-delivery-testnetSuccesful testing-continuous-delivery-testnet
Succesful testing-continuous-delivery-testnet
 
Real Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrapReal Java EE Testing with Arquillian and ShrinkWrap
Real Java EE Testing with Arquillian and ShrinkWrap
 
Effective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpecEffective Testing with Ansible and InSpec
Effective Testing with Ansible and InSpec
 
Java build tools
Java build toolsJava build tools
Java build tools
 
Introduction to Test Kitchen and InSpec
Introduction to Test Kitchen and InSpecIntroduction to Test Kitchen and InSpec
Introduction to Test Kitchen and InSpec
 

Similaire à Perl Development Environment Tooling

Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
ActiveState
 

Similaire à Perl Development Environment Tooling (20)

Sys ml helperprofile-rhapsody813-obtainandinstall-v1
Sys ml helperprofile-rhapsody813-obtainandinstall-v1Sys ml helperprofile-rhapsody813-obtainandinstall-v1
Sys ml helperprofile-rhapsody813-obtainandinstall-v1
 
Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011Perl Dist::Surveyor 2011
Perl Dist::Surveyor 2011
 
Composer
ComposerComposer
Composer
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
 
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14Continuing Evolution of Perl: Highlights of ActivePerl 5.14
Continuing Evolution of Perl: Highlights of ActivePerl 5.14
 
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
PuppetConf 2016: Enjoying the Journey from Puppet 3.x to 4.x – Rob Nelson, AT&T
 
Composer - The missing package manager for PHP
Composer - The missing package manager for PHPComposer - The missing package manager for PHP
Composer - The missing package manager for PHP
 
21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci21st Century CPAN Testing: CPANci
21st Century CPAN Testing: CPANci
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
 
How to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to LinuxHow to migrate SourcePro apps from Solaris to Linux
How to migrate SourcePro apps from Solaris to Linux
 
Drupal Version Control & File System Basics
Drupal Version Control & File System BasicsDrupal Version Control & File System Basics
Drupal Version Control & File System Basics
 
Composer Helpdesk
Composer HelpdeskComposer Helpdesk
Composer Helpdesk
 
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
Enjoying the Journey from Puppet 3.x to Puppet 4.x (PuppetConf 2016)
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerModern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
Perlbrew
PerlbrewPerlbrew
Perlbrew
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 Workshop
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
 
Solum - OpenStack PaaS / ALM - Austin OpenStack summit
Solum - OpenStack PaaS / ALM - Austin OpenStack summitSolum - OpenStack PaaS / ALM - Austin OpenStack summit
Solum - OpenStack PaaS / ALM - Austin OpenStack summit
 
2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently2017 03 25 Microsoft Hacks, How to code efficiently
2017 03 25 Microsoft Hacks, How to code efficiently
 

Dernier

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Perl Development Environment Tooling

  • 1. Perl Development Environment Tooling Jason Crome Technical Lead, All Around the World August 25, 2016 Copyright 2016, Jason A. Crome
  • 2. Who’s this for? • Devs who need to work with multiple versions of Perl (module authors, large enterprises, masochists, etc.) • Devs who have been through dependency hell • Devs who need a specific Perl setup but system restrictions interfere • Devs looking to make deployment easier • People frustrated with bugs in system Perl • People who want to use/test the latest Perl features Copyright 2016, Jason A. CromeAugust 25, 2016
  • 3. What We’ll Cover • local::lib • perlbrew • plenv • Carton • Carmel and Pinto (very minimally) Copyright 2016, Jason A. CromeAugust 25, 2016
  • 4. local::lib • Helps work with system Perl • Helps avoid sysadmins • Makes deployments easier • Installs Perl modules to home (or another) directory, rather than updating the system lib/ directory. Copyright 2016, Jason A. CromeAugust 25, 2016
  • 5. local::lib… But why? • Sometimes you can’t install the Perl you need • Sometimes you install from packages (Debian, FreeBSD, etc.) that don’t update often. • Sometimes your sysadmin is cautious and prevents you from installing what you need Copyright 2016, Jason A. CromeAugust 25, 2016
  • 6. About local::lib • Your local modules take precedence • Your local modules have no effect on other users • System Perl doesn’t even need local::lib installed for you to use it! (to do this, look at the bootstrapping technique) Copyright 2016, Jason A. CromeAugust 25, 2016
  • 7. Using local::lib # Initialize local::lib (.bashrc, etc.) eval $( perl -Mlocal::lib ); # Install a module cpanm Dancer2 # In your code: # Nothing, you already set this up in your shell :) Copyright 2016, Jason A. CromeAugust 25, 2016
  • 8. perlbrew and plenv • Helps avoid system Perl • Helps avoid system admins • Makes deployments easier • Useful for testing an app against other Perl versions • Install one or more Perl versions to your home directory • More flexible than local::lib Copyright 2016, Jason A. CromeAugust 25, 2016
  • 9. perlbrew and plenv jason@darwin PerlDancer/Dancer2-official (master) 7:22:47 git » plenv versions system aaw-5.22.0 bump-5.24.0 crome-plated dancer-5.10.1 * dancer-5.22.0 (set by ~/Projects/PerlDancer/.perl-version) fifo-5.22.0 pearlbee-5.18.4 vetminder-5.22.0 vetminder-5.24.0 veure-5.18.4 veure-5.22.1 veure-5.24.0 waste-classic waste-tng Copyright 2016, Jason A. CromeAugust 25, 2016
  • 10. perlbrew and plenv • Not compatible with each other • If you want to switch after you have installed one of these, you must completely uninstall the other Copyright 2016, Jason A. CromeAugust 25, 2016
  • 11. perlbrew - Pros and Cons • It’s easy • Don’t need sudo to install Perl modules • Onus is placed on dev to change Perl versions when it is appropriate to do so • When you switch Perl versions, you stay on that version until you switch to another Copyright 2016, Jason A. CromeAugust 25, 2016
  • 12. How perlbrew Works • By abusing your $PATH, that’s how. • When you switch versions of Perl, perlbrew changes your path to point to the desired version of Perl • Does this by exporting some shell functions that switches $PATH when needed • Easy to understand • Written in Perl Copyright 2016, Jason A. CromeAugust 25, 2016
  • 13. Installing perlbrew # From the shell (all you should really need) curl -L https://install.perlbrew.pl | bash perlbrew init # Or, from CPAN sudo cpan App::perlbrew Copyright 2016, Jason A. CromeAugust 25, 2016
  • 14. Using perlbrew # What versions can be installed? perlbrew available # Install a version perlbrew install perl-5.24.0 # List installed versions perlbrew list # Change versions perlbrew switch perl-5.18.4 # Test against all installed versions perlbrew exec dzil test Copyright 2016, Jason A. CromeAugust 25, 2016
  • 15. plenv - Pros and Cons • Lets you set local and global Perl configs • This leaves .perl-version files in its wake. Add to .gitignore • No $PATH munging to work • Less functionality than perlbrew out of the box Copyright 2016, Jason A. CromeAugust 25, 2016
  • 16. How plenv works • Installs to one location and adds it to your path • Creates a shim for each executable (base Perl plus those added through CPAN) • Implemented in bash (no global shell functions) • Shim looks at the appropriate .perl-version file to determine which Perl version to use Copyright 2016, Jason A. CromeAugust 25, 2016
  • 17. What’s in .perl-version? jason@darwin Projects/veure (master*) 10:57:21 git » cat .perl-version veure-5.24.0 Copyright 2016, Jason A. CromeAugust 25, 2016
  • 18. Installing plenv # On mac? brew install plenv brew install perlbuild Copyright 2016, Jason A. CromeAugust 25, 2016
  • 19. Installing plenv # Otherwise git clone https://github.com/tokuhirom/plenv.git ~/.plenv echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bash_profile echo 'eval "$(plenv init -)"' >> ~/.bash_profile exec $SHELL -l git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/ Copyright 2016, Jason A. CromeAugust 25, 2016
  • 20. Using plenv # What versions can be installed? plenv install --list # Install a version plenv install 5.24.0 plenv install 5.24.0 --as dancer2-5.24.0 # List installed versions plenv versions # Change versions plenv local dancer2-5.24.0 plenv global system # Test against all installed versions (need plenv-contrib) plenv exec-all dzil test Copyright 2016, Jason A. CromeAugust 25, 2016
  • 21. Carton • Top-notch dependency management • Can specify a specific range of allowed versions, or a specific one. This is huge! • Runs your app with only the modules you specify • Super-easy to deploy and distribute your app with no module/dependency hell Copyright 2016, Jason A. CromeAugust 25, 2016
  • 22. Why’s this useful? • Consider Veure (Tau Station, our game) • Developer stymied by test failures • Only one on team using Test::Class::Moose 0.77 • Spend inordinate amount of time tracking down to find it was a version issue • Better dependency/module management would have made this a non-issue Copyright 2016, Jason A. CromeAugust 25, 2016
  • 23. How Carton works • Uses cpanfile to specify versions • Can create a cpanfile.snapshot to pin specific versions that are currently installed • Distribute these to other machines with your application to deploy/run your app Copyright 2016, Jason A. CromeAugust 25, 2016
  • 24. What’s in .cpanfile? # This version and any after requires “Dancer2", ">= 0.163000”; # No specific version needed requires "Dancer2::Plugin::Database" => 0; on "test" => sub { requires “Test::More" => "0"; requires “Test::Class::Moose”, ”>= 0.73, < 0.77”; }; Copyright 2016, Jason A. CromeAugust 25, 2016
  • 25. Installing Carton # From CPAN cpanm Carton Copyright 2016, Jason A. CromeAugust 25, 2016
  • 26. Using Carton # Install module version listed in cpanfile from CPAN carton install # Modules are installed to local/ # Version info captured to cpanfile.snapshot # Commit to github git add cpanfile.snapshot git commit -m”Capture module version snapshot.” git push # Clone to other machine, then carton install --deployment # Now, run your app carton exec plackup sbin/app.psgi Copyright 2016, Jason A. CromeAugust 25, 2016
  • 27. Bundling with Carton • carton bundle bundles the tarballs for your modules and their dependencies into a directory • Easy to distribute across a local network • Deploy via carton install --cached • Can install without CPAN or an internet connection Copyright 2016, Jason A. CromeAugust 25, 2016
  • 28. A final note • Carton creates two things in your project directory: local/ and .carton • These should not be distributed with your app • Make it easy: add to .gitignore Copyright 2016, Jason A. CromeAugust 25, 2016
  • 29. Carmel and Pinto Honestly, I have little experience here Both are marked experimental. USE AT YOUR OWN RISK Copyright 2016, Jason A. CromeAugust 25, 2016
  • 30. Carmel • Set up your own CPAN-like repositories of modules • Carmel keeps a repo of all modules you build with it • When you need a module, uses cpanfile to determine what it needs from that repo and builds @INC appropriately. • Carmel and Carton are made to work together Copyright 2016, Jason A. CromeAugust 25, 2016
  • 31. Pinto • Pinto works like a self-curated PAUSE/CPAN • Unlike CPAN, lets you keep different module versions for dev, prod, test, etc. • Has version control. Easy to rollback if you add a broken module release • Allows you to use only modules and versions you want • Works when you are offline/CPAN is down Copyright 2016, Jason A. CromeAugust 25, 2016
  • 32. Thank you! Copyright 2016, Jason A. CromeAugust 25, 2016
  • 33. Resources • local::lib - https://metacpan.org/pod/local::lib • perlbrew - https://perlbrew.pl/ • plenv - https://github.com/tokuhirom/plenv • Carton - https://metacpan.org/pod/Carton • Carmel - https://metacpan.org/pod/Carmel • Pinto - https://metacpan.org/pod/Pinto Copyright 2016, Jason A. CromeAugust 25, 2016