Don't use undef value in Config::myconfig
authorAndreas J. Koenig <k@sissy.in-berlin.de>
Fri, 27 Jun 1997 05:21:14 +0000 (17:21 +1200)
committerTim Bunce <Tim.Bunce@ig.co.uk>
Wed, 6 Aug 1997 12:00:00 +0000 (00:00 +1200)
Subject: Config->myconfig not -w clean

Thanks to a report by Larry Virden I spotted a bug in Config.pm.
Undefined values trigger "Use of undefined value" messages, e.g.

# perl -MConfig -we 'print Config->myconfig'
Use of uninitialized value at /usr/local/lib/perl5/IP22-irix/5.004/Config.pm line 553.
Use of uninitialized value at /usr/local/lib/perl5/IP22-irix/5.004/Config.pm line 553.
Use of uninitialized value at /usr/local/lib/perl5/IP22-irix/5.004/Config.pm line 553.
Use of uninitialized value at /usr/local/lib/perl5/IP22-irix/5.004/Config.pm line 553.
Summary of my perl5 (5.0 patchlevel 4 subversion 0) configuration:
  Platform:
[...]

I'd suggest this simple patch:

Credited: Chip Salzenberg <salzench@nielsenmedia.com>

p5p-msgid: 199706271525.RAA13517@sissy.in-berlin.de

configpm

index fcf4e3d..2a22bfc 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -79,6 +79,13 @@ my $summary_expanded = 0;
 
 sub myconfig {
        return $summary if $summary_expanded;
+       $summary =~ s{
+                     \$(\w+)
+                    }{
+                         defined $Config{$1} 
+                         ? $Config{$1} 
+                         : "not defined"
+                    }xge;
        $summary =~ s/\$(\w+)/$Config{$1}/ge;
        $summary_expanded = 1;
        $summary;