diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-13 14:26:19 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-13 21:24:54 -0800 |
commit | de61bf2ac7b4130886e0d3b93c1f0e22b7dfaec3 (patch) | |
tree | f99906f756d08ada7c7c40cada08834aac2f23a4 | |
parent | 213084e431373aec68f094fabf7c87419d9c7688 (diff) | |
download | perl-de61bf2ac7b4130886e0d3b93c1f0e22b7dfaec3.tar.gz |
Suppress confusing uninit warning from -T _
-T _ uses the file name saved by a preceding stat. If there was no
preceding stat, the internal sv used to store the file name is unde-
fined, so SvPV producing an uninitialized warning. Normally a failed
-T will just return undefined and set $!. Normally stat on a filehan-
dle will set the internal stat file name to "".
This commit sets the internal file name to "" initially on startup,
instead of creating an undefined scalar.
-rw-r--r-- | perl.c | 2 | ||||
-rw-r--r-- | t/op/filetest.t | 5 |
2 files changed, 5 insertions, 2 deletions
@@ -4088,7 +4088,7 @@ S_init_predump_symbols(pTHX) GvMULTI_on(tmpgv); GvIOp(tmpgv) = MUTABLE_IO(SvREFCNT_inc_simple(io)); - PL_statname = newSV(0); /* last filename we did stat on */ + PL_statname = newSVpvs(""); /* last filename we did stat on */ } void diff --git a/t/op/filetest.t b/t/op/filetest.t index 5cc83d7107..647bd9d9a6 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -10,7 +10,7 @@ BEGIN { } use Config; -plan(tests => 35 + 27*14); +plan(tests => 36 + 27*14); ok( -d 'op' ); ok( -f 'TEST' ); @@ -257,3 +257,6 @@ SKIP: { like $@, qr/^The stat preceding -l _ wasn't an lstat at /, '-T HANDLE sets the stat type'; } + +is runperl(prog => '-T _', switches => ['-w'], stderr => 1), "", + 'no uninit warnings from -T with no preceding stat'; |