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

Dear fellow monks

Some days ago I started rewriting a project of mine -a Perl framework to be used with LDAP applications, and I avidly read perrin's question about writing CPAN modules and your advice about starting a large project.

I went further looking for information on how to write my modules to be CPAN-ready. I hit chapter 22 of the camel book (3rd edition), and several nodes here at perlmonks.org, like this tutorial and, from there, perlnewmod and MakeMaker's documentation.

Unfortunately, all this docs are focused mainly on building a one-module distribution. The tutorial gives some advice on multi-module distros, but that approach doesn't seem to scale well to me when you have a lot of modules variously distributed and as deep as in: MyModule::Widget::Tk::Window.pm, MyModule::Widget::Gtk::Window...

Any other document for me to RTFM? Any advice? Any pointer?

As always, thanks a lot!

--bronto

# Another Perl edition of a song:
# The End, by The Beatles
END {
  $you->take($love) eq $you->made($love) ;
}

Replies are listed 'Best First'.
Re: One more question about building a multimodule distribution
by kvale (Monsignor) on Jun 26, 2002 at 18:53 UTC
    Using ExtUtils::ModuleMaker it is easy to create multiple modules. From the synopsis,
    use ExtUtils::ModuleMaker; Generate_Module_Files ( NAME => 'Sample::Module::Foo', ABSTRACT => 'a sample module', AUTHOR => {NAME => 'A. U. Thor', EMAIL => 'a.u.thor@a.galaxy.far.far.away', CPANID => 'AUTHOR', WEBSITE => 'http://a.galaxy.far.far.away/mod +ules', }, VERSION => 0.01, LICENSE => 'perl', EXTRA_MODULES=> [ { NAME => 'Sample::Module::Bar', ABSTRACT => 'a second module', }, { NAME => 'Sample::Baz', ABSTRACT => 'a third module', }, ], );
    So it seems that the work of adding modules is linear in the number of modules, a reasonable scaling to me.

    If your modules all have very similar names you could populate the EXTRA_MODULES array with a loop:
    my $root = 'Foo::Bar::'; my @extras; my @leaves = qw|Baz Plugh Xyzzy|; foreach (@leaves) { push @extras, { NAME => $root . $_, ABSTRACT => "$_ module", }; }
    -Mark
      From the synopsis,...So it seems that the work of adding modules is linear in the number of modules, a reasonable scaling to me.

      Me too! :-)

      I referred the non-scalability to the approach I found in the tutorial, namely:

      So as you can see all you need to do is make a Bar/ directory in your root dir and place Baz.pm in this. If you want h2xs to write the Baz.pm stub.....don't bother! Simply do this:
      $ cd Foo-Bar-0.01 $ mkdir Bar $ cp Bar.pm ./Bar/Baz.pm $ cd Bar $ perl -pi.bak -e 's/Foo::Bar/Foo::Bar::Baz/g' Baz.pm $ rm Baz.pm.bak

      which is not very scalable, IMHO...

      Thanks kvale, I didn't get it when I read the doc. I'll try it ASAP!

      Ciao!
      --bronto

      # Another Perl edition of a song:
      # The End, by The Beatles
      END {
      
        $you->take($love) eq $you->made($love) ;
      }