App-pl
view release on metacpan or search on metacpan
854855856857858859860861862863864865866867868869870871872873874=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]>>
112113114115116117118119120121122123124125126127128129130131132# 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'
,
''
) {
test
"pl -i file$sfx contents"
,
join
''
,
map
{
open
my
$in
,
'<'
,
$_
.
$sfx
or
die
$!;
slurp
$in
;
}
@copies
;
tr
/abc/xyz/;
}
( run in 0.460 second using v1.01-cache-2.11-cpan-cba739cd03b )