Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Creating a distribution with several .pm files

by Ovid (Cardinal)
on Jun 04, 2002 at 04:04 UTC ( #171397=perlquestion: print w/replies, xml ) Need Help??
Ovid has asked for the wisdom of the Perl Monks concerning the following question:

Okay, I'm stumped. I've read the h2xs docs and the ExtUtils::MakeMaker docs and I know I must be missing something blindingly obvious.

I have a series of Perl modules that I've downloaded and I would like to clean them up, write tests, and create a proper distribution. How do I tell h2xs that I need several .pm files? Alternatively, what do I add to Makefile.PL that will allow this?

The modules have a structure like this:



Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

  • Comment on Creating a distribution with several .pm files

Replies are listed 'Best First'.
Re: Creating a distribution with several .pm files
by samtregar (Abbot) on Jun 04, 2002 at 04:16 UTC
    I don't think you can get h2xs to do anything about it, but it's easy to do manually. Just create a lib/ directory and construct your tree there. Then edit Makefile.PL and change references to to lib/Foo/ Finally, adjust MANIFEST accordingly and you're good to go.


    PS: I cover this topic in my book. Buy a copy and support the artist of this message!

Re: Creating a distribution with several .pm files
by Dog and Pony (Priest) on Jun 04, 2002 at 07:14 UTC
    You can also have a look at the excellent writeups How to make a CPAN Module Distribution and ExtUtils::ModuleMaker, which both mentions some ways (and some shortcuts) on how to do this... although, if I recall correctly, h2xs has no such ability in itself. :)
    You have moved into a dark place.
    It is pitch black. You are likely to be eaten by a grue.
Re: Creating a distribution with several .pm files
by Sweeper (Pilgrim) on Jun 04, 2002 at 06:05 UTC
    Part of the answer: in Foo/Makefile.PL, include a line:
    Writemakefile(NAME => 'Bar',
       blah blah blah
       DIR => [ 'Bar' ]
    And then, create a Foo/Bar/Makefile.PL. But in this new file, how do you specify both and Guess we have to look further in the docs.
Re: Creating a distribution with several .pm files
by ides (Deacon) on Jun 04, 2002 at 13:57 UTC
    Here is what I've always done:

    h2xs -X -A Foo::Bar
    h2xs -X -A Foo::Bar::Baz
    h2xs -X -A Foo::Bar::Quux

    Then assuming that 'Bar' is your package ( i.e. Baz AND Quux will always be built and installed together ) you need to do a 'make manifest' in ./Foo/Bar

    MakeMaker will automagically traverse the directory structure on build, the 'make manifest' simply makes it easier to package ./Foo/Bar/* into a .tar.gz with a 'make dist'

    You won't have a ./Foo/ because h2xs creates a directory for each module. Hope this helps.

    Frank Wiles <>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://171397]
Approved by samtregar
Front-paged by sparkyichi
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-10-23 08:14 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (125 votes). Check out past polls.