Od_o - Debug into a Perl Compilers backend options handling


B-Debugger documentation Contained in the B-Debugger distribution.

Index


Code Index:

NAME

Top

Od_o - Debug into a Perl Compilers backend options handling

SYNOPSIS

Top

	perl -d -MOd_o=Backend[,OPTIONS] foo.pl

	Od_o::CODE(0x14d5e00)((eval 9)[lib/Od_o.pm:12]:8):
	8:                  &{"B::${backend}::compile"}(@options);
  	DB<1> s
	B::C::compile(lib/B/C.pm:3159):
	3159:     my @options = @_;

DESCRIPTION

Top

This module is a minor variant to Od to step into the compiler backend option handling.

Od passes through the options at compile-time and steps through the compile method. Od_o passes through the options at run-time but fails to step through the compile method with proper cop settings, i.e. line info.

Think of Od as fast way into the compiler and Od_o as fast way into the option handling part of compile.

AUTHOR

Top

Reini Urban, rurban@cpan.org 2009


B-Debugger documentation Contained in the B-Debugger distribution.

package Od_o;

our $VERSION = '0.13';

use B;
use Carp;

sub import {
    my ($class, @options) = @_;
    my $backend = shift (@options);
    # XXX This messes up COP line info when stepping into the compiler callback.
    eval q[
		CHECK {
	    	    use B::].$backend.q[ ();
	    	    if ($@) { croak "use of backend $backend failed: $@"; }
                }
		INIT {
	    	    # local $savebackslash = $\; local ($\,$",$,) = (undef,' ','');
	    	    &{"B::${backend}::compile"}(@options);
		}
        ];
    die $@ if $@;
}

1;

__END__