Hi KES,

First of all, note that you should not E-mail me at shlo...@iglu.org.il. E-mail
me only at shlo...@shlomifish.org . Where did you find the @iglu.org.il address?

See below for the rest of my reply.

On Mon, 28 Mar 2016 11:21:10 +0300
KES <kes-...@yandex.ru> wrote:

> Hi.
> 
> When from debugger we evaluate some expression the user's context pragma is
> not applyed.
> 
> This patch fixes that:
> https://github.com/KES777/perl/tree/apply_users_context_pragma
> 

I'm not sure I understand. Can you also include new test assertions (see
lib/perl5db.t and lib/perl5db/t/ in the Perl distribution) that will fail
before the changes to the production code and will pass after applying them?
See:

* https://en.wikipedia.org/wiki/Test-driven_development

* http://perl-begin.org/uses/qa/

> 
> Need help with one problem, can not watch variables when the debugging
> script.pl has 'use strict' in effect.
> 
> Variable "$x" is not imported at (eval 10)[./perl5db.pl:740] line 1.
>  at (eval 10)[./perl5db.pl:740] line 1.
>       eval 'BEGIN{ ( $^H, ${^WARNING_BITS} ) =  @DB::saved[7,8]; }($@, $!,
> $^E, $,, $/, $\\, $^W) = @DB::saved;package main; $x; ' called
> at ./perl5db.pl line 740 DB::eval called at ./perl5db.pl line 6051
>       DB::_add_watch_expr("\$x") called at ./perl5db.pl line 6071
>       DB::cmd_w("w", "\$x", 6) called at ./perl5db.pl line 4488
>       DB::cmd_wrapper("w", "\$x", 6) called at ./perl5db.pl line 3999
>       DB::Obj::_handle_cmd_wrapper_commands(DB::Obj=HASH(0x26593c0)) called
> at ./perl5db.pl line 2881 DB::DB called at /home/kes/tmp/t3.pl line 6
> Global symbol "$x" requires explicit package name (did you forget to declare
> "my $x"?) at (eval 10)[./perl5db.pl:740] line 1.
> 

I don't understand.

> But here the design problem because of next:
> An eval '' executed within a subroutine defined in the DB package doesn't see
> the usual surrounding lexical scope, but rather the scope of the first non-DB
> piece of code that called it
> 
> As we can see from stacktrace the 'first non-DB piece of code' is 
>       DB::Obj::_handle_cmd_wrapper_commands(DB::Obj=HASH(0x26593c0)) called
> at ./perl5db.pl line 2881
> 
> So if we want $x be evaled at user's context the DB::DB *SHOULD NOT* call to
> DB::Obj namespace.

Not sure I understand (again). Can you provide a test case?

Regards,

        Shlomi Fish


-- 
-----------------------------------------------------------------
Shlomi Fish

“Stop reinventing wheels, start building space rockets.”
    — The motto of the Comprehensive Perl Archive Network

Reply via email to