We have a script starting with:
#!/usr/bin/ruby -w
require 'cgi'
cgi=CGI.new("html4")
begin
$load_path = nil
load 'conf.rb'
load 'create_vars.rb'
(...)
Which generates the error:
./create_vars.rb:1:in `load': string contains null byte (ArgumentError)
This is the line in create_vars.rb that generates the error:
load $load_path + 'lib/name_string.rb'
The global variable $load_path is assigned a value in conf.rb. The error is
inexplicably fixed by inserting arbitrary code between the two load
commands:
require 'cgi'
cgi=CGI.new("html4")
begin
$load_path = nil
load 'conf.rb'
b=cgi
load 'create_vars.rb'
where "b=cgi" can be *any* code you think of; it magically makes the error
go away and restores the value of $load_path that is assigned in conf.rb.
Other details:
This code runs on an Athlon-64 with Gentoo Linux. Programming in Ruby has
been a lot of fun ever since we ditched mod-ruby (restarting Apache every
time we change a class definition? Geez). However, getting errors like
this one gives me a headache.
Any ideas, besides leaving the bogus "b=cgi" code in?
thanks,
Pascal