From: Logan Capaldo Date: 2006-09-18T02:42:57+09:00 Subject: Re: readline() with editing and history? On Mon, Sep 18, 2006 at 02:31:30AM +0900, Josef Wolf wrote: > On Mon, Sep 18, 2006 at 01:50:36AM +0900, Logan Capaldo wrote: > > On Sun, Sep 17, 2006 at 08:01:17PM +0900, Josef Wolf wrote: > > > I have not tried his example because I assumed the library could not be > > > loaded. I was confused by the fact that "require 'readline'" returns > > > "false". Isn't require supposed to return "true" if successful? > > The return value of require is borderline meaningless. If require > > returns false, that just means that the file has already been require'd. > > Are you sure with this? I get false even on the _first_ require. Are you sure it's the first require? ;) For instance, I load readline in my irbrc so I get the fancy line editing. Try: RUBYOPT="" ruby -e 'p require("readline")' Or alternatively before doing require 'readline', do $LOADED_FEATURES.grep(/readline/) > > > If it can't require the file for whatever reason it will raise and > > exception, not return false. > > Maybe this should be mentioned in the documentation? Currently, it says: > > Ruby tries to load the library named _string_, returning +true+ if > successful. [ ... ] > Well yeah if it's already require'd it didn't sucessful load it (since its already been loaded ;) ).