Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > setting an environment variable (for libxml2)

Reply
Thread Tools

setting an environment variable (for libxml2)

 
 
Une bévue
Guest
Posts: n/a
 
      03-09-2006
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
 
Reply With Quote
 
 
 
 
Ross Bamford
Guest
Posts: n/a
 
      03-09-2006
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 - http://www.velocityreviews.com/forums/(E-Mail Removed)



 
Reply With Quote
 
 
 
 
Logan Capaldo
Guest
Posts: n/a
 
      03-10-2006

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




 
Reply With Quote
 
Une bévue
Guest
Posts: n/a
 
      03-10-2006
Logan Capaldo <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting an environment variable. Ashton Fagg Python 1 01-03-2012 08:29 PM
70-284 Lab Environment, Need Virtual Environment brooklynbridge508@hotmail.com MCSA 4 05-02-2007 09:49 AM
Setting an environment variable from another environment variable marcwentink@hotmail.com Java 5 04-04-2007 10:39 PM
Setting Windows environment variable Pavel Ledin Ruby 2 09-20-2006 10:01 AM
URGENT: Need help in setting environment variable.. pls help Rahul S. C Programming 3 11-01-2004 10:53 AM



Advertisments