Data-Dumper-Interp
view release on metacpan or search on metacpan
lib/Data/Dumper/Interp.pm view on Meta::CPAN
my $bitwise_supported;
BEGIN {
$bitwise_supported = eval "use feature 'bitwise'";
warnings->unimport("experimental::builtin") if _SUPPORTS_CORE_BOOLS;
}
use if $bitwise_supported, "feature", "bitwise";
use Data::Dumper ();
use Carp;
use POSIX qw(INT_MAX);
use Scalar::Util qw(blessed reftype refaddr looks_like_number weaken);
use List::Util 1.45 qw(min max first none all any sum0);
use Data::Structure::Util qw/circular_off/;
use Regexp::Common qw/RE_balanced/;
use Term::ReadKey ();
use Sub::Identify qw/sub_name sub_fullname get_code_location/;
use File::Basename qw/basename/;
use overload ();
############################ Exports #######################################
# Short-hand functions/methods are generated on demand (i.e. if imported or
lib/Data/Dumper/Interp.pm view on Meta::CPAN
push @{ $context->{children} }, $_;
}
elsif ($mode eq "open") {
my $child = {
O => $_,
tlen => 0, # incremented below
children => [],
C => undef,
parent => $context,
};
weaken( $child->{parent} );
push @{ $context->{children} }, $child;
$context = $child;
}
elsif ($mode eq "close") {
oops if defined($context->{C});
$context->{C} = $_;
$context->{tlen} += length;
$context = $context->{parent}; # undef if closing the top item
}
elsif ($mode eq "append_to_prev") {
lib/Data/Dumper/Interp.pm view on Meta::CPAN
my sub fat_arrow($) { # =>
my $lhs = $context->{children}->[-1] // oops;
oops if ref($lhs);
my $newchild = {
O => "",
tlen => length($lhs),
children => [ $lhs ],
C => undef,
parent => $context,
};
weaken($newchild->{parent});
$context->{children}->[-1] = $newchild;
$context = $newchild;
atom($_[0]); # the " => "
oops unless $context == $newchild;
$context->{CLOSE_AFTER_NEXT} = 1;
}
# There is a trade-off between compactness (e.g. want a single line when
# possible), and ease of reading large structures.
#
t/t_Common.pm view on Meta::CPAN
use Path::Tiny 0.146 ();
Path::Tiny->import::into($target, qw/path/);
require List::AllUtils;
List::AllUtils->import::into($target,
qw/reduce min max first firstidx any all none sum0/);
require Scalar::Util;
Scalar::Util->import::into($target, qw/blessed reftype looks_like_number
weaken isweak refaddr/);
require Cwd;
Cwd->import::into($target, qw/getcwd abs_path fastgetcwd fast_abs_path/);
require Guard;
Guard->import::into($target, qw(scope_guard guard));
use Data::Dumper::Interp 7.012 ();
#OTOH, we _do_ want show stringified value of things like Path::Tiny
# unless (Cwd::abs_path(__FILE__) =~ /Data-Dumper-Interp/) {
( run in 0.256 second using v1.01-cache-2.11-cpan-65fba6d93b7 )