Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

We solved a similar issue pretty much backwards from you. And, from the sounds of it, you may not have the freedom to do this, but others who read this may, so I'll write it down for posterity.

Over the last 5 years, we have moved from a shell-based automation system to a perl-based one. However, there was an intermediate stage where it was hybrid, and we needed to do likewise: share a bunch of variables. Lots of variables. Hundreds of them, actually.

What we did was move all the variables to perl. Move, not copy. Actually, we moved them to a data file (e.g., XML) that perl would read and parse. The reader was one module, the parser another. And then we wrote a shim program that would call all the readers (which would call all the parsers) and eventually gather all the information that the shell scripts might need. This actually would take a few seconds. And then it would spit out a shell script with a bunch of "VAR=value\nexport VAR" text.

We tore out all the variable setting from the shell scripts, and replaced it with three lines:

./generate_shell.pl [...] > /tmp/automation-$$ . /tmp/automation-$$ rm /tmp/automation-$$
It wasn't cheap to do this, but it was worth it when we could guarantee that only one value of a variable existed in our environment, and by changing that one, centralised value, we knew that everyone that needed it would have the right value.

Since then, we've managed to replace the rest of the shell code, and the shim is gone. But it helped a lot for the phase we were in.


In reply to Re: Parent Process Environment by Tanktalus
in thread Parent Process Environment by Ronnie

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-19 11:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found