source bash config from perl code
Itay Donenhirsch
itay at bazoo.org
Wed Sep 30 17:57:39 IST 2009
here's an idea - change the "callee" script to a bash script which
sources the config file, and then call the real perl script. something
along:
#!/bin/bash
source config.env
./script.pl $*
--
itay
On Wed, Sep 30, 2009 at 5:09 PM, Tzafrir Cohen <tzafrir at cohens.org.il> wrote:
> On Wed, Sep 30, 2009 at 04:48:41PM +0200, Alexander Indenbaum wrote:
>> Hello,
>>
>> I have bash script which alters environment, kind of configuration,
>> let's say config.env.
>>
>> I'd like to import this environment in context of perl script. How do
>> I do equivalent to 'source config.env' from perl code? I mean I could
>> just run bash in subprocess, but it would not alter perl process
>> environment.
>
> Here's something written by another member of this list after a certain
> shell script has been converted to perl but was still required to use
> the original configuration:
>
> http://svn.asterisk.org/svn/zaptel/tags/1.4.12.1/kernel/xpp/utils/zconf/Zaptel/Config/Defaults.pm
>
> It runs a separate sh subprocess with a controlled environment which
> sources the file and then prints out a pre-defined set of variables. The
> script then parses out the values of those variables.
>
> --
> Tzafrir Cohen | tzafrir at jabber.org | VIM is
> http://tzafrir.org.il | | a Mutt's
> tzafrir at cohens.org.il | | best
> ICQ# 16849754 | | friend
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
More information about the Linux-il
mailing list