Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to determine absolute path of current Perl file? (Data::Dumper::Lazy)

by LanX (Saint)
on Mar 01, 2016 at 11:18 UTC ( [id://1156512]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1156512]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-04-24 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found