SlideShare a Scribd company logo
30 minutes to CPAN

(Minimizing the magic, and demystifying the process.)
30 minutes is pure Marketing Department hype.

       But with practice, it's realistic.
There are many ways to do it.

 This is a good way to start.
Get a PAUSE/CPAN account
●   https://pause.perl.org/pause/query?ACTION=request_id
●   The form takes 2 minutes.
●   The response time can be 1-3 days, so be patient.
●   Make sure to search CPAN ensuring you're not requesting a
    PAUSE ID that is already in use.
Create a directory framework
$ mkdir Foo
$ cd Foo
$ mkdir lib
$ mkdir t
$ mkdir examples
$ touch lib/Foo.pm
$ touch t/00-load.t
$ touch examples/example.pl
$ touch Makefile.PL
$ touch MANIFEST
$ touch Changes
$ touch README
MANIFEST
●   List the files included in your distribution. Comments
    may be added to the right.
    MANIFEST              This file. (And this is a legal comment)
    README                The brief introduction. (Another comment)
    Changes               The change log
    Makefile.PL
    META.json
    META.yml
    lib/Foo.pm
    t/00-load.t
    examples/example.pl
README
●   Brief intro to your module.

●   Just copy one from CPAN as an example and
    modify it to suit your needs.
    –   Too long to post here, mostly boilerplate.

●   No version numbers. No version-specific details.
    –   It will make your life as an author easier.
Changes
●   The change log for CPAN releases. Newer releases are
    listed above older ones. One blank line separates
    releases.

    Change log for Perl module Foo.


    0.02 2013-01-09
      - Fixed all the bugs in version 0.01.


    0.01 2012-11-15
      - First version.
Makefile.PL
use strict;
use warnings;
use 5.006000;
use ExtUtils::MakeMaker;


WriteMakefile( … );
Makefile.PL – WriteMakefile()
WriteMakefile(
     NAME               => 'Foo',
     AUTHOR             => q{Your Name < cpan_acct [at] cpan [dot] org >},
     VERSION_FROM       => 'lib/Foo.pm',
     ABSTRACT_FROM      => 'lib/Foo.pm',
     LICENSE            => 'perl',
     MIN_PERL_VERSION   => '5.006000',
    BUILD_REQUIRES      => { Test::More => '0', },    # Core; needn't be
listed.
     PREREQ_PM          => { List::MoreUtils => '0.33', },
     META_MERGE         => { … },
     dist               => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean              => { FILES => 'Foo-*' },
);
Other Makefile.PL meta info
●   It's helpful to include a META_MERGE section
    in Makefile.PL
    –   List the public version control repositiory.
    –   Other useful meta fields documented in
        CPAN::Meta::Spec
    –   These fields are helpful, but not mandatory.
Testing: t/00-load.t
●   Anything named t/*.t will be run in ASCII-betical
    order as a test.
    use strict;
    use warnings;
    use Test::More;


    use_ok( 'Foo' );
    can_ok( 'Foo', 'bar' ); # Function exists.
    can_ok('main', 'bar');   # Function was imported.
    done_testing();
lib/Foo.pm
●   Your module's code and documentation:
    package Foo;


    use strict;              use warnings;
    use Exporter;


    our @ISA = qw( Exporter );
    our @EXPORT = qw( bar );
    our $VERSION = '0.01';


    sub bar {     print “Hello world!n”;    }


    1;


    =pod
lib/Foo.pm ( =pod )
    =pod
    =head1 NAME
    Foo – The great Foo says hello!
    =head1 SYNOPSIS
        Use Foo;
        Bar();
    =head1 DESCRIPTION
    This module implements a single function, C<bar()> which greets you by
    printing “Hello world!”.
    =head1 EXPORTS
    L<Foo> exports a single function; C<bar()>.


●   Follow your favorite (simple) module's example.
●   Read perldoc perlpod.
examples/example.pl
●   A small working script demonstrating your module.
    use strict;
    use warnings;
    use Foo;


    bar();   # This prints “Hello world.n”



●   Should not be chmod +x (Nor should
    anything else in the distribution).
Prepare the distribution
perl Makefile.PL
make
make test
make distcheck
make disttest
cp Foo-0.01/META.* ./
rm -rf Foo-0.01
make dist
Upload to PAUSE
●   Log in at: http://pause.perl.org


●   Upload at:
    https://pause.perl.org/pause/authenquery?ACTION=add_uri


●   Wait a few hours for the CPAN mirrors to update.


●   Visit http://cpantesters.org to check smoke test results.
Request the namespace.
●   This is a formality, and can take a week to be
    approved.

●   This is done via the PAUSE website.

●   Top-level namespaces are more difficult.

●   Upload first, then request.
Version Numbers
●   Regular Releases
        our $VERSION = '0.01';


●   Always bump the version number before uploading to
    CPAN.

●   Minimize error-prone work: Keep version numbers in as
    few places as practical.
    –   Consider adding a version number consistency test.
Module tests
●   Module tests are important to you and users.
    –   You get feedback from the smoke testers.
    –   Your users gain confidence that the module will work on their
        platform.
    –   Bugs are easier to track down.
●   List additional test dependencies in BUILD_REQUIRES.
●   Some tests such as Test::NoWarnings may be written
    generically, and copied into your next project.
    –   Your next module won't take as long to assemble.
Author / Release Tests
●   Should run optionally
●   Should not fail if a test module dependency isn't
    available.
●   Use environment variables such as RELEASE_TESTING
    to trigger these sorts of tests.
●   Skip and exit gracefully if an optional test's module is
    unavailable on the target system.
●   Generic: They may be useful in your next module.
A few author tests to consider
●   Test::Pod
●   Test::Pod::Coverage
●   Test::CPAN::Changes
●   Test::Manifest
●   Test::Perl::Critic
●   Test::Kwalitee
●   Test::Version
●   Many other favorites are on CPAN – Ask around.
License
●   Make sure the license enumerated in the POD
    matches the one called for in Makefile.PL
●   See:
      $ perldoc perlmodstyle
      $ perldoc perlartistic
      $ perldoc perlgpl
●   License should be referred to in Makefile.PL
    so the META files list it.
License
●   Make sure the license enumerated in the POD
    matches the one called for in Makefile.PL
●   See:
      $ perldoc perlmodstyle
      $ perldoc perlartistic
      $ perldoc perlgpl
●   License should be referred to in Makefile.PL
    so the META files list it.
Next time...
●   Use Module::Starter
    –   Creates a simple template for you, and adds a few
        tests.
●   Copy the generic (especially author-only) tests
    from your previous distribution.
●   Whenver you come up with a test that might
    be useful in other distributions, copy it to them.
Eventually...
●   Some people love Dist::Zilla; a distribution
    automator / manager.
●   Module::Build is a more Perlish alternative to
    ExtUtils::MakeMaker
●   Module::Install is yet another solution that lets
    you bundle prereqs more easily. It simplifies
    creating ExtUtils::MakeMaker-based
    distributions.
References (Really, look them over)
●   POD
    –   perlmodstyle
    –   perlpod
●   On CPAN
    –   Module::Starter
    –   ExtUtils::MakeMaker
    –   CPAN::Meta::Spec
●   In print
    –   Intermediate Perl Programming (O'Reilly)
●   On testing
    –   Test::More
    –   http://cpantesters.org
●   CPAN itself! (Thousands of good – and bad – examples.)
David Oswald

daoswald@gmail.com / davido@cpan.org

More Related Content

What's hot

PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated Features
Mark Niebergall
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
Perl Careers
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
oscon2007
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPAN
charsbar
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
ZendCon
 
PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?
Nick Belhomme
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
SATOSHI TAGOMORI
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
The Software House
 
Php’s guts
Php’s gutsPhp’s guts
Php’s guts
Elizabeth Smith
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
Elizabeth Smith
 
10 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.610 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.6
Webline Infosoft P Ltd
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Tim Bunce
 
Apache Thrift
Apache ThriftApache Thrift
Apache Thrift
knight1128
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshop
Adam Culp
 
Laravel 4 package development
Laravel 4 package developmentLaravel 4 package development
Laravel 4 package development
Tihomir Opačić
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
Hiroshi SHIBATA
 
PSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend ExpressivePSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend Expressive
Milad Arabi
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
Ontico
 

What's hot (20)

PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated Features
 
PSGI and Plack from first principles
PSGI and Plack from first principlesPSGI and Plack from first principles
PSGI and Plack from first principles
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
 
What you need to remember when you upload to CPAN
What you need to remember when you upload to CPANWhat you need to remember when you upload to CPAN
What you need to remember when you upload to CPAN
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
PHP traits, treat or threat?
PHP traits, treat or threat?PHP traits, treat or threat?
PHP traits, treat or threat?
 
Fluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API DetailsFluentd v0.14 Plugin API Details
Fluentd v0.14 Plugin API Details
 
Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
Php’s guts
Php’s gutsPhp’s guts
Php’s guts
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
10 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.610 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.6
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
 
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
Devel::NYTProf v3 - 200908 (OUTDATED, see 201008)
 
Apache Thrift
Apache ThriftApache Thrift
Apache Thrift
 
Zend expressive workshop
Zend expressive workshopZend expressive workshop
Zend expressive workshop
 
Laravel 4 package development
Laravel 4 package developmentLaravel 4 package development
Laravel 4 package development
 
How to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rbHow to develop Jenkins plugin using to ruby and Jenkins.rb
How to develop Jenkins plugin using to ruby and Jenkins.rb
 
PSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend ExpressivePSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend Expressive
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
 

Similar to 30 Minutes To CPAN

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
p3castro
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
Fred Moyer
 
POUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love you
Jacek Gebal
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
Jacek Gebal
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
rkhatibi
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet System
Puppet
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
Workhorse Computing
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
Wirabumi Software
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
Mukesh Agarwal
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
Stanislav Osipov
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
Antony Abramchenko
 
Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication Plugins
Padraig O'Sullivan
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
bpowell29a
 
Perl Modules
Perl ModulesPerl Modules
Perl Modules
stn_tkiller
 
TAFJ
TAFJTAFJ
Orchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and MspectatorOrchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and Mspectator
Raphaël PINSON
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Puppet
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
Puppet
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Steven Pignataro
 
Revisiting ppm
Revisiting ppmRevisiting ppm
Revisiting ppm
charsbar
 

Similar to 30 Minutes To CPAN (20)

Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
 
POUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love you
 
Bgoug 2019.11 test your pl sql - not your patience
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
 
Creating a mature puppet system
Creating a mature puppet systemCreating a mature puppet system
Creating a mature puppet system
 
Creating a Mature Puppet System
Creating a Mature Puppet SystemCreating a Mature Puppet System
Creating a Mature Puppet System
 
Smoking docker
Smoking dockerSmoking docker
Smoking docker
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
 
Drupal Best Practices
Drupal Best PracticesDrupal Best Practices
Drupal Best Practices
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication Plugins
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
Perl Modules
Perl ModulesPerl Modules
Perl Modules
 
TAFJ
TAFJTAFJ
TAFJ
 
Orchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and MspectatorOrchestrated Functional Testing with Puppet-spec and Mspectator
Orchestrated Functional Testing with Puppet-spec and Mspectator
 
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
Orchestrated Functional Testing with Puppet-spec and Mspectator - PuppetConf ...
 
Wrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from PuppetWrangling 3rd Party Installers from Puppet
Wrangling 3rd Party Installers from Puppet
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
Revisiting ppm
Revisiting ppmRevisiting ppm
Revisiting ppm
 

More from daoswald

Perl: Setting Up An Internal Darkpan
Perl: Setting Up An Internal DarkpanPerl: Setting Up An Internal Darkpan
Perl: Setting Up An Internal Darkpan
daoswald
 
Speaking at Tech Events
Speaking at Tech EventsSpeaking at Tech Events
Speaking at Tech Events
daoswald
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
daoswald
 
Whatsnew in-perl
Whatsnew in-perlWhatsnew in-perl
Whatsnew in-perl
daoswald
 
Add Perl to Your Toolbelt
Add Perl to Your ToolbeltAdd Perl to Your Toolbelt
Add Perl to Your Toolbelt
daoswald
 
Think Like a Programmer
Think Like a ProgrammerThink Like a Programmer
Think Like a Programmer
daoswald
 
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
daoswald
 
Perls Functional functions
Perls Functional functionsPerls Functional functions
Perls Functional functions
daoswald
 

More from daoswald (8)

Perl: Setting Up An Internal Darkpan
Perl: Setting Up An Internal DarkpanPerl: Setting Up An Internal Darkpan
Perl: Setting Up An Internal Darkpan
 
Speaking at Tech Events
Speaking at Tech EventsSpeaking at Tech Events
Speaking at Tech Events
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
 
Whatsnew in-perl
Whatsnew in-perlWhatsnew in-perl
Whatsnew in-perl
 
Add Perl to Your Toolbelt
Add Perl to Your ToolbeltAdd Perl to Your Toolbelt
Add Perl to Your Toolbelt
 
Think Like a Programmer
Think Like a ProgrammerThink Like a Programmer
Think Like a Programmer
 
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
 
Perls Functional functions
Perls Functional functionsPerls Functional functions
Perls Functional functions
 

Recently uploaded

High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
aslasdfmkhan4750
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
ssuser1915fe1
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
The importance of Quality Assurance for ICT Standardization
The importance of Quality Assurance for ICT StandardizationThe importance of Quality Assurance for ICT Standardization
The importance of Quality Assurance for ICT Standardization
Axel Rennoch
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
Tatiana Al-Chueyr
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Zilliz
 
Salesforce AI & Einstein Copilot Workshop
Salesforce AI & Einstein Copilot WorkshopSalesforce AI & Einstein Copilot Workshop
Salesforce AI & Einstein Copilot Workshop
CEPTES Software Inc
 
CiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.pptCiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.ppt
moinahousna
 
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
Edge AI and Vision Alliance
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
ldtexsolbl
 
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
BrainSell Technologies
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
aakash malhotra
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes..."Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
Anant Gupta
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
Priyanka Aash
 
IPLOOK Remote-Sensing Satellite Solution
IPLOOK Remote-Sensing Satellite SolutionIPLOOK Remote-Sensing Satellite Solution
IPLOOK Remote-Sensing Satellite Solution
IPLOOK Networks
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
Zilliz
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
RaminGhanbari2
 

Recently uploaded (20)

High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
High Profile Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class ...
 
Feature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptxFeature sql server terbaru performance.pptx
Feature sql server terbaru performance.pptx
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
The importance of Quality Assurance for ICT Standardization
The importance of Quality Assurance for ICT StandardizationThe importance of Quality Assurance for ICT Standardization
The importance of Quality Assurance for ICT Standardization
 
Best Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdfBest Practices for Effectively Running dbt in Airflow.pdf
Best Practices for Effectively Running dbt in Airflow.pdf
 
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and OllamaTirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
Tirana Tech Meetup - Agentic RAG with Milvus, Llama3 and Ollama
 
Salesforce AI & Einstein Copilot Workshop
Salesforce AI & Einstein Copilot WorkshopSalesforce AI & Einstein Copilot Workshop
Salesforce AI & Einstein Copilot Workshop
 
CiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.pptCiscoIconsLibrary cours de réseau VLAN.ppt
CiscoIconsLibrary cours de réseau VLAN.ppt
 
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
“Deploying Large Language Models on a Raspberry Pi,” a Presentation from Usef...
 
Types of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technologyTypes of Weaving loom machine & it's technology
Types of Weaving loom machine & it's technology
 
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdfAcumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
Acumatica vs. Sage Intacct vs. NetSuite _ NOW CFO.pdf
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024Three New Criminal Laws in India 1 July 2024
Three New Criminal Laws in India 1 July 2024
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes..."Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
"Mastering Graphic Design: Essential Tips and Tricks for Beginners and Profes...
 
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
(CISOPlatform Summit & SACON 2024) Digital Personal Data Protection Act.pdf
 
IPLOOK Remote-Sensing Satellite Solution
IPLOOK Remote-Sensing Satellite SolutionIPLOOK Remote-Sensing Satellite Solution
IPLOOK Remote-Sensing Satellite Solution
 
Using LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and MilvusUsing LLM Agents with Llama 3, LangGraph and Milvus
Using LLM Agents with Llama 3, LangGraph and Milvus
 
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyyActive Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
Active Inference is a veryyyyyyyyyyyyyyyyyyyyyyyy
 

30 Minutes To CPAN

  • 1. 30 minutes to CPAN (Minimizing the magic, and demystifying the process.)
  • 2. 30 minutes is pure Marketing Department hype. But with practice, it's realistic.
  • 3. There are many ways to do it. This is a good way to start.
  • 4. Get a PAUSE/CPAN account ● https://pause.perl.org/pause/query?ACTION=request_id ● The form takes 2 minutes. ● The response time can be 1-3 days, so be patient. ● Make sure to search CPAN ensuring you're not requesting a PAUSE ID that is already in use.
  • 5. Create a directory framework $ mkdir Foo $ cd Foo $ mkdir lib $ mkdir t $ mkdir examples $ touch lib/Foo.pm $ touch t/00-load.t $ touch examples/example.pl $ touch Makefile.PL $ touch MANIFEST $ touch Changes $ touch README
  • 6. MANIFEST ● List the files included in your distribution. Comments may be added to the right. MANIFEST This file. (And this is a legal comment) README The brief introduction. (Another comment) Changes The change log Makefile.PL META.json META.yml lib/Foo.pm t/00-load.t examples/example.pl
  • 7. README ● Brief intro to your module. ● Just copy one from CPAN as an example and modify it to suit your needs. – Too long to post here, mostly boilerplate. ● No version numbers. No version-specific details. – It will make your life as an author easier.
  • 8. Changes ● The change log for CPAN releases. Newer releases are listed above older ones. One blank line separates releases. Change log for Perl module Foo. 0.02 2013-01-09 - Fixed all the bugs in version 0.01. 0.01 2012-11-15 - First version.
  • 9. Makefile.PL use strict; use warnings; use 5.006000; use ExtUtils::MakeMaker; WriteMakefile( … );
  • 10. Makefile.PL – WriteMakefile() WriteMakefile( NAME => 'Foo', AUTHOR => q{Your Name < cpan_acct [at] cpan [dot] org >}, VERSION_FROM => 'lib/Foo.pm', ABSTRACT_FROM => 'lib/Foo.pm', LICENSE => 'perl', MIN_PERL_VERSION => '5.006000', BUILD_REQUIRES => { Test::More => '0', }, # Core; needn't be listed. PREREQ_PM => { List::MoreUtils => '0.33', }, META_MERGE => { … }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Foo-*' }, );
  • 11. Other Makefile.PL meta info ● It's helpful to include a META_MERGE section in Makefile.PL – List the public version control repositiory. – Other useful meta fields documented in CPAN::Meta::Spec – These fields are helpful, but not mandatory.
  • 12. Testing: t/00-load.t ● Anything named t/*.t will be run in ASCII-betical order as a test. use strict; use warnings; use Test::More; use_ok( 'Foo' ); can_ok( 'Foo', 'bar' ); # Function exists. can_ok('main', 'bar'); # Function was imported. done_testing();
  • 13. lib/Foo.pm ● Your module's code and documentation: package Foo; use strict; use warnings; use Exporter; our @ISA = qw( Exporter ); our @EXPORT = qw( bar ); our $VERSION = '0.01'; sub bar { print “Hello world!n”; } 1; =pod
  • 14. lib/Foo.pm ( =pod ) =pod =head1 NAME Foo – The great Foo says hello! =head1 SYNOPSIS Use Foo; Bar(); =head1 DESCRIPTION This module implements a single function, C<bar()> which greets you by printing “Hello world!”. =head1 EXPORTS L<Foo> exports a single function; C<bar()>. ● Follow your favorite (simple) module's example. ● Read perldoc perlpod.
  • 15. examples/example.pl ● A small working script demonstrating your module. use strict; use warnings; use Foo; bar(); # This prints “Hello world.n” ● Should not be chmod +x (Nor should anything else in the distribution).
  • 16. Prepare the distribution perl Makefile.PL make make test make distcheck make disttest cp Foo-0.01/META.* ./ rm -rf Foo-0.01 make dist
  • 17. Upload to PAUSE ● Log in at: http://pause.perl.org ● Upload at: https://pause.perl.org/pause/authenquery?ACTION=add_uri ● Wait a few hours for the CPAN mirrors to update. ● Visit http://cpantesters.org to check smoke test results.
  • 18. Request the namespace. ● This is a formality, and can take a week to be approved. ● This is done via the PAUSE website. ● Top-level namespaces are more difficult. ● Upload first, then request.
  • 19. Version Numbers ● Regular Releases our $VERSION = '0.01'; ● Always bump the version number before uploading to CPAN. ● Minimize error-prone work: Keep version numbers in as few places as practical. – Consider adding a version number consistency test.
  • 20. Module tests ● Module tests are important to you and users. – You get feedback from the smoke testers. – Your users gain confidence that the module will work on their platform. – Bugs are easier to track down. ● List additional test dependencies in BUILD_REQUIRES. ● Some tests such as Test::NoWarnings may be written generically, and copied into your next project. – Your next module won't take as long to assemble.
  • 21. Author / Release Tests ● Should run optionally ● Should not fail if a test module dependency isn't available. ● Use environment variables such as RELEASE_TESTING to trigger these sorts of tests. ● Skip and exit gracefully if an optional test's module is unavailable on the target system. ● Generic: They may be useful in your next module.
  • 22. A few author tests to consider ● Test::Pod ● Test::Pod::Coverage ● Test::CPAN::Changes ● Test::Manifest ● Test::Perl::Critic ● Test::Kwalitee ● Test::Version ● Many other favorites are on CPAN – Ask around.
  • 23. License ● Make sure the license enumerated in the POD matches the one called for in Makefile.PL ● See: $ perldoc perlmodstyle $ perldoc perlartistic $ perldoc perlgpl ● License should be referred to in Makefile.PL so the META files list it.
  • 24. License ● Make sure the license enumerated in the POD matches the one called for in Makefile.PL ● See: $ perldoc perlmodstyle $ perldoc perlartistic $ perldoc perlgpl ● License should be referred to in Makefile.PL so the META files list it.
  • 25. Next time... ● Use Module::Starter – Creates a simple template for you, and adds a few tests. ● Copy the generic (especially author-only) tests from your previous distribution. ● Whenver you come up with a test that might be useful in other distributions, copy it to them.
  • 26. Eventually... ● Some people love Dist::Zilla; a distribution automator / manager. ● Module::Build is a more Perlish alternative to ExtUtils::MakeMaker ● Module::Install is yet another solution that lets you bundle prereqs more easily. It simplifies creating ExtUtils::MakeMaker-based distributions.
  • 27. References (Really, look them over) ● POD – perlmodstyle – perlpod ● On CPAN – Module::Starter – ExtUtils::MakeMaker – CPAN::Meta::Spec ● In print – Intermediate Perl Programming (O'Reilly) ● On testing – Test::More – http://cpantesters.org ● CPAN itself! (Thousands of good – and bad – examples.)