Peter Michaux wrote:
> On Wed, Aug 27, 2008 at 6:21 PM, Peter Michaux <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I'm building a command line "to-do" CPAN module. The module will have
>> some scripts that need to be installed in /usr/local/bin, for example.
>> These scripts need to manipulate data files in /usr/local/etc and
>> /usr/local/var, for example, which contain the application
>> configuration and database of actual to-dos. I want the
>> "/usr/local/etc" and "/usr/local/var" directories to be configurable
>> during the "perl Makefile.pl; make" stage of installing the CPAN
>> module.
>>
>> I think that "/usr/local/etc" and "/usr/local/var" strings need to be
>> hard coded into my scripts somehow. Right now I'm using the GNU
>> ./configure; make; make install system and am using m4 macros
>> @sysconfdir@, @localstatedir@ to modify the scripts (i.e. hard code
>> the string) before they are installed. I'd like to use the Perl system
>> (not the GNU system) for building so that my module can be used on all
>> systems with Perl.
>>
>> Is what I want to do possible with MakeMaker?
> 
> After a bunch of hunting around I discovered that PM_FILTER in
> combination with sed seems like it will be able to do what I want
> 
> PM_FILTER => 'sed -e [EMAIL PROTECTED]@]%/usr/local/var%g | ' .
>              'sed -e [EMAIL PROTECTED]@]%/usr/local/etc%g';
> 
> If there is something better please let me know.

PM_FILTER will work, but as it's a raw shell command it is inherently
non-portable.  If that's not a concern, go with it.

Personally I'd use Perl instead of sed.  You know you have Perl.

PM_FILTER
    => "$^X -i -pe '[EMAIL PROTECTED]@}{$State_Dir}g;".
                   "[EMAIL PROTECTED]@}   {$Conf_Dir}g'"

Use prompt() to ask the user what their state and config directories should be.


-- 
100. Claymore mines are not filled with yummy candy, and it is wrong
     to tell new soldiers that they are.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

Reply via email to