Forum: Ruby Private methods fail when called from CGI

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Steve D. (Guest)
on 2008-10-15 23:09
Something has really been perplexing to me when trying to use Ruby CGI.

I have a set of methods that render CGI screens just fine from a
dispatcher in the main CGI program that receives requests.  But when I
want to add a private helper method within the same Class collection,
any call to that private function fails.

Something like this... (look for the show_dummy() function below.  Why
does attempting to call show_dummy() within  CGI::escapeHTML (or any
other place in this CGI structure, fail?

The really big picture I'm trying to understand is how typical RUBY CGI
programs are constructed to run a dispatcher and potentially run
additional private programs within each View that gets painted.
(Please... the answer I'm looking for is not... FORGET CGI, USE RAILS...
that is too complicated for infrastructure constraints I'm programming

What is doubly confusing for me is why the ENV.collect() method runs
just fine, yet the show_dummy() private method will not work at all in
this class.

class ModeView

   def initialize(cgi_object, version, cookie, state)
     @cgi = cgi_object
     @cookie = cookie
     @state = state
     @FCP_app_banner  = 'Control Panel ' + version
     @FCP_page_banner = 'Operation : '

   # -------------------- One of several CGI "Views"
   def HPC_StatusQuery
   # Polls the HPC Linux Cluster to determine what jobs are pending
   @cgi.out {
      @cgi.html {
         @cgi.head { @cgi.title {@FCP_app_banner}} +
         @cgi.body {
            @cgi.h3 {@FCP_page_banner +'HPC Status Query'} +
            @cgi.form() do
               "JOB ID: " + @cgi.text_field("hpc_job_id", "", 60, 160)+
               @cgi.reset("RESET")+"  "+
               "SELECT NEXT OPERATION:"+
                              "HPC Status Query",
                              "Build TTP Composite File",
                              "TTP Membership Vector",
                              "TTP View Tracefile Generation",
                              "Single Parameter Mining",
                              "Multiple Parameter Mining",
                              "DISK Maintenance")
            end +
            @cgi.p  {'Debug Only:'}+
            @cgi.pre() do
                  "params: " + @cgi.params.inspect + "\n"+
                  "cookies: " + @cgi.cookies.inspect + "\n" +
                   show_dummy() +
                  "ENV" + ENV.collect() do |key, value|
                    key + " --> " + value + "\n"

   # ------------------------ dummy helper method
   def show_dummy()
This topic is locked and can not be replied to.