Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Expanding environment variables from ini file

by Corion (Patriarch)
on Aug 27, 2019 at 10:27 UTC ( [id://11105113]=note: print w/replies, xml ) Need Help??


in reply to Re: Expanding environment variables from ini file
in thread Expanding environment variables from ini file

Why do you need that third level?

On unixish OSes, the env command outputs the contents of the environment (as strings, so beware of newlines) and on Windows, the set command does that. Or did you output %ENV as JSON or something?

Replies are listed 'Best First'.
Re^3: Expanding environment variables from ini file
by haj (Vicar) on Aug 27, 2019 at 11:24 UTC
    ...beware of newlines

    This should be a sufficient warning to avoid such a solution. There's no chance to find out whether the following env output comes from two environment variables FOO and PERL5LIB or just from setting one variable with export FOO=$(echo -e "bar\nPERL5LIB=my/malicious/stuff"):

    FOO=bar PERL5LIB=/my/malicious/stuff
    On Windows, the same misleading output can be created by typing the following (where <enter> is the "enter" key):
    SET FOO=BAR^<enter> <enter> PERL5LIB=c:/my/malicious/stuff<enter>
Re^3: Expanding environment variables from ini file
by LanX (Saint) on Aug 27, 2019 at 10:29 UTC
    Because Data::Dumper creates a clean serialization of Perl data structures which can be eval'ed directly without any parsing on the top-level.

    update

    > Or did you output %ENV as JSON or something?

    kind of "something", a Perl dump from Data::Dumper which is core (contrary to JSON)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105113]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-18 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found