> package DB { > sub do_foo { print __PACKAGE__, "\n" } > sub do_eval { print eval '__PACKAGE__', "\n" } > } > do_foo(); > do_eval(); > > would output > main > DB > No. It would output: DB main because inside do_foo the __PACKAGE__ is used without 'eval' and inside do_eval '__PACKAGE__' is evaled in first non-DB > what about errors and warnings within the eval? Would they appear to > come > from within the eval, or from the first non-DB caller. I did not think about that, if expression is eval'ed at first non-DB caller thus errors and warning should appear as from the first non-DB caller probably using Current::Package::__ANON__[local/lib/perl5/Path/To/Module.pm:15] form > f(eval $x, 1); would it be reasonable eval_at/DB::eval_at? --- via perlbug: queue: perl5 status: open https://rt.perl.org/Ticket/Display.html?id=133123Thread Previous | Thread Next