Re: [Module::Build] M::B subclass .pm file locations
Status: Beta
Brought to you by:
kwilliams
|
From: Randy W. S. <ml...@th...> - 2006-06-06 01:55:49
|
Ray Zimmerman wrote:
> I'm looking for recommendations for how where to put my Module::Build
> sub-classes and how to set up @INC to find them.
>
> Here's my scenario ... I'm working with a set of Perl packages that are
> organized as a base package A with a number of add-on packages. Let's
> call one of the add-on packages B. So A is a prerequisite for B (i.e. A
> must be installed in order to build, test and install any of B). I have
> a common Module::Build sub-class, call it Bbuilder, that I use for all
> B. Since A must be installed in order to build B anyway, it seems
> logical to have Bbuilder.pm be included as part of A. To build A, I have
> another M::B sub-class, call it Abuilder, which is a sub-class of Bbuilder.
>
> If Bbuilder.pm is placed in A/lib, it gets installed as part of A and
> the Build.PL script for B is very straightforward. The question is,
> where do I put Abuilder.pm, and how do I manipulate @INC inside the
> Build.PL script for A to get what I want. Are there conventions for
> where to put these things?
>
> I'm currently thinking of putting Abuilder.pm in A/t and Bbuilder in
> A/lib and doing ...
>
> use lib qw( lib t );
> require Abuilder;
>
> ... at the beginning of Build.PL. Any better ideas?
The de facto here is to place any modules needed only for the build
process into a directory named 'inc'. This is what M::B itself does.
Otherwise, it's exactly as I would do it.
So you have
App/
inc/
App/Builder.pm
lib/
App.pm
App/Plugin/Builder.pm
...
App-Plugin
...
The Build.PL for App would be something like:
use lib 'inc';
use App::Builder;
my $b = App::Builder->new(
module => 'App',
...
);
__END__
And the Build.PL for App::Plugin:
use App::Plugin::Builder;
my $b = App::Plugin::Builder->new(
module => 'App::Plugin',
build_requires => {
App => 0,
App::Plugin::Builder => 0,
},
);
__END__
|