App-pltest

 view release on metacpan or  search on metacpan

pltest  view on Meta::CPAN

=item C<-FI</pattern/>>

I<perl:> Provide C<split()> pattern for B<-a> switch (C<//>'s are optional).

=item C<-II<directory>>

I<perl:> Specify C<@INC>/C<#include> directory (several B<-I>'s allowed).

=item C<-iI<[extension]>>

I<perl:> Edit C<< <> >> files in place (makes backup if extension supplied).

=item C<-n>

I<As I said before, I never repeat myself. :-)>

I<perl:> Assume C<< while (<>) { ... } >> loop around program.  It's a little
richer than that: if you use C<last>, it closes the current file, leaving you
to continue the loop on the next file.

=item C<-oI<[number]>>

t/n-loop.t  view on Meta::CPAN

# Testing -i is a bit more complicated. pl_e -i doesn't really test anything.  The actual test comes then.
my @copies = map {
    open my $in, '<', $_ or die $!;
    my $copy = "copy-$_";
    open my $out, '>', $copy or die $!;
    defined( syswrite $out, slurp $in ) or die $!;
    $copy;
} @files;

# Since -i outputs nothing, instead as a side effect test that I get STDERR.
pl_e "get me\nnow", '-pibkp', '-B warn "get me\n"; E "now"', 'tr/abc/xyz/', @copies;	# Windows perl requires -i with backup

$_ = $copy;
for my $sfx ('bkp', '') {
    my $ret = join '', map {
	open my $in, '<', $_.$sfx or die $!;
	slurp $in;
    } @copies;
    ok $ret eq $_,
      "pltest -i file$sfx contents"
      or print "got: '$ret', expected: '$_'\n";



( run in 1.375 second using v1.01-cache-2.11-cpan-49f99fa48dc )