Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^13: Using STDIN after exec() with ActiveState Perl

by Anonymous Monk
on Jun 21, 2015 at 21:18 UTC ( [id://1131409]=note: print w/replies, xml ) Need Help??


in reply to Re^12: Using STDIN after exec() with ActiveState Perl
in thread Using STDIN after exec() with ActiveState Perl

It should work exactly the same way
use Module::Load; ... $ENV{SPRING_DATADIR} = ...; load( "ModuleName" );

Replies are listed 'Best First'.
Re^14: Using STDIN after exec() with ActiveState Perl
by Yaribz (Beadle) on Jun 21, 2015 at 21:28 UTC
    On Linux it works, but not on Windows (I re-checked right now).

      On Linux it works, but not on Windows (I re-checked right now)

      I don't believe that :)

      You must be loading the module before you modify %ENV

      Don't do that, only load the module after you've set %ENV

        Here is the code for test.pl:
        use warnings; use strict; use Module::Load; if(! $ENV{SPRING_WRITEDIR}) { $ENV{SPRING_WRITEDIR}='E:\\test'; exec {$^X} ($^X,$0); } $ENV{PATH}="E:\\springrts;$ENV{PATH}"; load("PerlUnitSync"); PerlUnitSync::Init(0,0); my $writeDir=PerlUnitSync::GetWritableDataDirectory(); print "writeDir=$writeDir\n";
        Here is the output:
        E:\test>perl test.pl E:\test>writeDir=E:\test\
        And now the output if I comment the exec line:
        E:\test>perl test.pl writeDir=D:\Documents\My Games\Spring\
        As you can see the SPRING_WRITEDIR environment variable is not taken into account if I don't use exec.

Log In?
Username:
Password:

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

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

    No recent polls found