Devel-DumpTrace

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

      },
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "File::Temp" : "0",
            "Hash::SafeKeys" : "0.01",
            "PadWalker" : "1.5",
            "Scalar::Util" : "1.14",
            "Test::More" : "0",
            "perl" : "5.008001"
         }
      }
   },
   "release_status" : "stable",
   "version" : "0.29",
   "x_serialization_backend" : "JSON::PP version 2.27300"
}

META.yml  view on Meta::CPAN

    - inc
  package:
    - Text::Shorten
    - Devel::DumpTrace::Const
    - Devel::DumpTrace::CachedDisplayedArray
    - Devel::DumpTrace::CachedDisplayedHash
    - Devel::DumpTrace::noPPI
requires:
  File::Temp: '0'
  Hash::SafeKeys: '0.01'
  PadWalker: '1.5'
  Scalar::Util: '1.14'
  Test::More: '0'
  perl: '5.008001'
version: '0.29'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use strict;
use warnings;
use ExtUtils::MakeMaker;
use v5.8.1;               # PadWalker 1.5 not available for <v5.8.1

my $TESTS = "t/*.t t/ppi/*.t";
unless (eval 'use PPI;1') {
  print q[
This distribution comes with a PPI-based module.
Install the PPI distribution on your system
to make use of it.

];
  $TESTS = "t/*.t t/ppi/00-load.t";

Makefile.PL  view on Meta::CPAN

      ? ('LICENSE'=> 'perl')
      : ()),
    (eval $ExtUtils::MakeMaker::VERSION >= 6.46
      ? ('META_MERGE'   => { no_index => $NO_INDEX })
      : ()),
    PL_FILES            => {},
    PREREQ_PM => {
        'Test::More' => 0,
        'File::Temp' => 0,
	'Hash::SafeKeys' => '0.01',   # RT#77673
	'PadWalker' => 1.5,
        'Scalar::Util' => '1.14',     # 1.14 has improved reftype()
    },
    LICENSE             => 'perl_5',
    MIN_PERL_VERSION    => '5.008001',
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
    clean               => { FILES => 'Devel-DumpTrace-* t/*.out.* t/ppi/*.out.* MYMETA.*' },
    test                => { TESTS => $TESTS },
);

lib/Devel/DumpTrace.pm  view on Meta::CPAN

package Devel::DumpTrace;
## no critic (NoStrict,StringyEval)

use 5.008000;
use Hash::SafeKeys;
use PadWalker;
use Scalar::Util 1.14;
use Text::Shorten;
use Devel::DumpTrace::CachedDisplayedArray;
use Devel::DumpTrace::CachedDisplayedHash;
use IO::Handle;
use File::Temp;
use Carp;
use Fcntl qw(:flock :seek);
use strict;
use warnings;

lib/Devel/DumpTrace.pm  view on Meta::CPAN

	current_depth(), " $target_depth $n at ";
	return;
    }
    if ($n < 0) {
	Carp::cluck "save_pads: request for shallow frame ",
	    current_depth(), " $target_depth $n at ";
	return;
    }

    eval {
	$PAD_MY = PadWalker::peek_my($n + 1);
	$PAD_OUR = PadWalker::peek_our($n + 1);
	1;
    } or do {
	Carp::confess("$@ from PadWalker: \$n=$n is too large.\n",
		      "Target depth was $target_depth\n");
    };

    # add extra data to the pads so that they can be refreshed
    # at an arbitrary point in the future
    $PAD_MY->{__DEPTH__} = $PAD_OUR->{__DEPTH__} = current_depth() - $n - 1;

    return;
}

lib/Devel/DumpTrace.pm  view on Meta::CPAN

=head1 EXPORT

Nothing is exported from this module.

=head1 DIAGNOSTICS

All output from this module is for diagnostics.

=head1 DEPENDENCIES

L<PadWalker|PadWalker> for arbitrary access to lexical variables.

L<Scalar::Util|Scalar::Util> for the reference identification
convenience methods.

=head1 BUGS AND LIMITATIONS

=head2 Parser limitations

Some known cases where the output of this module will
be incorrect or misleading include:

lib/Devel/DumpTrace.pm  view on Meta::CPAN

=item * Search CPAN

L<http://search.cpan.org/dist/Devel-DumpTrace/>

