in reply to Re^4: Getting Special Perl Variables for last Regexp from Debugger
in thread Getting Special Perl Variables for last Regexp from Debugger

Think of it like this. When running a debugger, your debugger is running but the input program isn't running. Your debugger has to transfer all those variables by interpreting the source code (or evaluating it or whatever) to either your own symbol table or, it seems from your code, to the debugging program's own symbol table. Let us suppose it does so by evaluating the code with eval. It just so happens that if you take my test code and put an eval around the pattern matching, it reproduces the problem you have exactly, i.e. those special variables stay unaffected by the code.

If eval is at the core of your debugger then this needs to be enhanced so that each line of code is extended before being eval'd to specifically capture the values of those variables within the source symbol space and putting them somewhere the debugging program get at them afterwards, e.g. using IPC::Shareable or IPC::ShareLite - update: although it might slow your debugger down to have too much overhead per line of source - the only way to get better performance and be in full control of the debugger would be to parse instead of eval-ing the source code. .

-M

Free your mind

  • Comment on Re^5: Getting Special Perl Variables for last Regexp from Debugger

Replies are listed 'Best First'.
Re^6: Getting Special Perl Variables for last Regexp from Debugger
by Outaspace (Scribe) on Nov 29, 2005 at 15:47 UTC
    Thanks for the Help so far, but now I detected my real problem, because if I debug your script it works fine! My problem now is that the Regexp Vars I am looking for are lexicaly in a sub (or any other kind of block), as if they where declared with my (or local). If I qualify them with the package name and look in the symbol table, there they are, the only think left to do, is to look in the lexical scope of a block.
    Btw. I am using the "original" perl debugging mechanism, means my script is included in the executing script at line 0 in a BEGIN Block. Then I only need to use the internal debugging functions from Perl (DB and sub). I thought this was the "Perl" way of doing this.