#!/usr/bin/perl use IO::Scalar; my ($out, $SH); BEGIN { $SH = new IO::Scalar \$out; }; use Acme::Echo qw/before after lines/, line_fmt => ":> %s\n", 'src_fmt' => "CODE RAN WAS:
\n
\n%s\n
\n", fh => $SH; use strict; use warnings; use Test::More tests => 2; my $s = 0; foreach (1 .. 10){ $s += $_; } no Acme::Echo; my $expected = do { local $/ = undef; }; is( $out, $expected, "output matches" ); is( $s, 55, "s=55" ); __DATA__ CODE RAN WAS:

use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
  $s += $_;
}


:> use strict; :> use warnings; :> use Test::More tests => 2; :> my $s = 0; COMPOUND STATEMENTS NOT SUPPORTED IN lines MODE CODE RAN WAS:

use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
  $s += $_;
}