in reply to Using Perl's open() to investigate bash login environment

I'm interested to learn the backstory behind this question. What real world problem are you trying to solve? Since you mention Cygwin, is your code required to run on both Windows and Unix?

I ask because I've spent most of my life avoiding the shell by writing everything in Perl, as indicated at:

From the many references in these two nodes, these two are mandatory reading:

👁️🍾👍🦟
  • Comment on Re: Using Perl's open() to investigate bash login environment

Replies are listed 'Best First'.
Re^2: Using Perl's open() to investigate bash login environment
by Intrepid (Curate) on Jul 21, 2025 at 01:47 UTC

    eyepopslikeamosquito wrote:

    I'm interested to learn the backstory behind this question. What real world problem are you trying to solve?

    I'm glad you asked. I don't know how "real" my world is ;-) but the quick answer is that I want to fashion a Perl program to save and display the entire ENV of the current process as YAML. I am just fascinated by the operating system's management of forked or spawned child processes and the way in which these child processes inherit an environment from the parent. In particular, this interests me on Windows with Cygwin, when some of the ENV comes from Cygwin initialization and some from the "larger" Windows system ENV. In real-world situations, sometimes the ENV contains contradictory or troublesome entries that I want to know about, so I can perform knowledgeable systems management and good defensive programming.

    Since you mention Cygwin, is your code required to run on both Windows and Unix?

    Hmm. Well, at present my ambitions are limited to having my code run on Cygwin, and not on unix in general. That could change if I can get a handle on preparing data to Load() and then Dump() with the YAML module (actually the implementation I am using is YAML::XS).

    Thanks for the references to nodes you felt related to this topic. I will read them soon.

        - Soren

    Jul 21, 2025 at 01:47 UTC