in reply to Re: Debugging globjects/globs
in thread Debugging objects

Example

$ perl -de 1 Loading DB routines from perl5db.pl version 1.37 Editor support available. Enter h or 'h h' for help, or 'perldoc perldebug' for more help. main::(-e:1): 1 DB<1> x use IO::All; use Data::Dump::Streamer; sub dd { Dump(@_); () +; } 0 0 DB<2> x our $banana = io('2.txt'); 0 IO::All::File=GLOB(0x16af5fc) -> DB<3> x dd $banana my ($class,$constructor,%flags,@flags); $class = 'IO::All'; $constructor = sub { package IO::All::Base; use warnings; use strict; my $self = $class->new(@_); foreach $_ (@flags) { $self->$_($flags{$_}); } $self->constructor($constructor); return $self; }; %flags = (); @flags = (); $IO_All_File1 = do{ require Symbol; Symbol::gensym }; *$IO_All_File1 = { _assert => 0, _autoclose => 1, _binary => undef, _binmode => undef, _encoding => undef, _lock => 0, constructor => $constructor, io_handle => undef, is_open => 0, mode => undef, name => '2.txt', package => 'IO::All', tied_file => undef }; bless( $IO_All_File1, 'IO::All::File' ); empty array DB<4> q $

Replies are listed 'Best First'.
Re^3: Debugging globjects/globs
by LanX (Saint) on Aug 23, 2017 at 22:20 UTC
    I haven't tried it out but why do you write x dd ... if your dd() just returns an empty list ?

    dd() seems to do all the writing already.

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

      I rarely use the debugger, so thats how I remember to run some code, kinda like cpan client .. that dd works without x is news to me

        I have no time to install those modules, but returning an empty list seems obvious

        sub dd { Dump(@_); (); }

        e.g.

        DB<18> sub dd { (1,2,3); } DB<19> x dd \@a 0 1 1 2 2 3

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

Re^3: Debugging globjects/globs
by geoffleach (Scribe) on Aug 23, 2017 at 20:14 UTC
    Wow. Such a lesson. Thanks.