/ cpan

Perl Toolchain Summit 2017 - CPAN and Perl6

At the 2017 Perl Toolchain Summit (PTS) a lot of stuff got done. This is a brief demonstration style summary of the resulting CPAN-related feature enhancements to zef.

First I should mention that now Perl6 distributions can be uploaded to CPAN (without needing to add a special Perl6/ folder), and will have their source-url automatically set or replaced with the appropriate CPAN url. Additionally App::Mi6 now has mi6 dist and mi6 upload to make the process even simpler.

Now lets get started by making sure we are using a version with features developed at PTS:

$ zef install "zef:ver(v0.1.15+)"
All candidates are currently installed  
No reason to proceed. Use --force to continue anyway  

Perl6 distributions uploaded to CPAN are now indexed. Currently the index is generated by https://github.com/ugexe/Perl6-App--ecogen and stored at https://github.com/ugexe/Perl6-ecosystems alongside a mirror of the existing p6c ecosystem. It is also enabled by default now:

$ zef list --max=10
===> Found via Zef::Repository::Ecosystems<cpan>
Inline:ver('1.2.1')  
Inline:ver('1.2')  
Inline:ver('1')  
IO::Glob:ver('0.1'):auth('github:zostay')  
Text::CSV:ver('0.007'):auth('github:Tux')  
Text::CSV:ver('0.008'):auth('github:Tux')  
Data::Selector:ver('1.01')  
Data::Selector:ver('1.02')  
NativeCall:ver('1')  
CompUnit::Repository::Mask:ver('0.0.1')  
Inline::Perl5:ver('0.26'):auth('github:niner')

$ zef info CompUnit::Repository::Mask
- Info for: CompUnit::Repository::Mask
- Identity: CompUnit::Repository::Mask:ver('0.0.1')
- Recommended By: Zef::Repository::Ecosystems<cpan>
Description:     hide installed modules for testing.  
License:     Artistic-2.0  
Source-url:     http://www.cpan.org/authors/id/N/NI/NINE/Perl6/CompUnit-Repository-Mask-0.0.1.tar.gz  
Provides: 1 modules  
Depends: 0 items

A distribution can exist in multiple "ecosystems":

$ zef search Inline::Perl5
===> Found 3 results
-----------------------------------------------------------------------------------------------------------------------
ID|From                             |Package                                       |Description  
-----------------------------------------------------------------------------------------------------------------------
1 |Zef::Repository::LocalCache      |Inline::Perl5:ver('0.26'):auth('github:niner')|Use Perl 5 code in a Perl 6 program  
2 |Zef::Repository::Ecosystems<cpan>|Inline::Perl5:ver('0.26'):auth('github:niner')|Use Perl 5 code in a Perl 6 program  
3 |Zef::Repository::Ecosystems<p6c> |Inline::Perl5:ver('0.26'):auth('github:niner')|Use Perl 5 code in a Perl 6 program  
-----------------------------------------------------------------------------------------------------------------------

Dependencies can be resolved by any and all ecosystems available, so distributions can be put on cpan and still have their dependencies that aren't get resolved:

$ zef -v install Inline::Perl5
===> Searching for: Inline::Perl5
===> Found: Inline::Perl5:ver('0.26'):auth('github:niner') [via Zef::Repository::Ecosystems<cpan>]
===> Searching for missing dependencies: LibraryMake, File::Temp
===> Found dependencies: File::Temp [via Zef::Repository::Ecosystems<p6c>]
===> Found dependencies: LibraryMake:ver('1.0.0'):auth('github:retupmoca') [via Zef::Repository::LocalCache]
===> Searching for missing dependencies: Shell::Command, File::Directory::Tree
===> Found dependencies: Shell::Command, File::Directory::Tree:auth('labster') [via Zef::Repository::Ecosystems<p6c>]
===> Searching for missing dependencies: File::Which, File::Find
===> Found dependencies: File::Find:ver('0.1'), File::Which [via Zef::Repository::Ecosystems<p6c>]

...<more output>...

In addition to CPAN we have access to CPAN testers. Garu worked with me to create a perl6 cpan testers report module: Zef::CPANReporter

$ zef install Zef::CPANReporter
===> Searching for: Zef::CPANReporter
===> Searching for missing dependencies: Net::HTTP
===> Testing: Net::HTTP:ver('0.0.1'):auth('github:ugexe')
===> Testing [OK] for Net::HTTP:ver('0.0.1'):auth('github:ugexe')
===> Testing: Zef::CPANReporter:ver('0.0.1'):auth('github:garu')
===> Testing [OK] for Zef::CPANReporter:ver('0.0.1'):auth('github:garu')
===> Installing: Net::HTTP:ver('0.0.1'):auth('github:ugexe')
===> Installing: Zef::CPANReporter:ver('0.0.1'):auth('github:garu')

# ...and in use:

$ zef -v install Grammar::Debugger
===> Searching for: Grammar::Debugger
===> Found: Grammar::Debugger:ver('1.0.1'):auth('github:jnthn') [via Zef::Repository::Ecosystems<p6c>]
===> Searching for missing dependencies: Terminal::ANSIColor
===> Found dependencies: Terminal::ANSIColor:ver('0.3') [via Zef::Repository::Ecosystems<p6c>]
===> Fetching [OK]: Grammar::Debugger:ver('1.0.1'):auth('github:jnthn') to /Users/ugexe/.zef/tmp/grammar-debugger.git
===> Fetching [OK]: Terminal::ANSIColor:ver('0.3') to /Users/ugexe/.zef/tmp/Terminal-ANSIColor.git
===> Testing: Terminal::ANSIColor:ver('0.3')
t/00-load.t .. ok  
All tests successful.  
Files=1, Tests=1,  0 wallclock secs  
Result: PASS  
===> Testing [OK] for Terminal::ANSIColor:ver('0.3')
Report for Terminal::ANSIColor:ver('0.3') will be available at http://www.cpantesters.org/cpan/report/a9ed11ac-4108-11e7-9b92-c8514edb94d5  
===> Testing: Grammar::Debugger:ver('1.0.1'):auth('github:jnthn')
t/debugger.t .. ok  
t/ltm.t ....... ok  
t/tracer.t .... ok  
All tests successful.  
Files=3, Tests=3,  1 wallclock secs  
Result: PASS  
===> Testing [OK] for Grammar::Debugger:ver('1.0.1'):auth('github:jnthn')
Report for Grammar::Debugger:ver('1.0.1'):auth('github:jnthn') will be available at http://www.cpantesters.org/cpan/report/ab9c911c-4108-11e7-a777-ca182bdd3934  
===> Installing: Terminal::ANSIColor:ver('0.3')
===> Install [OK] for Terminal::ANSIColor:ver('0.3')
===> Installing: Grammar::Debugger:ver('1.0.1'):auth('github:jnthn')
===> Install [OK] for Grammar::Debugger:ver('1.0.1'):auth('github:jnthn')

This work (and my attendance) was made possible by a bunch of great perl companies and people:

Booking.com, ActiveState, cPanel, FastMail, MaxMind, Perl Careers, MongoDB, SureVoIP, Campus Explorer, Bytemark, CAPSiDE, Charlie Gonzalez, Elastic, OpusVL, Perl Services, Procura, XS4ALL, Oetiker+Partner.