Kaspar Schiess
11/26/2004 9:28:00 AM
Laurent Julliard <laurent@moldus.org> wrote in news:41A654AB.1070002
@moldus.org:
> The problem is that I must leave the original file containing the code
> unchanged so it has to be a mechanism that i can include with a piece
> of code added at runtime with a -r option
The solution was there, but I will make that explicit:
catcher.rb ---------------------------------------
END {
puts 'exception has happened.'
p $!
}
-----------------------------------------------------
test.rb ---------------------------------------------
raise 'dodah'
-----------------------------------------------------
Call as
ruby -rcatcher test.rb
gives you
exception has happened.
#<RuntimeError: dodah>
test.rb:1: dodah (RuntimeError)
yours, kaspar
hand manufactured code - www.tua.ch/ruby