#42 Mod Ruby (mod_ruby_demo.rhtml and mod_ruby_demo.conf)

CGI is great for many applications. However, sometimes you may want to have files that are mainly HTML, with only subsections that need to be executed by your programming language, Ruby or otherwise. Wouldn’t it be great if you had an HTML tag that meant Start Ruby code now, after which you could add some Ruby code, and then use another tag that meant Done with Ruby code, go back to plain old HTML?

There is such a system, for many languages. It’s the default behavior for the PHP language, and similar systems are available for Perl and Python, among others. One of the systems that does this for Ruby is eRuby, which will be embedded directly within the webserver via the mod_ruby software. ...

Get Ruby by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.