LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > Ruby/Rails > Markaby + Litespeed LSAPI: "warning already initialized constant ENV"

Reply
 
Thread Tools Display Modes
  #1  
Old 09-20-2006, 03:29 PM
roarindustries roarindustries is offline
New Member
 
Join Date: Sep 2006
Posts: 3
Default Markaby + Litespeed LSAPI: "warning already initialized constant ENV"

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
Reply With Quote
  #2  
Old 09-20-2006, 04:06 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #3  
Old 09-20-2006, 04:19 PM
roarindustries roarindustries is offline
New Member
 
Join Date: Sep 2006
Posts: 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
Reply With Quote
  #4  
Old 09-20-2006, 07:16 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #5  
Old 09-21-2006, 12:48 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
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.
Reply With Quote
  #6  
Old 09-22-2006, 06:21 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Quote:
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
Reply With Quote
  #7  
Old 09-26-2006, 07:40 AM
roarindustries roarindustries is offline
New Member
 
Join Date: Sep 2006
Posts: 3
mishwang, sorry i never got back sooner - was away - and thanks for catching my stupid mistake
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -7. The time now is 07:55 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.