Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > (Ab)using class CGI as non-CGI HTML generator?

Reply
Thread Tools

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

 
 
Josef 'Jupp' Schugt
Guest
Posts: n/a
 
      03-05-2005
-----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

iD8DBQFCKiRPrhv7B2zGV08RAtM6AKDGYDpSzpED5gf9KzxI53 eJLuIG4QCg57wU
mJd6huQiGEU1lXdZrb5bjVc=
=RNpu
-----END PGP SIGNATURE-----



 
Reply With Quote
 
 
 
 
Jim Weirich
Guest
Posts: n/a
 
      03-05-2005
On Saturday 05 March 2005 05:13 pm, Josef 'Jupp' Schugt wrote:
> 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/

--
-- Jim Weirich http://www.velocityreviews.com/forums/(E-Mail Removed) http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


 
Reply With Quote
 
 
 
 
Bertram Scharpf
Guest
Posts: n/a
 
      03-06-2005
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


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de


 
Reply With Quote
 
Lee Braiden
Guest
Posts: n/a
 
      03-06-2005
On Sunday 06 March 2005 11:21, Bertram Scharpf wrote:
> 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?

--
Lee.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass value from one html to another html through python-cgi Monima Software 0 12-14-2010 10:36 AM
override def method in CGI class, without altering the class!?????? Jer A Ruby 2 05-24-2007 06:05 AM
Class A contains class B, class B points to class A Joseph Turian C++ 5 12-30-2005 03:24 PM
Nested Class, Member Class, Inner Class, Local Class, Anonymous Class E11 Java 1 10-12-2005 03:34 PM
A parameterized class (i.e. template class / class template) is not a class? christopher diggins C++ 16 05-04-2005 12:26 AM



Advertisments