in reply to How to determine absolute path of current Perl file?

> trying to improve the CPAN module Data::Printer such that it can display the variable name automatically (similarly to Data::Dumper::Simple ).

maybe of interest Data::Dumper::Lazy

use Data::Dumper::Lazy; @a = 1..5; dmp {@a};

> without using PadWalker or a source filter

none of this involved, just B::Deparse which is core since the dinos died out ;-)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re: How to determine absolute path of current Perl file? (Data::Dumper::Lazy)
  • Download Code

Replies are listed 'Best First'.
Re^2: How to determine absolute path of current Perl file? (Data::Dumper::Lazy)
by hakonhagland (Scribe) on Mar 01, 2016 at 13:02 UTC

    Hi LanX!

    I was not aware of Data::Dumper::Lazy, thanks for bringing it to my attention. I looks really interesting to use B::Deparse. But I am not sure it will be compatible with the call syntax for Data::Printer. Currently I am planning to modify Data::Printer directly and propose a pull request to the author of the module. I have not considered building a new module on top of Data::Printer yet.

    I also did some quick tests with Data::Dumper::Lazy and the output confused me a little bit. I think the module is still under development, am I right? :)
      > think the module is still under development, am I right?

      Well unfortunately I tend to be a perfectionist and overload things with features.

      I'm not aware of bugs, AFAIK it's stable.

      > But I am not sure it will be compatible with the call syntax for Data::Printer .

      Well you'd always need an extra surrounding { BLOCK } , any other argument structure will be returned 1to1 from this block

      you could publish something like Data::Printer::Lazy.

      > and the output confused me a little bit.

      Could you please show me an example of this "confusing output"?

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

      update
      looked into the (little ;) code and it mentions
      # TODO # * ignore pragmas

      Now I remember B::Deparse::coderef2text will list active use pragmas in the first lines, these need to be filtered out.