in reply to eval-blocks and Test::Builder
I try to avoid using eval and code that can dies (exceptions being the exception). Why wasn't this written as something like
possibly with a Scalar::Util::reftype()?package DBM::Deep::Array; sub _get_self { ref $_[0] eq ARRAY ? tied( @{$_[0]} ) : $_[0] }
eval is reasonably expensive as it creates a new lexical scope and dieing and unwinding the stack is also expensive. Is there an advantage to using it rather than the code above? updated:silly benchmark added and removed!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: eval-blocks and Test::Builder
by dragonchild (Archbishop) on Feb 25, 2006 at 00:51 UTC | |
by fergal (Chaplain) on Feb 25, 2006 at 01:16 UTC | |
by dragonchild (Archbishop) on Feb 25, 2006 at 03:07 UTC | |
by fergal (Chaplain) on Feb 25, 2006 at 12:35 UTC | |
by Aristotle (Chancellor) on Mar 01, 2006 at 16:03 UTC |