in reply to Re^3: Dumping variables but DRY and simple
in thread Dumping variables but DRY and simple

For completeness, there is still the possibility to fiddle with the sourcecode.

caller returns linenumber and filename of the caller.

Anyway I'm not sure if there are sideeffects when trying to access the file...

Cheers Rolf

  • Comment on Re^4: Dumping variables but DRY and simple

Replies are listed 'Best First'.
Re^5: Dumping variables but DRY and simple
by rovf (Priest) on Mar 27, 2010 at 16:40 UTC
    Anyway I'm not sure if there are sideeffects when trying to access the file...
    This would *really* be a hack. For instance, the file might already have been changed after the program has been started (a quite common situation during development). But yes, it is a clever idea.

    -- 
    Ronald Fischer <ynnor@mm.st>
      There are more options:
      Furthermore, when called from within the DB package, caller returns more detailed information: it sets the list variable @DB::args to be the arguments with which the subroutine was invoked.

      Whatever this practically means... anyway I need the dumping for debugging and as rubasov said any keystroke saved is a bless while debugging.

      OR

      I could pass only the variable _names_ and use PadWalker and Stash to get the references/values in caller's context.

      But as stated in the OP I don't wanna reinvent the wheel...

      Cheers Rolf

Re^5: Dumping variables but DRY and simple
by ikegami (Patriarch) on Mar 27, 2010 at 16:55 UTC
    That's even worse. That requires the ability to parse Perl, and it assumes the code came from a file and that there is only one function call in the statement at that line.