Maybe you could override CORE::GLOBAL::eval and institute your own depth counter?
In this case, you may find helpful the recently released overload::eval module.
Update: As diotalevi pointed this module is only about eval STRING (and not eval BLOCK) and requires the latest devel Perl versions. So, maybe the module is not that helpful here.
In reply to Re^2: Determining depth of eval nesting
by ferreira
in thread Determining depth of eval nesting
by aufflick
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |