Re: perl5db.pl improvements: apply user's context pragma while DB::eval
[email protected] (Shlomi Fish) Mon, 28 Mar 2016 14:38:39 +0300
| Newsgroups | perl.debugger |
|---|---|
| Message-ID | <[email protected]> |
Hi KES, First of all, note that you should not E-mail me at [email protected]. E-= mail me only at [email protected] .=C2=A0Where did you find the @iglu.org.i= l address? See below for the rest of my reply. On Mon, 28 Mar 2016 11:21:10 +0300 KES <[email protected]> wrote: > Hi. >=20 > When from debugger we evaluate some expression the user's context pragma = is > not applyed. >=20 > This patch fixes that: > https://github.com/KES777/perl/tree/apply_users_context_pragma >=20 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/ >=20 > Need help with one problem, can not watch variables when the debugging > script.pl has 'use strict' in effect. >=20 > 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} ) =3D @DB::saved[7,8]; }($@, $!, > $^E, $,, $/, $\\, $^W) =3D @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=3DHASH(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 decl= are > "my $x"?) at (eval 10)[./perl5db.pl:740] line 1. >=20 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 no= n-DB > piece of code that called it >=20 > As we can see from stacktrace the 'first non-DB piece of code' is=20 > DB::Obj::_handle_cmd_wrapper_commands(DB::Obj=3DHASH(0x26593c0)) called > at ./perl5db.pl line 2881 >=20 > 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 --=20 ----------------------------------------------------------------- Shlomi Fish =E2=80=9CStop reinventing wheels, start building space rockets.=E2=80=9D =E2=80=94 The motto of the Comprehensive Perl Archive Network