From: Ara.T.Howard@... Date: 2004-09-22T23:14:38+09:00 Subject: Re: horribly impossible debugging task On Wed, 22 Sep 2004 nobu.nokada@softhome.net wrote: > Hi, > > At Fri, 17 Sep 2004 03:54:52 +0900, > Ara.T.Howard wrote in [ruby-talk:112814]: >> @cid = >> Util::fork do > >> trap('SIGHUP') do >> $signaled = $sighup = true >> warn{ "signal " } > > What are these, "Util::fork" and "warn" with block? Util::fork is simply a 'quiet' fork: module Util #{{{ class << self def export sym #{{{ sym = "#{ sym }".intern module_function sym public sym #}}} end def append_features c #{{{ super c.extend Util #}}} end end ... def fork(*a, &b) #{{{ begin verbose = $VERBOSE $VERBOSE = nil Process::fork(*a, &b) ensure $VERBOSE = verbose end #}}} end export 'fork' ... #}}} end warn with block delegates to Logger object: class Main #{{{ ... %w( debug info warn error fatal ).each do |m| eval "def #{ m }(*a,&b);@logger.#{ m }(*a,&b);end" end ... #}}} end regards. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it. | --Dogen ===============================================================================