(Ab)using class CGI as non-CGI HTML generator?

  • Thread starter Josef 'Jupp' Schugt
  • Start date
J

Josef 'Jupp' Schugt

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

If not running as CGI, Ruby programs using class CGI expect name=value
pairs on standard input. Is there a way of suppressing this if one is
(ab)using CGI to generate HTML for other purposes than CGI scripts (like
generating HTML mails)?

Before you answer please consider not to start a discussion on HTML
mails. I know what I am doing. The program in question splits the
Freshmeat newsletter into single messages and presently outputs Plain
Text messages. It turned out that the usability of the messages can be
improved by using HTML as a means for formatting the message.

The program will not enforce a certain format but will provide the
choice between Plain Text, HTML only and multipart messages containing
both formats so that you can use what best fits your preferences and the
MUA(s) you use.

Josef 'Jupp' Schugt
- --
The EU commission tries to implement a software patent directive against
the express will of the parliament. That should be an issue to any EU
citizen - even if he or she has not the slightest interest in software.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCKiRPrhv7B2zGV08RAtM6AKDGYDpSzpED5gf9KzxI53eJLuIG4QCg57wU
mJd6huQiGEU1lXdZrb5bjVc=
=RNpu
-----END PGP SIGNATURE-----
 
J

Jim Weirich

If not running as CGI, Ruby programs using class CGI expect name=value
pairs on standard input. Is there a way of suppressing this if one is
(ab)using CGI to generate HTML for other purposes than CGI scripts (like
generating HTML mails)?

You might consider using Builder::XmlMarkup for generating HTML.

http://builder.rubyforge.org/
 
B

Bertram Scharpf

Hi,

Am Sonntag, 06. Mär 2005, 07:13:10 +0900 schrieb Josef 'Jupp' Schugt:
If not running as CGI, Ruby programs using class CGI expect name=value
pairs on standard input. Is there a way of suppressing this if one is
(ab)using CGI to generate HTML for other purposes than CGI scripts (like
generating HTML mails)?

First, I think CGI handling should be derived from HTML
generation, not vice versa.

Anyway, it should not actually be expensive to do somethig
between `puts "<h1>#{...}</h1>"' and reimplementing
CGI#element_init.

Using brute force you can try:

ENV['REQUEST_METHOD'] = 'GET'
c = CGI.new 'html4'

I wouldn't like doing that but maybe you don't mind.

Bertram
 
L

Lee Braiden

First, I think CGI handling should be derived from HTML
generation, not vice versa.

Hmm... but CGI can generate lots of things besides HTML. PNGs and PDFs, for
instance. Perhaps you're thinking of HTTP?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top