I need to create a CPAN module, but I don't know where to start or how to do that. I've already written my modules in Perl, but I don't know how to continue. Could anyone help?
Before you can use CPAN, you need to install the Perl-CPAN package, using the DNF package manager as shown. Note: Although most Perl modules are written in Perl, some use XS – they are written in C and so require a C compiler which is included in the Development Tools package.
Install App::cpanminus from CPAN (use: cpan App::cpanminus for this). Type cpanm --uninstall Module::Name (note the " m ") to uninstall the module with cpanminus.
CPAN doesn't actually install files. It runs the install script embedded in each distribution, which then performs the actual install. For distributions using ExtUtils::MakeMaker, the defaults are documented here: https://metacpan.org/pod/ExtUtils::MakeMaker#make-install (and the default value of INSTALLDIRS is site ).
You need to do two main things before you can get started.
First of all, you need to create a PAUSE account. PAUSE is the service that maintains what goes into CPAN. It's a bit dated, but start here and read through it. It boils down to choosing a name, creating an account and waiting to be approved.
Next you have to decide how to package up your module. You can choose from various tools, or build your distribution yourself.
You might also want to read the SEE ALSO section on each of the ones I've linked. They point to each other. Have a play around, and pick the one that speaks to you.
Then you have to chose a name for your distribution. There is some guidance on this in the PAUSE page I linked above.
Make sure to include useful documentation, write tests, and put your code on github. Put that into the meta data file.
Finally, you bundle it, and then upload it to PAUSE. The bundle is a tarbal with a specific name. You can create that manually or with one of the above-mentioned tools.
Uploading can be done manually through the website, with a command line tool like cpan-upload, or with the bundler if it includes that feature. After a while you get an email from PAUSE that tells you it's there and waiting for indexing (CPAN Upload: ...), and then it shows up on metacpan.org. You'll get another email from PAUSE (PAUSE Indexer report ...) telling you when it's ready.
After some more time, you might get emails from CPAN testers, which smoke tests all new uploads against a multitude of platforms. Sometimes stuff breaks, and you'll hear about it. This is why having good tests is important.
Here are some additional resources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With