W3C home > Mailing lists > Public > www-validator-cvs@w3.org > April 2011

link-checker commit: Avoid "uninitialized $hostport" warnings, generated with e.g. news: URIs.

From: Mercurial notifier <nobody@w3.org>
Date: Fri, 29 Apr 2011 19:42:55 +0000
Message-Id: <E1QFtaZ-00078R-Mq@mcbain.w3.org>
To: link-checker updates <www-validator-cvs@w3.org>
changeset:   403:81914ff50f48
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Fri Apr 29 22:42:40 2011 +0300
files:       bin/checklink
description:
Avoid "uninitialized $hostport" warnings, generated with e.g. news: URIs.


diff -r f715518f132e -r 81914ff50f48 bin/checklink
--- a/bin/checklink	Sat Apr 02 20:53:13 2011 +0300
+++ b/bin/checklink	Fri Apr 29 22:42:40 2011 +0300
@@ -1235,9 +1235,10 @@
         my $fragment  = $canon_uri->fragment(undef);
         if (!defined($Opts{Exclude}) || $canon_uri !~ $Opts{Exclude}) {
             if (!exists($links{$canon_uri})) {
-                my $hostport =
-                    $canon_uri->can('host_port') ? $canon_uri->host_port() :
-                                                   '';
+                my $hostport;
+                $hostport = $canon_uri->host_port()
+                    if $canon_uri->can('host_port');
+                $hostport = '' unless defined $hostport;
                 push(@{$hostlinks{$hostport}}, $canon_uri);
             }
             for my $line_num (keys(%$lines)) {
Received on Friday, 29 April 2011 19:42:57 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:45 UTC