From: Logan Capaldo Date: 2006-03-10T09:28:12+09:00 Subject: Re: setting an environment variable (for libxml2) On Mar 9, 2006, at 2:53 PM, Une b�vue 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']="/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 > 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