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

OK thanks it doesn't display $VAR1 anymore ...

...but one still doesn't get the realname displayed and you still have to reference the dumped structures.

or do I miss it?

Cheers Rolf

Replies are listed 'Best First'.
Re^3: Dumping variables but DRY and simple
by rovf (Priest) on Mar 27, 2010 at 15:12 UTC

    To get to the real name, you would have to fiddle with the compiler. Data::Dumper doesn't do this.

    -- 
    Ronald Fischer <ynnor@mm.st>
      > To get to the real name, you would have to fiddle with the compiler.

      Sorry IMHO that's wrong, I can get the realname for my and our declarations with the help of PadWalker which is core!

      And even without strictures I can still search through the symbol tabel of the caller's package.

      (which might produce multiple results)

      Cheers Rolf

        PadWalker inspects the opcode tree, which what I think rovf meant.
        Sorry IMHO that's wrong, I can get the realname for my and our declarations with the help of PadWalker which is core!

        I think PadWalker *does* interfere with the compiler (otherwise I don't see how it could get the names of the lexicals). Since when is it in Core? I can't see it in Perl 5.10.0 (in the ActiveState distribution).

        -- 
        Ronald Fischer <ynnor@mm.st>
      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

        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>
        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.