On Wed, 01 Oct 2003 11:48:20 -0500, Eric Lease Morgan wrote:
>
>�How do I create a standard Perl module intended for distribution?
>
>
I'm going to assume that by "intended for distribution" you mean distribution among 
colleagues rather than distribution via CPAN.  If you intend the latter, then you 
should be looking for an appropriate name within the CPAN hierarchy.  But assuming 
that's not the case, ...

>�First of all, after looking at the mailing list archives, this
>�looks like a list where I can ask my question, but if not, then
>�please excuse my intrusion.
>
It's on topic, provided you've read the documentation provided with Perl:
  perldoc perlmod
  perldoc perlnewmod
 ...

[snip]
>
>�I want to re-create MyLibrary in the most Perl-standard fashion,

Bravo!

>�and consequently, I need to have things like a MANIFEST file, a
>�Makefile.PL, a t directory, and a README file in my distribution.
>
>�My Perl Cookbook says I should use this command to initialize my
>�project:
>
>
>�h2xs -XA -n MyLibrary
>
>
>�Fine, but I never expect to have an actual package named
>�MyLibrary.pm.

Never say never.  You may find that you have certain methods or even private 
subroutines that are widely shared among the various packages in your distribution.  
If so, then you should allow for the possibility of inheriting these methods/routines 
from a parent module.  You can do so by letting h2xs do its thing and create 
MyLibrary.pm.  At the present time, it need only have:

   package MyLibrary;
   $VERSION = 0.01;
   1;

Then, you can create all the packages which you already know you want by cloning the 
structure of MyLibrary.pm and inserting their names into the (one and only) MANIFEST.

Instead, I suspect I will have various sub-packages
>�such as MyLibrary::Librarian, MyLibrary::Resource, and
>�MyLibrary::Patron. Consequently, I could do this:
>
>�h2xs -XA -n MyLibrary::Librarian
>
>
>�Unfortunately, this invocation creates a Librarian directory with
>�all the necessary files, and if I were to do this for each of my
>�packages, then I would have bunches o' MANIFESTs to keep up with.
>�Non-standard.
>
>�Assuming my MyLibrary module is going to have many sub-packages,
>�how do I create the skeleton of my module with the h2xs command?
>

As described above.

>�On the other hand, maybe I should have a file named MyLibrary.pm
>�and all it contains is a version number, abstract, and pointers to
>�the sub-packages?

Yes, as described above.  (But what do you mean by "abstract" and "pointers"?  Do you 
mean POD?)

HTH

jimk


Reply via email to