I''m testing NET::HTTP after I got require''net\http''=>true. But it resulted in.......>> NET::HTTPNameError: uninitialized constant NET::HTTP from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib /active_support/dependencies.rb:100:in `const_missing'' from (irb):9 from :0 Anyone knows what may go wrong in my setting. THANKS -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, please post the code that caused the error message. -Conrad On 1/30/07, Bontina Chen <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m testing NET::HTTP > after I got require''net\http''=>true. > > But it resulted in....... > > >> NET::HTTP > NameError: uninitialized constant NET::HTTP > from > C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib > /active_support/dependencies.rb:100:in `const_missing'' > from (irb):9 > from :0 > > Anyone knows what may go wrong in my setting. > THANKS > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor wrote:> Hi, please post the code that caused the error message. > > -ConradI''m testing NET::HTTP in irb. So what I posted is the code. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, it seems that you have incorrectly spelled the module name. It should be ''Net'' instead of ''NET''. In any case, here''s an example from "Programming Ruby'' which you should have a copy of: irb(main):001:0> require ''net/http'' => true irb(main):002:0> Net::HTTP.start(''www.pragmaticprogrammer.com'') do |http| irb(main):003:1* response = http.get(''/index.html'') irb(main):004:1> puts "Code = #{response.code}" irb(main):005:1> puts "Message = #{response.message}" irb(main):006:1> response.each {|key, val| printf "%-14s %-40.40s\n", key, val } irb(main):007:1> p response.body[400, 55] irb(main):008:1> end Code = 200 Message = OK last-modified = Tue, 30 Jan 2007 15:33:09 GMT content-type = text/html; charset=iso-8859-1 etag = "b00d226-85d2-45bf6535" date = Wed, 31 Jan 2007 09:36:07 GMT server = Rapidsite/Apa/1.3.31 (Unix) FrontPage/5. content-length = 34258 accept-ranges = bytes "lling book ''The Pragmatic Programmer'' and The\n " => nil Good luck, -Conrad On 1/31/07, Bontina Chen <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Conrad Taylor wrote: > > Hi, please post the code that caused the error message. > > > > -Conrad > > I''m testing NET::HTTP in irb. > So what I posted is the code. > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for pointing out the misspell problem. I ran into this while>> require ''net\http''C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:281: warning: already initialized constant Revision C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:282: warning: already initialized constant HTTPVersion C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1121: warning: already initialized constant HTTPSession C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1599: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1600: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1601: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1605: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1606: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1607: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1611: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1612: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1613: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1617: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1618: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1619: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1623: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1624: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1625: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1629: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1630: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1631: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1635: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1636: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1637: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1645: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1646: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1647: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1651: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1652: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1653: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1657: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1658: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1659: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1663: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1664: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1665: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1669: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1670: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1671: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1675: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1676: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1677: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1681: warning: already initialized constant METHOD C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1682: warning: already initialized constant REQUEST_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1683: warning: already initialized constant RESPONSE_HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1793: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1794: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1797: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1798: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1801: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1802: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1805: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1806: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1809: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1810: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1813: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1814: warning: already initialized constant EXCEPTION_TYPE C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1818: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1821: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1825: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1828: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1831: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1834: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1837: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1840: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1843: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1847: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1850: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1853: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1855: warning: already initialized constant HTTPMovedTemporarily C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1857: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1860: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1863: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1867: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1871: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1874: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1877: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1880: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1883: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1886: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1889: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1892: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1895: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1898: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1901: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1904: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1907: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1910: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1913: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1915: warning: already initialized constant HTTPRequestURITooLarge C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1917: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1920: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1923: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1927: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1930: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1933: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1936: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1939: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1942: warning: already initialized constant HAS_BODY C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:1955: warning: already initialized constant CODE_CLASS_TO_OBJ C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2001: warning: already initialized constant CODE_TO_OBJ C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2259: warning: already initialized constant ProxyMod C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2262: warning: already initialized constant HTTPRequest C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2265: warning: already initialized constant HTTPInformationCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2266: warning: already initialized constant HTTPSuccessCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2267: warning: already initialized constant HTTPRedirectionCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2268: warning: already initialized constant HTTPRetriableCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2269: warning: already initialized constant HTTPClientErrorCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2270: warning: already initialized constant HTTPFatalErrorCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2271: warning: already initialized constant HTTPServerErrorCode C:/InstantRails/ruby/lib/ruby/1.8/net\http.rb:2272: warning: already initialized constant HTTPResponceReceiver => true and finally got a true here. And the Net::HTTP works fine. So should I do something to fix the warnings? THANKS -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---