$a = `$^X $path "-MO=Deparse" -anlwi.bak -e 1 2>&1`;
$a =~ s/-e syntax OK\n//g;
$a =~ s/.*possible typo.*\n//; # Remove warning line
+$a =~ s/.*-i used with no filenames.*\n//; # Remove warning line
$a =~ s{\\340\\242}{\\s} if (ord("\\") == 224); # EBCDIC, cp 1047 or 037
$a =~ s{\\274\\242}{\\s} if (ord("\\") == 188); # $^O eq 'posix-bc'
$b = <<'EOF';
(void)sv_utf8_decode(sv);
}
}
+
+ if (PL_inplace && (!PL_argvgv || AvFILL(GvAV(PL_argvgv)) == -1))
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_INPLACE),
+ "-i used with no filenames on the command line, "
+ "reading from STDIN");
}
STATIC void
(4294967295) and therefore non-portable between systems. See
L<perlport> for more on portability concerns.
+=item -i used with no filenames on the command line, reading from STDIN
+
+(S inplace) The C<-i> option was passed on the command line, indicating
+that the script is intended to edit files inplace, but no files were
+given. This is usually a mistake, since editing STDIN inplace doesn't
+make sense, and can be confusing because it can make perl look like it
+is hanging when it is really just trying to read from STDIN. You should
+either pass a filename to edit, or remove C<-i> from the command line.
+See L<perlrun> for more details.
+
=item Identifier too long
(F) Perl limits identifiers (names for variables, functions, etc.) to
BEGIN { require "./test.pl"; }
-plan(tests => 112);
+plan(tests => 114);
use Config;
is(join(":", @bak),
"foo yada dada:bada foo bing:king kong foo",
"-i backup file");
+
+ my $out1 = runperl(
+ switches => ['-i.bak -p'],
+ prog => 'exit',
+ stderr => 1,
+ stdin => "1\n",
+ );
+ is(
+ $out1,
+ "-i used with no filenames on the command line, reading from STDIN.\n",
+ "warning when no files given"
+ );
+ my $out2 = runperl(
+ switches => ['-i.bak -p'],
+ prog => 'exit',
+ stderr => 1,
+ stdin => "1\n",
+ args => ['file'],
+ );
+ is($out2, "", "no warning when files given");
}
# Tests for -E