=back

=head1 SEE ALSO

L<dumpvar.pl|perl5db.pl>, as used by the Perl debugger.

L<Devel::Trace|Devel::Trace>, L<PadWalker|PadWalker>.

L<Devel::DumpTrace::PPI|Devel::DumpTrace::PPI> is part of this 
distribution and provides similar functionality using L<PPI|PPI> 
to parse the source code.

L<Devel::TraceVars|Devel::TraceVars> is a very similar effort to
C<Devel::DumpTrace>, but this
module handles arrays, hashes, references, objects, lexical C<our>
variables, and addresses more edge cases.

lib/Devel/DumpTrace/PPI.pm  view on Meta::CPAN

package Devel::DumpTrace::PPI;
use Devel::DumpTrace;
use Devel::DumpTrace::Const;
use PadWalker;
use Scalar::Util;
use Data::Dumper;
use Carp;
use strict;
use warnings;

local $| = 1;

croak "Devel::DumpTrace::PPI may not be used ",
      "when \$Devel::DumpTrace::NO_PPI ",

lib/Devel/DumpTrace/PPI.pm  view on Meta::CPAN


This module reads and respects the same environment variables 
as C<Devel::DumpTrace>. See 
L<Devel::DumpTrace|Devel::DumpTrace/"CONFIGURATION AND ENVIRONMENT"> 
for more information.

=head1 DEPENDENCIES

L<PPI|PPI> for understanding the structure of your Perl script.

L<PadWalker|PadWalker> for arbitrary access to lexical variables.

L<Scalar::Util|Scalar::Util> for the reference identification
convenience methods.

L<Text::Shorten|Text::Shorten> (bundled with this distribution)
for abbreviating long output, when desired.

=head1 INCOMPATIBILITIES

None known.

t/11-dump_scalar.t  view on Meta::CPAN

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 12;
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);

# exercise the  Devel::DumpTrace::dump_scalar  function

ok(dump_scalar(4) eq "4", 'dump scalar int') or diag(dunp_scalar(4));
ok(dump_scalar(3.1415) eq "3.1415", 'dump scalar float')
	or diag(dump_scalar(3.1415));

t/12-array_repr.t  view on Meta::CPAN

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 11;
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);
no warnings 'once';

# exercise the  Devel::DumpTrace::array_repr  function

my @a = (1,'foo','bar',*baz);
ok(array_repr(\@a)

t/13-hash_repr.t  view on Meta::CPAN

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 9;
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);
no warnings 'once';

# exercise the  Devel::DumpTrace::hash_repr  function

my %a = (1,'foo','bar',*baz);
my $hash_repr = hash_repr(\%a);

t/20-substitute.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 20;
use strict;
use warnings;
use vars qw($g @g %g $G);

# exercise  Devel::DumpTrace::perform_variable_substitutions  function

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

t/21-substitute.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 24;
use strict;
use warnings;
use vars qw($g @g %g $G);

# exercise  Devel::DumpTrace::perform_variable_substitutions  on array/hash
# element access

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

t/22-substitute.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 36;
use strict;
use warnings;
use vars qw($g @g %g $G);

# exercise  Devel::DumpTrace::perform_variable_substitutions  on objects

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

t/23-special.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 17;
use strict;
use warnings;
use vars qw($g @g %g $G);

# exercise  Devel::DumpTrace::perform_variable_substitutions
# on some edge cases

$Devel::DumpTrace::DB_ARGS_DEPTH = 2;

t/24-substitute.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 9;
use strict;
use warnings;
use vars qw($g @g %g $G);

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

t/25-whitespace.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 27;
use strict qw(vars subs);
use warnings;
use vars qw($g @g %g $G);

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

t/26-pkgvars.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 35;
use strict qw(vars subs);
use warnings;
use vars qw($g @g %g $G);

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my($m,@m,%m,$M);
our($o,@o,%o,$O);

t/30-english.t  view on Meta::CPAN

package Test::DX;

use Devel::DumpTrace ':test';
use PadWalker;
use Test::More tests => 2;
use strict;
use warnings;
use English;
use vars qw($g @g %g $G);

# exercise  Devel::DumpTrace::perform_variable_substitutions
# on some edge cases

$Devel::DumpTrace::DB_ARGS_DEPTH = 2;

