Debug-Xray

 view release on metacpan or  search on metacpan

lib/Debug/Xray.pm  view on Meta::CPAN

package Debug::Xray; 
use strict;
use warnings;

use feature qw(state);

use Exporter qw(import);

our $VERSION     = 0.05;
our @ISA         = qw(Exporter);
our @EXPORT_OK;

no Carp::Assert;
use Hook::LexWrap;
use Data::Dumper;
use PPI;
use PadWalker qw(var_name);
use Debug::Xray::WatchScalar qw( set_log_handler TIESCALAR STORE FETCH );


# TODO Oranize subs into EXPORT_TAGS
# CONFIGURATION
push @EXPORT_OK, qw{
    &set_debug_verbose
    &set_debug_quiet
    &watch_subs
    &watch_all_subs
};


# TRACK SUBROUTINE EXECUTION
push @EXPORT_OK, qw{
    &start_sub
    &end_sub
    &dprint
};

# WATCH VARIABLE ROUTINES
push @EXPORT_OK, qw{
    &add_watch_var
};

# TESTING OF THIS MODULE
push @EXPORT_OK, qw{
    &is_carp_debug
};

# WARNING AND ERROR HANDLING
push @EXPORT_OK, qw{
    &debug_warn_handling
    &default_warn_handling
    &debug_error_handling
    &default_error_handling
};


my $Verbose = 1;
my $SUB_NEST_LIMIT = 200;

my $LogFile = '/home/dave/Desktop/Jobs/computer_exercises/perl/debug/Debug.log';

my $VOID_CONTEXT_ERROR_MESSAGE =    'The caller of this function must assign the return value. ' . 
                                    'The hooks remain in effect only when the returned value is in lexical scope.';

my @SubStack;

Debug::Xray::WatchScalar->set_log_handler(\&dprint);

sub set_debug_verbose   { $Verbose = 1 };
sub set_debug_quiet     { $Verbose = 0 };
sub is_verbose          { return $Verbose };
sub is_carp_debug {
    return 1 if DEBUG;
    return 0;
}




( run in 1.146 second using v1.01-cache-2.11-cpan-39bf76dae61 )