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

Hello:

I am using gnu's automake for a suite of ~40 small c programs. I've written a perl program to generate graphics. Depending on some command line switches, the program would use different modules I am also writing. It is unclear to me how to use automake to put the module in the right place. Thoughts about what to do?

Thanks,
doug
quaternions.sf.net

Replies are listed 'Best First'.
Re: automake and perl modules
by friedo (Prior) on Aug 02, 2006 at 02:58 UTC
    What exactly do you mean by "put the module in the right place?" Why not just load the appropriate module at runtime?

    Module::Starter will generate a Makefile.PL which will generate an appropriate Makefile for a Perl module, which you can hook into and tweak if necessary. But the default behavior is generally sufficient.

    Unless you really need a Makefile, Module::Build is a more modern alternative.

      I'll use Module::Build. It looks like I need to make a directory lib/foo/ for a module foo::bar that has the file lib/foo/bar.pm. Then I write a simple Build.PL file like so:
      use Module::Build;
      
      my $build = Module::Build->new
      (
           module_name => 'CLQ::QGraphGnuPlot',
           license  => 'GPL2.0'
      );
      
      $build->create_build_script;
      
      In a Makefile.in used by automake, I include a command to run "perl Build.PL; Build; Built install"

      Thanks,
      doug

        You could also use ExtUtils::MakeMaker couldn't you ? ie, create a directory lib/foo that contains bar.pm, write a standard Makefile.PL, and then in the Makefile.in (used by automake), include a command to run "perl Makefile.PL; make install".

        Mind you, I've nothing against you wanting to use Module::Build ... I'm just curious to know if EU::MM is in some way deficient for the purpose of this exercise.

        Cheers,
        Rob