t/ppi/11-dump_scalar.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 12;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise the  Devel::DumpTrace::dump_scalar  function

ok(dump_scalar(4) eq "4", 'dump scalar int') or diag(dunp_scalar(4));
ok(dump_scalar(3.1415) eq "3.1415", 'dump scalar float')
	or diag(dump_scalar(3.1415));
ok(dump_scalar("0E0") eq "0E0", 'dump scalar sci')
	or diag(dump_scalar(0E0));
ok(dump_scalar("word") eq "'word'", 'dump scalar text')
	or diag(dump_scalar("word"));

t/ppi/12-array_repr.t  view on Meta::CPAN

    plan tests => 11;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);
no warnings 'once';
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise the  Devel::DumpTrace::array_repr  function

my @a = (1,'foo','bar',*baz);
ok(array_repr(\@a)
   eq "1,'foo','bar',*main::baz", 'array repr')
  or diag array_repr(\@a); ### >= 01X

ok(array_repr([]) eq '', 'array_repr empty');
for my $elem (undef, 1, 'foo', *glob) {

t/ppi/13-hash_repr.t  view on Meta::CPAN

    plan tests => 9;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($global @global %global $GLOBAL $g);
no warnings 'once';
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise the  Devel::DumpTrace::hash_repr  function

my %a = (1,'foo','bar',*baz);
my $hash_repr = hash_repr(\%a);
ok($hash_repr eq "1=>'foo';'bar'=>*main::baz"
   || $hash_repr eq "'bar'=>*main::baz;1=>'foo'", 'hash_repr(ref)');

ok(hash_repr( {} ) eq '', 'hash_repr empty');
for my $elem (1, 'foo') {

t/ppi/20-substitute.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 20;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise  Devel::DumpTrace::perform_variable_substitutions  function

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;

$g = $m = $o = 'foo';
@g = @m = @o = (1,2,3,'bar');

t/ppi/21-substitute.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 24;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise  Devel::DumpTrace::perform_variable_substitutions  on array/hash
# element access

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;

$g = $m = $o = ['foo','bar'];

t/ppi/22-substitute.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 36;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise  Devel::DumpTrace::perform_variable_substitutions  on objects

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

$Devel::DumpTrace::XEVAL_SEPARATOR = ':';
my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;
my $T = $Devel::DumpTrace::HASH_PAIR_SEPARATOR;

t/ppi/23-special.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 16;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise Devel::DumpTrace::perform_variable_substitutions
# on some edge cases

$Devel::DumpTrace::DB_ARGS_DEPTH = 2;

# insert one extra stack frame so that perform_variable_substitutions
# can get the right '@_'

my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;

t/ppi/24-substitute.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 9;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;

$m = $o = $g = sub { my $u = shift @_; print "Anonymous sub $u\n" };

t/ppi/25-whitespace.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 27;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict qw(vars subs);
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my ($m,@m,%m,$M);
our ($o,@o,%o,$O);

$m = $o = $g = 42;
@m = @o = @g = (3,4,'foo');
%m = %o = %g = ('def' => 'ghi');

t/ppi/26-pkgvars.t  view on Meta::CPAN

  if (eval "use PPI;1") {
    plan tests => 35;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict qw(vars subs);
use warnings;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise a few more edge cases for  
# Devel::DumpTrace::perform_variable_substitutions

my($m,@m,%m,$M);
our($o,@o,%o,$O);

$m = $o = $g = 42;
@m = @o = @g = (3,4,'foo');
%m = %o = %g = ('def' => 'ghi');

t/ppi/30-english.t  view on Meta::CPAN

    plan tests => 4;
  } else {
    plan skip_all => "PPI not available\n";
  }
}
use strict;
use warnings;
use English;
use vars qw($g @g %g $G);
use Devel::DumpTrace::PPI ':test';
use PadWalker;

# exercise Devel::DumpTrace::perform_variable_substitutions
# on some edge cases

$Devel::DumpTrace::DB_ARGS_DEPTH = 2;

# insert one extra stack frame so that perform_variable_substitutions
# can get the right '@_'

my $S = $Devel::DumpTrace::XEVAL_SEPARATOR;



( run in 1.285 second using v1.01-cache-2.11-cpan-05444aca049 )