Quoth mose...@hank.org (Bill Moseley):
> On Tue, Apr 28, 2009 at 06:56:04PM -0400, Hans Dieter Pearcey wrote:
> > On Tue, Apr 28, 2009 at 03:52:18PM -0700, Bill Moseley wrote:
> > > What's the best way to setup my package and Makefile.PL to place the
> > > config files in a package-specific directory?  And then what's the
> > > best way in the script to find the installed location of these files
> > > when the script runs?
> > 
> > Install them into blib/arch/auto/share/dist/Your-Dist-Name, assuming
> > that ends up in the right place when using EUMM.
> 
> Ok, the package is currently using EUMM but I'm not clear how to use
> MM to install the config files.  Is it better to use "install_share"
> with Module::Install?

Well, the equivalent to using Module::Install::Share would be something
like

    # the contents of this directory will be copied into dist_dir.
    my $dir = "share";

    my $S = ($^O eq "MSWin32") ? "\\" : "/";

    sub MY::postamble {
        return <<"END_MAKEFILE";
    config ::
    \t\$(NOECHO) \$(MOD_INSTALL) \\
    \t\t"$dir" \$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)

    END_MAKEFILE
    }

in your Makefile.PL. If you already have a MY::postamble you need to add
to it, of course. There is a note in Module::Install::Share that this
requires v6.11 of EUMM to work reliably.

> > Then, use File::ShareDir::dist_dir('Your-Dist-Name') to find that
> > directory again.
> > 
> > Unless by 'package' you meant 'module', in which case look at how
> > File::ShareDir finds those.
> 
> Well, it's a package that installs a module, but also includes
> scripts that will use the modules -- like how libwww-perl installs a
> set of modules and also the lwp-request utility script.

It sounds like they are dist-related, then. I think the main use for the
module-related files is that you can use class_file, which will look up
the inheritance tree as well.

Ben

Reply via email to