From: Lloyd Zusman Date: 2005-03-03T04:19:54+09:00 Subject: Re: Erb: terminating a script? William Ramirez Wrote: > On Wed, 2 Mar 2005 21:32:28 +0900, Lloyd Zusman wrote: > > A
> > B
> > <% WHAT GOES HERE TO END THE SCRIPT? %> > > C
> > D
> > > > What do use for "WHAT GOES HERE ..." in order to cause the > > processing to end after A and B print out? > > Just doing some quick reading, you may want to try exit or exit!, if > you haven't already. If you have, what happened? Did it still output C > and D? > > Apparently they're very similar, however, exit! ignores exception > handling, at_exit functions, and finalizers. I did call exit, and it terminated the entire web server. I forgot to mention that I'm running Erb inside of ErbHandler within a webrick FileHandler instance, not within a stand-alone CGI. I'm sorry for having left out that key piece of information in my original query. The same thing happened with the "exit!" method. What I'm looking for is something that can be invoked within Erb#result which will terminate the eval at the point at which it occurs, but which will allow information up to that point to still appear in the output. Does such a thing even exist? If not, I can hack or subclass ErbHandler to enclose its generated code within a "catch" block inside Erb#result, and then create a method that I can call which will do an appropriate "throw" if I want to terminate the processing. But before I embark on that journey, I want to see if something that has this effect has already been invented. -- Lloyd Zusman ljz@asfast.com