Hi Daniel,
On 20.04.2013 08:58, Daniel Gruno wrote:
Thanks for the invaluable help, it's really good knowing there's someone
else taking such an interest in this project! :) I hope that someday we
can shed mod_lua of its experimental status and people won't think me a
crazy person for recommending it left and right ;)
naa, I find the module useful too for all sorts of smaller tasks as well as special httpd things which otherwise can only be done with a C module I believe ... now since I looked a bit at the code here and there I think there are some things which we should fix over the next months ...

1) the code formatting is not yet at our standard
2) the 'apache2' module does pollute the global table, and at 1st glance with my limited Lua experience I dont see why this happens; I've tested with other dynamically loaded modules like geoip, socket and apr (yeah, there exists a *very* *great* APR binding! [1]), and they all only create their own table and nothing global; it would be nice if we could either teach the apache2 module to behave same, or at least make it prelinked/preloaded and let it only plug in when enabled via 'require'. See attached script which shows what I mean ... 3) Since there exists a well done and well functioning APR binding we should probably consider to add some code to mod_lua so that its possible to prelink/preload this APR binding once at module start instead of loading it from every script again and again ... if we would agree on that we could even ditch a bunch of the recent APR adds, thus making mod_lua itself cleaner / smaller again + we would get almost the full power of APR into mod_lua ...

Gün.

[1] http://peterodding.com/code/lua/apr/
--[[
  Check the package tables
--]]

--[[
  This is the default method name for Lua handlers, see the optional
  function-name in the LuaMapHandler directive to choose a different
  entry point.
--]]
function handle(r)
  local function print(...) r:puts(... .. "\n") end

  r.content_type = "text/plain"

  --local apr = require "apr"
  --local geoip = require "geoip"

  r:puts( ("package.path=%q\n"):format(package.path) )
  r:puts( ("package.cpath=%q\n"):format(package.cpath) )

  print("\n***** Contents of table package:")
  for k, v in pairs(package) do
    print( ("%s=%q"):format(k, tostring(v)) )
  end

  print("\n***** Contents of table package.loaded:")
  for k, v in pairs(package.loaded) do
    print( ("%s=%q"):format(k, tostring(v)) )
  end

  print("\n***** Contents of table package.preload:")
  for k, v in pairs(package.preload) do
    print( ("%s=%q"):format(k, tostring(v)) )
  end

  print("\n***** Contents of table package.loaders:")
  for k, v in pairs(package.loaders) do
    print( ("%s=%q"):format(k, tostring(v)) )
  end

  print( ("\npackage.loaded.version=%q"):format(package.loaded.version) )
  print( ("\napache2.version=%q"):format(tostring(apache2.version)) )

end

Reply via email to