Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Debugging objects

by zakame (Pilgrim)
on Aug 23, 2017 at 11:59 UTC ( #1197866=note: print w/replies, xml ) Need Help??

in reply to Debugging objects

You can probably use Data::Printer in the Perl debugger to get a peek at objects like this. Ovid also has a .perldb that you can use to customize p in the debugger to inspect via regular Data::Dumper.

Replies are listed 'Best First'.
Re^2: Debugging objects
by mpersico (Scribe) on Aug 24, 2017 at 17:10 UTC
Re^2: Debugging objects
by Anonymous Monk on Aug 24, 2017 at 06:52 UTC


    $ perl -MIO::All -MData::Printer -e " p( io(2) ); " Can't use string ("") as a symbol ref while "strict refs" in use at .. +./site/lib/Data/ line 702.

      Thanks, that's right. Its because io() will emit an overloaded object so stringification would trigger.

      You'll have to "peel off" the overloading, so to speak, by invoking overload::Overloaded (though funny, the perldoc says this should "true if 'arg' is subject to overloading...", wasn't expecting an actual GLOB object there.)

      % perl -de 0 -MIO::All -MData::Printer Loading DB routines from version 1.51 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(-e:1): 0 DB<1> $io = io '.zshrc' DB<2> x overload::Overloaded( $io ) 0 GLOB(0x17a4378) -> *IO::All::(( DB<3> $o = overload::Overloaded( $io ) DB<4> Data::Printer::p($o) \ *IO::All::(( (layers: ) DB<5>

      It would probably make a nice exercise to implement a Data::Printer filter for this.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2020-02-25 13:35 GMT
Find Nodes?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?

    Results (110 votes). Check out past polls.