From: "Stephan Kämper" Date: 2004-09-12T07:21:24+09:00 Subject: Re: Switching off warnings temporarily Stephan K�mper wrote: > ---- Code starts here ---- > def silently > warn_level = $VERBOSE > $VERBOSE = false > res = yield > $VERBOSE = warn_level > res > end > > bark = puts ( "Here be Dragons!" ) > > keep_silent = silently do > any_line_of_code_will_do = 1 > puts ( "Creatures under a smooth surface" ) > nil > end > > bark = puts ( "Here be dragons!" ) > > ---- End of the Code ---- > > To get the result I expect, I apparently need to run the code without > the '-w' option and put some (useless) code before the line that might > create a warning. > > Why is that? Do you have any explanations? This happens on both Linux and WinXP, BTW. It's a recent Ruby snapshot on the Linux box and the most recent One-Click-Windows-Installer (1CWI) on WinXP. Happy rubying Stephan