develooper Front page | perl.perl5.porters | Postings from April 2018

[perl #133123] eval '__PACKAGE__' in debug mode do not return rightpackage

Thread Previous | Thread Next
KES via RT
April 25, 2018 10:04
[perl #133123] eval '__PACKAGE__' in debug mode do not return rightpackage
Message ID:
> 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:

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/] form

> f(eval $x, 1);

would it be reasonable eval_at/DB::eval_at?

via perlbug:  queue: perl5 status: open

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About