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

Dear Monks
I think I pretty much figured out how to install one module:
> h2xs -AX ABC::Test
change the file Test.pm and install it.
However, what will happen if I would like to install 2 modules, Test.pm and Test1.pm...... What should my h2xs command look like ? The above command only installs Test.pm. I've tried:
> h2xs -AX ABC
But this creates a file ABC.pm, somehow I don't think that is what I want, I want my modules inside the directory ABC
Any suggestions ?

Thanks in advance
Luca

Replies are listed 'Best First'.
Re: How to install self written modules
by rinceWind (Monsignor) on Mar 03, 2006 at 16:10 UTC
    You can put both modules under 1 distribution by putting them under a lib directory.
    > h2xs -AX ABC::Test > cd ABC/Test > mkdir lib > mkdir lib/ABC > mv Test.pm lib/ABC > cp lib/ABC/Test.pm lib/ABC/Test1.pm

    --

    Oh Lord, won’t you burn me a Knoppix CD ?
    My friends all rate Windows, I must disagree.
    Your powers of persuasion will set them all free,
    So oh Lord, won’t you burn me a Knoppix CD ?
    (Missquoting Janis Joplin)

      I like this approach, but what should you change inside the Makefile.PL:
      use 5.008007; use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( NAME => 'ABC::Test', VERSION_FROM => 'lib/ABC/Test.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/ABC/Test.pm', # retrieve abstract from m +odule AUTHOR => 'A. U. Thor <calje@knmi.nl>') : ()), );
      Howto include Test1.pm ?

      Luca

        There's no need to put anything about Test1.pm in the Makefile.PL, as MakeMaker globs the entire lib tree. You can use this to add other modules as dependencies to PREREQ_PM if you need any others packaged separately, or indeed CPAN modules.

        You probably want to take out the line use 5.008007; that h2xs put in, as you are not really dependent on this version of Perl.

        --

        Oh Lord, won’t you burn me a Knoppix CD ?
        My friends all rate Windows, I must disagree.
        Your powers of persuasion will set them all free,
        So oh Lord, won’t you burn me a Knoppix CD ?
        (Missquoting Janis Joplin)

Re: How to install self written modules
by shotgunefx (Parson) on Mar 03, 2006 at 15:14 UTC
    You make it two modules.
    cd mod_working_dir > h2xs -AX ABC::Test > h2xs -AX ABC::Test1

    -Lee
    "To be civilized is to deny one's nature."
      Ok, so you have to do
      perl Makefile.PL make make install
      for each module ?
      What if I've 100 modules ? Do I have to write a install script ?

      Luca
        I've not done a lot of modification to module installation scripts. There might be an easy and obvious solution (damn if I know though)

        You could make a script to make and install them all. Not that good with Make but you could probably right a makefile as well to handle the task.

        I'm getting the impression that you're after plugins. If so, 100 seems like a lot for any medium.

        May I ask what exactly you're trying to do?

        -Lee
        "To be civilized is to deny one's nature."
Re: How to install self written modules
by rhesa (Vicar) on Mar 04, 2006 at 14:08 UTC
    Uhm, wouldn't just adding ABC/Test1.pm to your MANIFEST do the trick? Or is that too obvious?
      Oh, MANIFEST..... where can I read more about this stuff ?

      Thanks
      Luca