Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

How to install INI file cross platform with Makefile.PL?

by mrdvt92 (Acolyte)
on Sep 04, 2011 at 20:18 UTC ( #924118=perlquestion: print w/replies, xml ) Need Help??
mrdvt92 has asked for the wisdom of the Perl Monks concerning the following question:


I have a package that uses "profiles" to connect to databases, web services and file systems. A profile is "Production", "Alpha", "Beta" etc... There is a master INI file that maps the profiles to their correct databases and services.

my $db=MY::Profiles->new->profile("Production")->database; #isa DBIx +::Array my $ws=MY::Profiles->new->profile("Production")->webservice;

I would like to be able to add this INI file in my distribution so that it is installed by the normal "perl Makefile.PL;make;make install" process so that we can build RPMs and PPMs that have the INI file.

I've done some research and it appears that INI files should be in /etc (sysconfdir) on Linux-like systems and should be in the Windows folder on Windows-like systems. These paths are easy enough to get from Sys::Path->sysconfdir and Win32::GetFolderPath(Win32::CSIDL_WINDOWS). Note: I do not think the INI file should go in c:\Perl\etc (Sys::Path->sysconfdir in Windows) since it is also used by non-Perl applications.

Does anyone know how to get this to work?

In my research, it appears that neither Module::Install nor ExtUtils::MakeMaker support this out of the box but there are 100s of options.

This package Module::Build::SysPath seams to be the closest to what I need but, it puts the Windows INI file in what I consider the "wrong" path in Win32.



Replies are listed 'Best First'.
Re: How to install INI file cross platform with Makefile.PL?
by Khen1950fx (Canon) on Sep 05, 2011 at 00:22 UTC
    I tried File::ShareDir::Install and File::ShareDir.


    #!/usr/bin/perl use 5.008008; use strict; use warnings; use ExtUtils::MakeMaker; use File::ShareDir::Install; install_share module => 'My::Profiles' => 'profile'; WriteMakefile(); package MY; use File::ShareDir::Install; sub postamble { my $self = shift; my @ret = File::Share::Install::postamble( $self ); return join "\n", @ret; }
    To find the files after installation:


    #!/usr/bin/perl use strict; use warnings; use File::ShareDir qw(:ALL); dist_dir('My-Profiles');

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://924118]
Approved by davies
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-05-27 02:22 GMT
Find Nodes?
    Voting Booth?