Cody Pendant has asked for the wisdom of the Perl Monks concerning the following question:

I've written a module. It works. But that's all I've done, just Module.pm.

Now I want to make it ready for CPAN, so I need to make a proper package with tests and makefiles and so on.

How do I do that? There are modules out there, like ModuleStarter and ModuleMaker, which create modules from scratch, with a README and a Makefile.pl and so on, but they seem to be for the creation of empty module templates. My module is ready to go, so what I need is something which creates the makefile and everything else based on the finished module file.



($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
=~y~b-v~a-z~s; print
  • Comment on How to make a module ready for public release?

Replies are listed 'Best First'.
Re: How to make a module ready for public release?
by gryphon (Abbot) on Aug 16, 2005 at 06:14 UTC
      Thanks a lot gryphon. Very useful stuff.


      ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
      =~y~b-v~a-z~s; print
Re: How to make a module ready for public release?
by jhourcle (Prior) on Aug 16, 2005 at 03:23 UTC

    You can use ModuleMaker or the like to create the templates in a different directory, so that you don't overwrite your code, then just place your existing stuff in the right places, and finish up the documentation, tests, etc.

    Nothing says that they have to be run before you start writing your module.

      OK, but, don't they have to read my module, see which other modules it requires, etc., in order to create the correct Makefile.pl and so on? Or is all that done at installation time? As you can see I know very little about the make process.


      ($_='kkvvttuu bbooppuuiiffss qqffssmm iibbddllffss')
      =~y~b-v~a-z~s; print
        OK, but, don't they have to read my module, see which other modules it requires, etc., in order to create the correct Makefile.pl and so on? Or is all that done at installation time?

        No. You need to edit the created Makefile.PL (or, better, Build.PL) to add in the dependencies and stuff like that.

        My recommendation would be:

        1. Install Module::Starter
        2. Start a new module (in a different directory) with the same name as your module - that will give you all of the scaffolding required)
        3. Edit the files to add in your code and make any other required changes
        --
        <http://dave.org.uk>

        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

Re: How to make a module ready for public release?
by kprasanna_79 (Hermit) on Aug 16, 2005 at 06:28 UTC
    Hai Cody Pendant,

    Please download the book Writing Perl Modules for CPAN. This book gives all u wanted for ur code to be ready for cpan. The author samtregar, he himself given this link in one of his reply.

    -Prasanna.K
Re: How to make a module ready for public release?
by BerntB (Deacon) on Aug 16, 2005 at 06:29 UTC
    This might be what you look for?

    'h2xs' is quite nice, since you get a nice t/ dir for your tests, etc.

    You can read about h2xs in the Camel book or the Cookbook and others.

    (Update: Ah, Tregar's book. I own it on paper, so I had forgotten it was on the net.)

    20050816 Janitored by Corion: Removed link to copy of O'Reilly book

      That can't be legal, someone should tell O'Reilly

      Why don't you do it. O'Reilly have been known to send free books to people who report stuff like that to them.

      --
      <http://dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg