in reply to Re: Re: Why does Perl use dynamic scoping?
in thread Why does Perl use dynamic scoping?
But there are several ways to do the above. One crazy approach is to write a function set_debugging that replaces a function with a wrapped version that sets and unsets debugging as above. Take a look at the implementation of Memoize if you need hints on how to do that. Or for methods you can use Class::Contract and set pre and post conditions. Once written, using it is easy.
Still this is a case where dynamic scope makes it simple and handles hard cases like unexpected interior exits - possibly from a die/eval pair.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Why does Perl use dynamic scoping?
by demerphq (Chancellor) on Feb 08, 2003 at 00:41 UTC |