# from Graham TerMarsch
# on Thursday 26 October 2006 03:14 pm:

Hi Graham,

>With MB, having to subclass in order to add-in new features to the
> build works great, except that it doesn't let me split out those
> features into something that I can easily re-use from one project to
> the next.

What good timing.  Did you see my mail about Module::Hack?

  http://www.nntp.perl.org/group/perl.module.build/422

>        use base qw( Module::Build::Pluggable );
>
>        # then, load up MBP plug-ins
>        use Module::Build::Plugin::example;
>        use Module::Build::Plugin::...
>        use Module::Build::Plugin::...

The trouble is that you have to have M::B::Pluggable for installation.  
This is certainly valid where the installer requires the plugins, but 
what about when the plugins are only for development or build dist?

  use inc::builder;
  use base builder('Module::Build::Pluggable');

Your base would then be Module::Build::Pluggable so long as that module 
is installed.

Then of course your subclass needs to check whether that worked before 
requiring the plugins.  Maybe   

  if(__PACKAGE__->isa('Module::Build::Pluggable')) {
    require Module::Build::Plugin::example;
  }

or something, but that drops the import.  Might be better to do

  Module::Build::Plugin->import(
    plugins => [qw(
      Module::Build::Plugin::example
      Module::Build::Plugin::blah
    )]
  );

?

My main comment is that the plugins should only be needed where and when 
they are needed.  Making sure we have them installed can be covered by 
requires, build_requires, and (hopefully) dev_requires.

--Eric
-- 
"Insert random misquote here"
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to