TABLE OF CONTENTS


::pwtk::input::pushpop

SYNOPSIS

proc ::pwtk::input::pushpop {script} {

PURPOSE

This is a convenience proc. It is equivalent to:

      ::pwtk::input::push
      ... script ...
      ::pwtk::input::pop

but due to the usage of curly braces {}, it assures that ::pwtk::input::pop is not forgotten because forgotten closing curly-brace results in a Tcl error, while forgotten ::pwtk::input::pop does not.

Furthermore, it properly handles specialties, such as the "return" call, i.e., one can do something like:

     input_pushpop {
       ...
       if { $condition } {
          return
       }
     }

and this will not break the stack-level because the stack will be poped upon the execution of the "return" call.

SOURCE

    ::pwtk::input::push
    set code [catch {uplevel 1 $script} result]
    ::pwtk::input::pop

    return -code $code $result
}