logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: [Module::Build] extra installation directories: msg#00069

Subject: Re: [Module::Build] extra installation directories
Randy W. Sims <ml-perl@xxxxxxxxxxxxxxxxxxxx> wrote:
> >     So now I'm just down to the problem of adding an extra installation
> >directory to the build. I've attached the "Base.pm" with the realclean
> >stuff removed. Does anyone know of an easier, more reuseable way to do
> >this? Any prior art? Or would this be a potential enhancement to
> >Module::Build?
> <http://article.gmane.org/gmane.comp.lang.perl.modules.authors/532>

Randy,

        Thanks for the pointer... this describes how to add an extra
installation directory as a one-off, which is useful, but not quite what I'm
after.

        Subclasses of my package (or even just other packages that use my
package) will probably want to inherit my package's extra build targets. In
my case, it's database schemas located in the "schemas" directory with the
package. The user is asked where they want to put them, but this defaults to
"$Config{siteprefix}/share/schemas".

        So I have a subclass of Module::Build, called
"DBIx::Migration::Directories::Build" (attached).

        If a package uses this subclass instead of calling Module::Build
directly, it gets the installation directory behaviour it wants. But if I
just try to "use" that package in Build.PL, and the user hasn't installed
DBIx::Migration::Directories yet, it just dies with a not-very-useful error
message. My solution so far is the ugly eval {} / if($@) inside the
SYNOPSIS. It works, but it's a lot of lines of code to have to add to every
single build script that for every package that depends on this one.

                - Tyler

Attachment: Build.pm
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>