Devel-Trace-0.12/000755 000766 000766 00000000000 11717236106 013511 5ustar00rjbsrjbs000000 000000 Devel-Trace-0.12/Changes000644 000766 000766 00000000327 11717236071 015007 0ustar00rjbsrjbs000000 000000 Revision history for Perl extension Devel::Trace. 0.12 Thu Feb 16 12:26:09 EST 2012 - eliminate interactive prompting during test phase 0.01 Mon Sep 6 21:32:55 1999 - original version; created by h2xs 1.19 Devel-Trace-0.12/demo.pl000755 000766 000766 00000001234 06765070521 015001 0ustar00rjbsrjbs000000 000000 # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. BEGIN { $| = 1; print "1..1\n"; } END {print "not ok 1\n" unless $loaded;} use Devel::Trace; $loaded = 1; print "ok 1\n"; ######################### End of black magic. open S, "< sample" or die "Couldn't open sample demo file: $!; aborting"; print while ; close S; print "\n"; print "Press enter to execute this file. \n"; ; system("perl -I./blib/lib -d:Trace sample"); $? and die "Problem running sample program: $? exit status\n"; Devel-Trace-0.12/Makefile.PL000644 000766 000766 00000000354 06765070146 015474 0ustar00rjbsrjbs000000 000000 use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Devel::Trace', 'VERSION_FROM' => 'Trace.pm', # finds $VERSION ); Devel-Trace-0.12/MANIFEST000644 000766 000766 00000000360 11717236106 014641 0ustar00rjbsrjbs000000 000000 Changes MANIFEST Makefile.PL Trace.pm demo.pl t/compile.t sample README META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Devel-Trace-0.12/META.json000644 000766 000766 00000001425 11717236106 015134 0ustar00rjbsrjbs000000 000000 { "abstract" : "unknown", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Devel-Trace", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : {} } }, "release_status" : "stable", "version" : "0.12" } Devel-Trace-0.12/META.yml000644 000766 000766 00000000653 11717236105 014765 0ustar00rjbsrjbs000000 000000 --- abstract: unknown author: - unknown build_requires: ExtUtils::MakeMaker: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.120351' license: unknown meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Devel-Trace no_index: directory: - t - inc requires: {} version: 0.12 Devel-Trace-0.12/README000644 000766 000766 00000004035 06765071041 014375 0ustar00rjbsrjbs000000 000000 NAME Devel::Trace - Print out each line before it is executed (like `sh -x') SYNOPSIS perl -d:Trace program DESCRIPTION If you run your program with `perl -d:Trace program', this module will print a message to standard error just before each line is executed. For example, if your program looks like this: #!/usr/bin/perl print "Statement 1 at line 4\n"; print "Statement 2 at line 5\n"; print "Call to sub x returns ", &x(), " at line 6.\n"; exit 0; sub x { print "In sub x at line 12.\n"; return 13; } Then the `Trace' output will look like this: >> ./test:4: print "Statement 1 at line 4\n"; >> ./test:5: print "Statement 2 at line 5\n"; >> ./test:6: print "Call to sub x returns ", &x(), " at line 6.\n"; >> ./test:12: print "In sub x at line 12.\n"; >> ./test:13: return 13; >> ./test:8: exit 0; This is something like the shell's `-x' option. DETAILS Inside your program, you can enable and disable tracing by doing $Devel::Trace::TRACE = 1; # Enable $Devel::Trace::TRACE = 0; # Disable or Devel::Trace::trace('on'); # Enable Devel::Trace::trace('off'); # Disable `Devel::Trace' exports the `trace' function if you ask it to: import Devel::Trace 'trace'; Then if you want you just say trace 'on'; # Enable trace 'off'; # Disable TODO * You should be able to send the trace output to the filehandle of your choice. * You should be able to specify the format of the output. * You should be able to get the output into a string. We'll see. Author Mark-Jason Dominus (`mjd-perl-trace+@plover.com'), Plover Systems co. See the `Devel::Trace.pm' Page at http://www.plover.com/~mjd/perl/Trace for news and upgrades. Devel-Trace-0.12/sample000755 000766 000766 00000000316 06554235660 014727 0ustar00rjbsrjbs000000 000000 #!/usr/bin/perl print "Statement 1 at line 4\n"; print "Statement 2 at line 5\n"; print "Call to sub x returns ", &x(), " at line 6.\n"; exit 0; sub x { print "In sub x at line 12.\n"; return 13; }Devel-Trace-0.12/t/000755 000766 000766 00000000000 11717236105 013753 5ustar00rjbsrjbs000000 000000 Devel-Trace-0.12/Trace.pm000644 000766 000766 00000006257 11717236045 015121 0ustar00rjbsrjbs000000 000000 # -*- perl -*- package Devel::Trace; $VERSION = '0.12'; $TRACE = 1; # This is the important part. The rest is just fluff. sub DB::DB { return unless $TRACE; my ($p, $f, $l) = caller; my $code = \@{"::_<$f"}; print STDERR ">> $f:$l: $code->[$l]"; } sub import { my $package = shift; foreach (@_) { if ($_ eq 'trace') { my $caller = caller; *{$caller . '::trace'} = \&{$package . '::trace'}; } else { use Carp; croak "Package $package does not export `$_'; aborting"; } } } my %tracearg = ('on' => 1, 'off' => 0); sub trace { my $arg = shift; $arg = $tracearg{$arg} while exists $tracearg{$arg}; $TRACE = $arg; } 1; =head1 NAME Devel::Trace - Print out each line before it is executed (like C) =head1 SYNOPSIS perl -d:Trace program =head1 DESCRIPTION If you run your program with C, this module will print a message to standard error just before each line is executed. For example, if your program looks like this: #!/usr/bin/perl print "Statement 1 at line 4\n"; print "Statement 2 at line 5\n"; print "Call to sub x returns ", &x(), " at line 6.\n"; exit 0; sub x { print "In sub x at line 12.\n"; return 13; } Then the C output will look like this: >> ./test:4: print "Statement 1 at line 4\n"; >> ./test:5: print "Statement 2 at line 5\n"; >> ./test:6: print "Call to sub x returns ", &x(), " at line 6.\n"; >> ./test:12: print "In sub x at line 12.\n"; >> ./test:13: return 13; >> ./test:8: exit 0; This is something like the shell's C<-x> option. =head1 DETAILS Inside your program, you can enable and disable tracing by doing $Devel::Trace::TRACE = 1; # Enable $Devel::Trace::TRACE = 0; # Disable or Devel::Trace::trace('on'); # Enable Devel::Trace::trace('off'); # Disable C exports the C function if you ask it to: import Devel::Trace 'trace'; Then if you want you just say trace 'on'; # Enable trace 'off'; # Disable =head1 TODO =over 4 =item * You should be able to send the trace output to the filehandle of your choice. =item * You should be able to specify the format of the output. =item * You should be able to get the output into a string. =back We'll see. =head1 LICENSE Devel::Trace 0.11 and its source code are hereby placed in the public domain. =head1 Author =begin text Mark-Jason Dominus (C), Plover Systems co. See the C Page at http://www.plover.com/~mjd/perl/Trace for news and upgrades. =end text =begin man Mark-Jason Dominus (C), Plover Systems co. See the C Page at http://www.plover.com/~mjd/perl/Trace for news and upgrades. =end man =begin html

Mark-Jason Dominus (mjd-perl-trace@plover.com), Plover Systems co.

See The Devel::Trace.pm Page for news and upgrades.

=end html =cut Devel-Trace-0.12/t/compile.t000644 000766 000766 00000000132 11717235734 015573 0ustar00rjbsrjbs000000 000000 use strict; use Test::More tests => 1; require Devel::Trace; ok('we loaded the code!');