setting an environment variable (for libxml2)

Discussion in 'Ruby' started by Une bévue, Mar 9, 2006.

  1. Une bévue

    Une bévue Guest

    because i plane to use XML Catalog, i have to set an environment
    variable "XML_CATALOG_FILES" to the path the catalogs reside.

    then if i do :

    ENV['XML_CATALOG_FILES']="/path/to/catalogs"

    does this env var be accessible by libxml2 and ruby-libxml ?

    obviously, if i print back :
    ENV.each { |k,v| p "#{k} => #{v}"}

    i get it.

    when i say accessible from libxml2/ruby-libxml it is only when those are
    called from a ruby script...
    --
    une bévue
    Une bévue, Mar 9, 2006
    #1
    1. Advertising

  2. Une bévue

    Ross Bamford Guest

    On Fri, 2006-03-10 at 04:53 +0900, Une b=C3=A9vue wrote:
    > because i plane to use XML Catalog, i have to set an environment
    > variable "XML_CATALOG_FILES" to the path the catalogs reside.
    >=20
    > then if i do :
    >=20
    > ENV['XML_CATALOG_FILES']=3D"/path/to/catalogs"
    >=20
    > does this env var be accessible by libxml2 and ruby-libxml ?


    I'm not absolutely certain, but I don't think the change will be noticed
    by libxml2/-ruby . Some quick experiments seem to bear this out, but
    YMMV...

    --=20
    Ross Bamford -
    Ross Bamford, Mar 9, 2006
    #2
    1. Advertising

  3. On Mar 9, 2006, at 2:53 PM, Une b=E9vue wrote:

    > because i plane to use XML Catalog, i have to set an environment
    > variable "XML_CATALOG_FILES" to the path the catalogs reside.
    >
    > then if i do :
    >
    > ENV['XML_CATALOG_FILES']=3D"/path/to/catalogs"
    >
    > does this env var be accessible by libxml2 and ruby-libxml ?
    >
    > obviously, if i print back :
    > ENV.each { |k,v| p "#{k} =3D> #{v}"}
    >
    > i get it.
    >
    > when i say accessible from libxml2/ruby-libxml it is only when =20
    > those are
    > called from a ruby script...
    > --=20
    > une b=E9vue
    >


    What you probably need to do is split your script in twain, 1 that =20
    sets up the environment and one that does the work, eg:

    logan:/Users/logan/Projects/Ruby Experiments% cat env1.rb
    ENV["CUSTOM_ENV_VAR"] =3D "Hello"

    exec("ruby env2.rb")
    logan:/Users/logan/Projects/Ruby Experiments% cat env2.rb
    puts "Custom ENV var is #{ENV["CUSTOM_ENV_VAR"]}"
    logan:/Users/logan/Projects/Ruby Experiments% ruby env1.rb
    Custom ENV var is Hello
    Logan Capaldo, Mar 10, 2006
    #3
  4. Une bévue

    Une bévue Guest

    Logan Capaldo <> wrote:

    >
    > What you probably need to do is split your script in twain, 1 that
    > sets up the environment and one that does the work, eg:
    >
    > logan:/Users/logan/Projects/Ruby Experiments% cat env1.rb
    > ENV["CUSTOM_ENV_VAR"] = "Hello"
    >
    > exec("ruby env2.rb")
    > logan:/Users/logan/Projects/Ruby Experiments% cat env2.rb
    > puts "Custom ENV var is #{ENV["CUSTOM_ENV_VAR"]}"
    > logan:/Users/logan/Projects/Ruby Experiments% ruby env1.rb
    > Custom ENV var is Hello


    ok, i see what u mean, i've done that with java to set, internaly, the
    class path...

    i need somehow an app launcher to setup the ENV correctly...
    --
    une bévue
    Une bévue, Mar 10, 2006
    #4
    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. Alain Ketterlin

    libxml2/libxslt crash

    Alain Ketterlin, Feb 26, 2004, in forum: XML
    Replies:
    0
    Views:
    459
    Alain Ketterlin
    Feb 26, 2004
  2. Rahul S.
    Replies:
    3
    Views:
    594
    Flash Gordon
    Nov 1, 2004
  3. Replies:
    5
    Views:
    637
  4. Ashton Fagg

    Setting an environment variable.

    Ashton Fagg, Jan 3, 2012, in forum: Python
    Replies:
    1
    Views:
    233
    Nobody
    Jan 3, 2012
  5. Pavel Ledin

    Setting Windows environment variable

    Pavel Ledin, Sep 20, 2006, in forum: Ruby
    Replies:
    2
    Views:
    147
    Pavel Ledin
    Sep 20, 2006
Loading...

Share This Page