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

Discussion in 'Ruby/Rails' started by roarindustries, Sep 20, 2006.

  1. roarindustries

    roarindustries New Member

    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
  2. mistwang

    mistwang LiteSpeed Staff

    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. roarindustries

    roarindustries New Member

    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
  4. mistwang

    mistwang LiteSpeed Staff

    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. :)
  5. mistwang

    mistwang LiteSpeed Staff

    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.
  6. mistwang

    mistwang LiteSpeed Staff

    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
    
  7. roarindustries

    roarindustries New Member

    mishwang, sorry i never got back sooner - was away - and thanks for catching my stupid mistake :rolleyes:

Share This Page