I want to share the experience of the first publication of my module on
cpan.org . We assume that the module itself has already been written. In my case, it was a module
VK :: App . It will be about how to properly build a distribution and publish it on cpan.org.
The publication of the module consists of three stages:
Register at pause.perl.org
To load modules on cpan, a special system
pause.perl.org has been made . We follow the
link , we go through not a complicated registration procedure. As a result, we get
pause_id and email of the form
pause_id@cpan.org . The email you entered during registration will receive messages from the
pause.perl.org and
cpantesters.org systems . But in the documentation for your module, it is recommended that you specify
pause_id@cpan.org as your email. In order to configure a redirect from
pause_id@cpan.org to your private email, log in to
pause.perl.org , go to the menu item “Edit Account Info”, in the field “Secret email address” enter the email for the redirect, at the very bottom of the page select the radio button “my secret email address”, click Submit. Changes will take effect in a few hours. By the way, if you do not set up such a redirect, you will not be able to tie your cpan account to the wonderful service
metacpan.org because for binding, it needs your
pause_id to which it sends an activation letter.
Build distributive
There are many tools to automate this process. Here in this
article describes most of them.
')
I opted for ExtUtils :: ModuleMaker. We write a small script make_module.pl:
We place it in some temporary directory and run it. It generates a template for our distribution. Next, create a directory for the distribution. If the name of the VK :: App module and its version is 0.01, then the directory should be called VK-App-0.01. After that, copy the template to VK-App-0.01 and replace the template App.pm with the real one.
$ perl make_module.pl $ mkdir VK-App-0.01 $ cp -r VK/App/* VK-App-0.01 $ cp real/App.pm VK-App-0.01/lib/VK
Your module’s dependencies on others are listed in the Makefile.PL.
PREREQ_PM => { 'Test::Simple' => 0.44, 'LWP' => 5.834, 'LWP::Protocol::https' => '0', 'JSON' => 2.53, },
I had only two of them: LWP and JSON. Test :: Simple is added there automatically when the distribution template is regenerated. Module versions can be recognized by the commands:
$ perl -MLWP -e 'print "$LWP::VERSION\n"' $ perl -MJSON -e 'print "$JSON::VERSION\n"'
If any version fits, the Makefile.PL indicates 0.
All distribution is ready. It is necessary to pack it and you can check the performance.
$ tar -czf VK-App-0.01.tar.gz VK-App-0.01 $ cd VK-App-0.01 $ perl Makefile.PL $ make $ make test
Registering the module name and downloading the distribution
An important stage in the publication of the module is the registration of its name. To do this, in
pause.perl.org we go to the “Register Namespace” and thoughtfully fill in all the fields. Special attention should be paid to the fields “Modules with similar functionality” and “Rationale”. The first is to list the names of similar modules. In the second to tell in detail, how your module differs from others and why it should be called exactly as you called it.
After that we go to “Upload a file to CPAN” and upload our VK-App-0.01.tar.gz archive there and wait. In my case, the module appeared on cpan.org in about a day.