You have given us no information about what is in the ./home/apps/profile and how you are calling, but I presume that it contains bash variable assignments (
export FOO='bar') and you are using
system() or
exec() to call it.
These get run in a separate process which runs and exits and does not affect your currently running process.
But it seems silly to use bash to set environment variables from a perl script, when you can do $ENV{FOO} = 'bar'.
You can just open the file, read it in line by line and assign the values to keys of %ENV.
Also, why are you using environment variables? I could understand it maybe if you were possibly calling a non-perl program from your script, but if this is all in perl, why not load your config variables using YAML or YAML::Syck?
use YAML();
our %Config = YAML::LoadFile('./home/app/profile');
and in ./home/app/profile:
---
foo: bar
arrayref:
- 1
- 2
- 3
hashref:
foo: bar
baz: bar
Clint
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.