Devel::Dt - Kind of emulates command line flag -Dt on normal perl


Devel-Dt documentation Contained in the Devel-Dt distribution.

Index


Code Index:

NAME

Top

Devel::Dt - Kind of emulates command line flag -Dt on normal perl

VERSION

Top

version 0.04

SYNOPSIS

Top

Use the module and it'll immediately begin acting like you'd started your perl with -Dt.

 perl -MDevel::Dt -e 'print q(hi)'

The above program results in the following output. There is an outstanding bug that the arguments to the operations aren't being dumped.

 (?:?)  leavesub=0x84f6778
 (?:?)  const=0x84f6620
 (?:?)  negate=0x84f67f8
 (?:?)  enter=0x817cc78
 (-e:1)  nextstate=0x816d480
 (-e:1)  pushmark=0x8165818
 (-e:1)  const=0x816d618
 (-e:1)  print=0x816d568
 (-e:1)  leave=0x816d4b8

FUNCTIONS

Top

dt( ... )

A Runops::Trace hook, installed as a mandatory hook.

AUTHOR

Top

Joshua ben Jore, <jjore at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-devel-dt at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-Dt. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Devel::Dt

You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-Dt

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Devel-Dt

* CPAN Ratings

http://cpanratings.perl.org/d/Devel-Dt

* Search CPAN

http://search.cpan.org/dist/Devel-Dt

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top

AUTHOR

Top

Josh Jore <jjore@cpan.org>

COPYRIGHT AND LICENSE

Top


Devel-Dt documentation Contained in the Devel-Dt distribution.

package Devel::Dt;
BEGIN {
  $Devel::Dt::VERSION = '0.04';
}
# ABSTRACT: Kind of emulates command line flag -Dt on normal perl

use warnings;
use strict;
use B ();
use B::Utils ();
use Runops::Trace ();
# use Data::Dump::Streamer ();
use IO::Handle;

my $Dumper;
my $CurrentFile;
my $CurrentLine;
my $OutputHandle;

sub dt {
    my ( $op, $arity, @args ) = @_;
    my $name  = $op->oldname;
    my $class = B::class( $op );

    my $dumped = '';
    if ( @args ) {
	$dumped = "@args";
	# $dumped = $Dumper->Data( \ @args );
    }

    if ( 'COP' eq $class ) {
	$CurrentFile = $op->file;
	$CurrentLine = $op->line;
    }
    
    $OutputHandle->printf( "(%s:%s)  %s=0x%0x\n", $CurrentFile, $CurrentLine, $name, $$op, $dumped )
	or warn "Can't write to $OutputHandle: $!";

    return;
}

BEGIN {
    $CurrentFile = $CurrentLine = '?';

    $OutputHandle = \ *STDERR;

    # $Dumper = Data::Dump::Streamer->new;
    # 
    # $Dumper->Names( 'args' );
    # $Dumper->Purity( 0 );
    # $Dumper->Declare( 0 );
    # $Dumper->KeyOrder( 'smart' );

    Runops::Trace::enable_global_tracing( \&dt );
}


() = -.0

__END__