On Wed, Jul 06, 2005 at 03:38:22PM -0000, avised @ kbcfp. com wrote:
> The following test program
> 
>     use warnings;
>     use IO::Socket;
>     IO::Socket::INET->new(PeerAddr => 'localhost',
>                           PeerPort => '23',
>                          );
>     die;
> 
> produces the error output
> 
>     Use of uninitialized value in die at ./test line 7.
>     Died at ./test line 7.

Thanks for the report; the test case be reduced to

    undef $@; die;

Fixed in bleedperl by the change below.

Dave.

-- 
"The greatest achievement of the Austrians has been convincing the world
that Hitler was German, and Mozart Austrian."

Change 25087 by [EMAIL PROTECTED] on 2005/07/06 20:09:29

        [perl #36470] 'undef $@; die' gives uninint value warning

Affected files ...

... //depot/perl/pp_sys.c#429 edit
... //depot/perl/t/op/die.t#5 edit

Differences ...

==== //depot/perl/pp_sys.c#429 (text) ====

@@ -517,7 +517,10 @@
            if (SvPOK(error) && SvCUR(error))
                sv_catpv(error, "\t...propagated");
            tmpsv = error;
-           tmps = SvPV_const(tmpsv, len);
+           if (SvOK(tmpsv))
+               tmps = SvPV_const(tmpsv, len);
+           else
+               tmps = Nullch;
        }
     }
     if (!tmps || !len)

==== //depot/perl/t/op/die.t#5 (xtext) ====

@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..14\n";
+print "1..15\n";
 
 $SIG{__DIE__} = sub { print ref($_[0]) ? ("ok ",$_[0]->[0]++,"\n") : @_ } ;
 
@@ -61,3 +61,14 @@
     print "not " unless $@ =~ /Global symbol "\$\x{3b1}"/;
     print "ok 14\n";
 }
+
+# [perl #36470] got uninit warning if $@ was undef
+
+{
+    my $ok = 1;
+    local $SIG{__DIE__};
+    local $SIG{__WARN__} = sub { $ok = 0 };
+    eval { undef $@; die };
+    print "not " unless $ok;
+    print "ok 15\n";
+}

Reply via email to