persistant environment data

Discussion in 'Perl Misc' started by sburg, Sep 23, 2003.

  1. sburg

    sburg Guest

    I am trying to convert the following line from a makefile into perl:
    .. shell_script_to_get_env_data && java Main

    When run on a Unix command line the
    .. shell_script_to_get_env_data
    sets some env variables.

    Then some objects instantiated from Main.java need to use
    those env variables.

    The following perl lines don't work:
    system(". shell_script_to_get_env_data");
    system("java Main");
    Main fails because its shell doesn't have the env variables set.

    How do I put these commands together in Perl so that the environment
    variables set up by the shell script are accessable by the Java
    program?

    Thanks,
    Shawna
     
    sburg, Sep 23, 2003
    #1
    1. Advertising

  2. sburg

    Vlad Tepes Guest

    sburg <> wrote:

    > I am trying to convert the following line from a makefile into perl:
    > . shell_script_to_get_env_data && java Main
    >
    > When run on a Unix command line the
    > . shell_script_to_get_env_data
    > sets some env variables.
    >
    > Then some objects instantiated from Main.java need to use
    > those env variables.
    >
    > The following perl lines don't work:
    > system(". shell_script_to_get_env_data");
    > system("java Main");
    > Main fails because its shell doesn't have the env variables set.
    >
    > How do I put these commands together in Perl so that the environment
    > variables set up by the shell script are accessable by the Java
    > program?


    How about

    system("./shell_script_to_get_env_data && java Main");

    Or you could set the environment in perl, then run java:

    $ENV{myvar} = "somevalue";
    system("java Main");

    --
    Vlad
     
    Vlad Tepes, Sep 23, 2003
    #2
    1. Advertising

  3. sburg wrote:
    > I am trying to convert the following line from a makefile into perl:
    > . shell_script_to_get_env_data && java Main
    >
    > When run on a Unix command line the
    > . shell_script_to_get_env_data
    > sets some env variables.
    >
    > Then some objects instantiated from Main.java need to use
    > those env variables.
    >
    > The following perl lines don't work:
    > system(". shell_script_to_get_env_data");
    > system("java Main");
    > Main fails because its shell doesn't have the env variables set.
    >
    > How do I put these commands together in Perl so that the environment
    > variables set up by the shell script are accessable by the Java
    > program?
    >

    Have you tried
    system(". shell_script_to_get_env_data && java Main");
    ?

    Chris Mattern
     
    Chris Mattern, Sep 23, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul
    Replies:
    1
    Views:
    346
    L. L.
    Nov 6, 2003
  2. Wayne M J

    IP Regex and persistant datagrids

    Wayne M J, Jun 11, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    435
    Wayne M J
    Jun 11, 2004
  3. me
    Replies:
    2
    Views:
    308
    John Saunders
    Jul 11, 2004
  4. Edwin Knoppert

    persistant cookie, what is it?

    Edwin Knoppert, Jan 30, 2006, in forum: ASP .Net
    Replies:
    15
    Views:
    539
    Edwin Knoppert
    Jan 31, 2006
  5. archana
    Replies:
    1
    Views:
    536
Loading...

Share This Page