Tony De wrote:
> Justin Collins wrote:
>   
>> Tony De wrote:
>>     
>>> aid me in my learning process.  Thank you very much.
>>>
>>> tonyd
>>>   
>>>       
>> Writing code using the CGI library is just like any other Ruby code, so
>> you can have any methods, classes, or other code that you want.
>>
>>     
>>>     puts "Content-type:
>>> text/plain\r\n\r\n<HTML>\n<HEAD>\n<TITLE>CommSpeed Log
>>> Search</TITLE>\n</HEAD>\n<BODY>\n"
>>>     puts "<h1>No DHCP Log Results Found!</h1>"
>>>     puts "</BODY>\n</HTML>\n"
>>>                 exit
>>>       
>> The CGI library does this kind of HTML work for you. See the example in
>> about the middle of the page here:
>> http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI.html
>> and the documentation here:
>> http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/classes/CGI/HtmlExtension.html
>>
>>
>>
>> -Justin
>>     
>
> Thanks Justin,
>
> That's what I thought.  However, when I place a:
>
> def my_method
> end
>
> statement, my code dies.  Even if I simply make the definition with no 
> additional code.  Do I need to place it at the top, bottom?  And does it 
> have something to do with the extension I place on the file, .cgi vs 
> .rb?
>
> tonyd
>   

It does matter where you place the method definition, in a way. That is, 
you can only use it in the code following its definition.

For example:

  def my_method
  end

  my_method

will work, but

  my_method

  def my_method
  end

will not.

Are you getting a specific error message?
If your code is working with .cgi as it is, adding methods should not 
change a thing.

-Justin