Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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:

PerlMonks,

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.

Thanks,
Mike

mrdvt92
http://www.perlmonks.org/?node_id=728353
http://search.cpan.org/~mrdvt/

Comment on How to install INI file cross platform with Makefile.PL?
Download Code
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.

    File::ShareDir::Install

    #!/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:

    File::ShareDir

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://924118]
Approved by davies
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2014-12-22 08:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls