in reply to Re^3: Using Data::Printer from the Perl debugger
in thread Using Data::Printer from the Perl debugger

You are mangling internal p command and aliases

But isn't that exactly what the author(s) of DB::Pluggable::Plugin::DataPrinter.pm are doing? Or are you saying that approach isn't advisable?

My only objection to px is I have to explicitly en-reference non-scalars, and I've become used to using the p command without doing that. Not a big deal.... :)

  • Comment on Re^4: Using Data::Printer from the Perl debugger

Replies are listed 'Best First'.
Re^5: Using Data::Printer from the Perl debugger
by LanX (Saint) on Mar 02, 2023 at 16:37 UTC
    > of DB::Pluggable::Plugin::DataPrinter.pm are doing?

    I don't know ... I was expecting them to monkey patch the sub for the p cmd. That's why $cmd is set, btw.

    > en-reference non-scalars

    you mean %h -> \%h ... IMHO this could be automatically done with a sub prototype ( like (\[%@$*]) )

    > p command without doing that

    p is for printing x for dumping,

    I'd rather patch x

    DB<1> $x=[1,2,3] DB<2> p $x ARRAY(0x32c8908) DB<3> x $x 0 ARRAY(0x32c8908) 0 1 1 2 2 3 DB<4>

    FWIW you can test aliasing interactively with =

    DB<4> h p p expr Same as "print {DB::OUT} expr" in current package. perldoc manpage Runs the external doc viewer perldoc command on the named Perl manpage, or on perldoc itself if omitted. Set $DB::doccmd to change viewer. DB<5> h x x expr Evals expression in list context, dumps the result. DB<6> h = = [alias value] Define a command alias, or list current aliases. DB<7>

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery