It's not exactly clear what you mean, so this might be totally off the mark.

You can "freeze" an environment using a Perl script which could be as simple as this trivial example "freeze":
#!/usr/bin/perl -w use strict; my $freezer = "frozen.env"; open (FROZEN, ">$freezer") || die "Could not write to $freezer\n"; foreach (keys %ENV) { print FROZEN "$_=$ENV{$_}\n"; } close (FROZEN);
Now you can reinstate it using something like this program, which might be called "perform":
#!/usr/bin/perl -w use strict; my $freezer = "frozen.env"; open (FROZEN, $freezer) || die "Could not read saved environment $freezer\n"; while (<FROZEN>) { chomp; my ($var, $value) = /^([^=]+)=(.*)/; $ENV{$var} = $value; } close (FROZEN); system (@ARGV);
Once you have established your environment, you would run the first program to "freeze" it. This would churn out a file called "frozen.env" which lists your various environment variables. Note that this program is not very robust, and multi-line entries are going to break it, so you may have to modify it accordingly.

Once you have established your environment, you can use the second program to execute a command in that pre-defined environment, such as:
% perform make
Now, you can use a "dot config" file by replacing the value of $freezer with, perhaps, something like this:
my $freezer = (getpwuid($>))[7]."/.frozenrc";
Note that the getpwuid call returns the home directory for the current user, as defined in /etc/passwd, so this will likely not work in a Win32 environment.

If your make process outputs errors to STDERR, you may have to write a shell script wrapper which can trap these accordingly, or attempt the same with a more ambitious script. I don't have an example of that handy, though. SuperSearch may yield results.

In reply to Re: Sourcing Dot Config Files and Monitoring Make Processes by tadman
in thread Sourcing Dot Config Files and Monitoring Make Processes by hackdaddy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.