Markaby + Litespeed LSAPI: "warning already initialized constant ENV"

#1
I'm trying to get a basic markaby script to work via lsapi, but it keeps throwing the following error:

/usr/local/lib/ruby/site_ruby/1.8/i686-linux/lsapi.so: warning: already initialized constant ENV

it seems to be something related to requiring gems but i've had no luck finding a solution

# the script
require "rubygems"
require "markaby"

mab = Markaby::Builder.new
mab.html {
head { title "Markaby Test" }
body {
p "Some Text"
}
}

output is as expected in irb, i have rails app's running flawlessly and erb is working using lsapi as a script handler - can anyone shed any light?

tried with:
ruby 1.8.4
markaby 0.3 & 0.4
litespeed 2.2.2 Standard
lsapi 1.8 & 1.9

tia
 

mistwang

LiteSpeed Staff
#2
That warning is because LSAPI override the ENV variable, the warning message usually shows up in lsws/logs/stderr.log and can be safely ignored.
 
#3
thanks for the reply, but...
perhaps i should have been clearer - this is resulting in a 500 server error; like i say, erb works fine (not utilising any gems)

cheers
 

mistwang

LiteSpeed Staff
#4
OK, I did "gem install markaby", and I have test rails application, can you please give me a brief workthrough to create a simple test case for markaby?

Thanks. :)
 

mistwang

LiteSpeed Staff
#5
Finally got markaby installed, have to do "cd vendor/plugins; svn co http://code.whytheluckystiff.net/svn/markaby/trunk" , "script/plugin install ..." does not work.

And it works properly inside a controller as well as .mab file in view folder.
BTW: ruby-lsapi 1.9 has been updated, please download again.
 

mistwang

LiteSpeed Staff
#6
this is resulting in a 500 server error
That's because your test script is not right, if run from command line, it outputs nothing. You need to add a response header and output the html generated by markaby. The script should be like this for a simple CGI:
Code:
 # the script
require "rubygems"
require "markaby"

puts "Content-Type: text/html\r\n\r\n"

mab = Markaby::Builder.new
mab.html {
  head { title "Markaby Test" }
    body {
      p "Some Text"
    }
}

puts mab.to_s
 
Top