Debug-Statements
view release on metacpan or search on metacpan
lib/Debug/Statements.pm view on Meta::CPAN
# Convert $h->{'$listref->[1]'} to ${$h->{'$listref'}}->[1]
# Convert $h->{'$hashref->{one}'} to ${$h->{'$hashref'}}->{'one'}
my $sigil = ( split //, $var )[0];
if ($id) { print "internaldebug dumpvar: \$sigil = '$sigil'\n" }
my $newsigil = $sigil;
my $reference;
# Ugly way to handle these: $hash{$key} and $hash{$key}{$key2}
# Will not work for more complicated cases like $hash{$hash2{$key}}
while ( $var =~ /^(\$.*)(\$[a-zA-Z_]\w*)(.*)$/ ) {
my ( $pre, $internalvar, $post ) = ( $1, $2, $3 );
if ($id) { print "internaldebug dumpvar: \$internalvar = $internalvar\n" }
my $e = "\$h->{'$internalvar'}";
if ($id) { print "internaldebug dumpvar: \$e = $e\n" }
my $reference = evlwrapper( $h, $e, 'dumpvar $hash{$key}' );
if ($id) { print "internaldebug dumpvar: \$reference = $reference\n" }
#my $dump = cleanDump( $reference, undef );
my $dump;
if ($data_printer_installed) {
$dump = Data::Printer::p($reference);
lib/Debug/Statements.pm view on Meta::CPAN
#internaldebug: $e = $h->{'%nestedhash'}{flintstones}
#internaldebug: $e = $h->{'%nestedhash'}{flintstones}{pal
$e = "\$h->{'$newsigil$varbase'}$opened$element$closed";
}
if ($id) { print "internaldebug dumpvar: \$e = $e\n" }
$reference = evlwrapper( $h, $e, 'dumpvar $e' );
} else {
# $_ @_ $1 $&
if ( $var =~ /^(\$_|\@_|\$[1-9]\d*|\$\&)$/ ) {
( my $var2 = $var ) =~ s/^([\$\@\%])//;
#my $sigil = $1;
print "DEBUG sub $caller: WARNING: Debug::Statements::d() does not support Special variables such as $var\n";
print "DEBUG sub $caller: Use double-quotes as a workaround: d(\"$var2 = $var\")\n";
return;
}
# Special variables
# Package variables
elsif (( $var =~ /^(\$0|\$\$|\$\?|\$\.|\@ARGV|\$LIST_SEPARATOR|\$PROCESS_ID|\$PID|\$PROGRAM_NAME|\$REAL_GROUP_ID|\$GID|\$EFFECTIVE_GROUP_ID|\$EGID\|\$REAL_USER_ID|\$UID|\$EFFECTIVE_USER_ID|\$EID|\$SUBSCRIPT_SEPARATOR|\$SUBSEP|\%ENV|\@INC|\$IN...
or ( $var =~ /^[\$\@\%]\{?[a-zA-Z_][\w:{}\[\]]*$/ and $var =~ /::/ ) )
( run in 0.344 second using v1.01-cache-2.11-cpan-b61123c0432 )