Acme-Echo
view release on metacpan or search on metacpan
lib/Acme/Echo.pm view on Meta::CPAN
use Filter::Simple;
use PPI;
our %modes;
our $line_fmt = "%s\n";
our $src_fmt = "==>\n%s\n<==\n";
our $fh = *STDOUT;
sub import {
my $pkg = shift;
while ( $_ = shift @_ ){
if( /^before|after|lines$/ ){
$modes{ lc $_ } = undef;
}elsif( $_ eq 'line_fmt' ){
$line_fmt = shift;
}elsif( $_ eq 'src_fmt' ){
$src_fmt = shift;
}elsif( $_ eq 'fh' ){
$fh = shift;
}else{
die "bad parameter '$_' to Acme::Echo";
}
}
use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
$s += $_;
}
no Acme::Echo;
my $expected = do { local $/ = undef; <DATA> };
is( $out, $expected, "output matches" );
is( $s, 55, "s=55" );
__DATA__
CODE RAN WAS:<br>
<pre>
use strict;
use warnings;
use Test::More tests => 2;
use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
$s += $_;
}
no Acme::Echo;
my $expected = do { local $/ = undef; <DATA> };
is( $out, $expected, "output matches" );
is( $s, 55, "s=55" );
__DATA__
CODE RAN WAS:<br>
<pre>
use strict;
use warnings;
use Test::More tests => 2;
use strict;
use warnings;
use Test::More tests => 2;
my $s = 0;
foreach (1 .. 10){
$s += $_;
}
no Acme::Echo;
my $expected = do { local $/ = undef; <DATA> };
is( $out, $expected, "output matches" );
is( $s, 55, "s=55" );
__DATA__
CODE RAN WAS:<br>
<pre>
use strict;
use warnings;
use Test::More tests => 2;
$s=0;
while($s < 3){
$s++;
}
sub cube {
my $n = shift;
return $n ** 3
}
no Acme::Echo;
my $expected = do { local $/ = undef; <DATA> };
is( $out, $expected, "output matches" );
is( $s, 3, "s=3" );
__DATA__
--> use strict; <--
--> use warnings; <--
--> use Test::More tests => 2; <--
--> my $x = 1; <--
--> my $y; <--
--> $y = $x ** 2; <--
( run in 1.211 second using v1.01-cache-2.11-cpan-d80b1682f3f )