From: "Berger, Daniel" Date: 2006-05-16T01:19:14+09:00 Subject: Re: Search an array > -----Original Message----- > From: list-bounce@example.com > [mailto:list-bounce@example.com] On Behalf Of Patrick Spence > Sent: Monday, May 15, 2006 9:59 AM > To: ruby-talk ML > Subject: Search an array > > > > Given the following scenario... > > $0 = "C:/mhiqTest/testAdoConnection.rb" > > $@[0] = "c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in > `connect'" $@[1] = > "c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:424:in `connect'" > $@[2] = "c:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:215:in > `connect'" $@[3] = "C:/mhiqTest/testAdoConnection.rb:16" > > How can I search the callstack array; $@, for the element > that contains > the currently running program; $0? The idea is to log all the > errors to > a SQL Server database, the name of the program, line number where the > error occurred, error message, etc. > > Thanks! Why look in $@? You already know what $0 is. Also, it might be easier to use a library like 'tracer' (stdlib) or perhaps ruby-trace (RAA). In other other random thoughts, ruby-trace looks like a prime candidate for a rewrite using a DSL. :) Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.