App-a2p
view release on metacpan or search on metacpan
lib/App/a2p.pm view on Meta::CPAN
comment "C<#???>". You should go through and check them. You might
want to run at least once with the B<-w> switch to perl, which will
warn you if you use == where you should have used eq.
Perl does not attempt to emulate the behavior of awk in which
nonexistent array elements spring into existence simply by being
referenced. If somehow you are relying on this mechanism to create
null entries for a subsequent for...in, they won't be there in perl.
If a2p makes a split line that assigns to a list of variables that
looks like (Fld1, Fld2, Fld3...) you may want to rerun a2p using the
B<-n> option mentioned above. This will let you name the fields
throughout the script. If it splits to an array instead, the script
is probably referring to the number of fields somewhere.
The exit statement in awk doesn't necessarily exit; it goes to the END
block if there is one. Awk scripts that do contortions within the END
block to bypass the block under such circumstances can be simplified
by removing the conditional in the END block and just exiting directly
from the perl script.
t/10-basics.t view on Meta::CPAN
close $fh or die "Couldn't close $filename: $!"
}
my $tempdir = tempdir(CLEANUP => 1);
my $input_awk = catfile($tempdir, 'input.awk');
my $input_perl = catfile($tempdir, 'input.perl');
#mkdir $tempdir or die "Couldn't mkdir $tempdir: $!";
spew($input_awk, "/awk2perl/\n");
my $program = runa2p(progfile => $input_awk);
like($program, qr{print \$_ if /awk2perl/;}, 'Output looks like expected output');
spew($input_perl, $program);
my $output = runperl(progfile => $input_perl, args => [ $0 ]);
open my $self, '<', $0;
chomp(my @expected = grep { /awk2perl/ } <$self>);
is_deeply([ split /\n/, $output ], \@expected, 'Output is identical to ⦠code');
done_testing;
sub run_command {
( run in 0.414 second using v1.01-cache-2.11-cpan-64827b87656 )