PrePAN

Sign in to PrePAN

Debug::Filter::PrintExpr Convert comment lines to debug print statements

Good

Synopsis

SYNOPSIS


    use Debug::Filter::PrintExpr;

    my $s = 'a scalar';
    my @a = qw(this is an array);
    my %h = (key1 => 'value1', key2 => 'value2');
    my $ref = \%h;

    #${$s}
    #@{@a}
    #%{%h}
    #${ calc: @a * 2 }
    #\{$ref}

produces an output like:

    line 13: $s = 'a scalar';
    line 14: @a = ('this', 'is', 'an', 'array');
    line 15: %h = ('key1' => 'value1', 'key2' => 'value2');
    calc: @a * 2  = '8';
    line 17:
    $ref = {
      'undef' => undef,
      'a' => 1,
      '' => 'empty',
      'b' => 2
    };

SEE ALSO

Damian Conway''s module `Smart::Comments` provides something similar
and more advanced.

Description

Debug::Filter::PrintExpr makes use of Filter::Simple to transform specially formed comment lines into print statements for various debugging purposes.

Comments

Please sign up to post a review.