Acme-Debug

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

--- #YAML:1.0
name:               Acme-Debug
version:            1.48
abstract:           A handy module to identify lines of code where bugs may be found.
author:
    - Richard Foley <acme.debug@rfi.net>
license:            unknown
distribution_type:  module
configure_requires:
    ExtUtils::MakeMaker:  0
build_requires:
    ExtUtils::MakeMaker:  0
requires:  {}
no_index:
    directory:
        - t

Makefile.PL  view on Meta::CPAN

use 5.008000;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'Acme::Debug',
    VERSION_FROM      => 'lib/Acme/Debug.pm', # finds $VERSION
    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (ABSTRACT_FROM  => 'lib/Acme/Debug.pm', # retrieve abstract from module
       AUTHOR         => 'Richard Foley <acme.debug@rfi.net>') : ()),
);

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


=cut

require Exporter;
our @ISA = qw(Exporter);
our %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); # use Acme::Debug ':all';
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw( );
our $VERSION = '0.01';

my $debug   = $ENV{Acme_Debug_DEBUG}   || 0;
my $silent  = $ENV{Acme_Debug_SILENT}  || 0;
my $verbose = $ENV{Acme_Debug_VERBOSE} || 0;
my $bug     = $ENV{Acme_Debug_REGEX}   || 'b[^u]*u[^g]*g';

# sub acme_debug = \&DB::DB;

=head1 Environment Variables

These boolean variables may be set to divulge more information.

=over 4

=item Acme_Debug_DUMP

Print the actual buggy lines.

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

	if ($f =~ /Acme.Debug.pm/) {
		$f = shift;
		$l = shift;
	}
	my $line = @{"::_<$f"}[$l] || shift;
	my ($v, $d, $x) = File::Spec->splitpath($f);
	# if ($line =~ /b[^u]*u[^g]*g/mi) {
	if ($line =~ /$bug/mi) {
		$i_bugs++;
		unless ($f =~ /perl5db.pl/) {
			push(@bugs, ($debug?"[$i]":'')."  line $l of $x: $line");
		}
	}
}

sub END {
	use Data::Dumper;
	print STDERR "bug free lines:   ".($i-$i_bugs)."\n";
	print STDERR "BUGgy code lines: $i_bugs\n";
	print STDERR @bugs if $verbose;
}

1;

=head1 AUTHOR

Richard Foley, E<lt>acme.debug@rfi.net<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2004 by Richard Foley

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.2 or,
at your option, any later version of Perl 5 you may have available.

=cut

t/Acme-Debug.t  view on Meta::CPAN

# $Id: Acme-Debug.t,v 1.1 2004/03/07 03:42:11 acmedebug Exp $
# 
# change 'tests => 1' to 'tests => last_test_to_print';

use Test::More tests => 1;
BEGIN { use_ok('Acme::Debug') };



( run in 1.143 second using v1.01-cache-2.11-cpan-49f99fa48dc )