From fdb449fbd9f49ff50b1365369abf0b8484cd3b26 Mon Sep 17 00:00:00 2001 From: Marc Green Date: Mon, 13 Feb 2012 20:04:37 -0500 Subject: [PATCH] Reword pod2html crossref err msgs; show only if $verbose Fixes #11860 --- ext/Pod-Html/lib/Pod/Html.pm | 27 +++++++++++++++++---------- ext/Pod-Html/t/feature2.t | 6 ++++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ext/Pod-Html/lib/Pod/Html.pm b/ext/Pod-Html/lib/Pod/Html.pm index 64cf376..71555e7 100644 --- a/ext/Pod-Html/lib/Pod/Html.pm +++ b/ext/Pod-Html/lib/Pod/Html.pm @@ -2,7 +2,7 @@ package Pod::Html; use strict; require Exporter; -our $VERSION = 1.24; +our $VERSION = 1.25; our @ISA = qw(Exporter); our @EXPORT = qw(pod2html htmlify); our @EXPORT_OK = qw(anchorify relativize_url); @@ -766,22 +766,29 @@ sub resolve_pod_page_link { push @matches, $modname if $modname =~ /::\Q$to\E\z/; } + # make it look like a path instead of a namespace + my $modloc = File::Spec->catfile(split(/::/, $to)); + if ($#matches == -1) { - warn "Cannot find \"$to\" in podpath: " . - "cannot find suitable replacement path, cannot resolve link\n" - unless $self->quiet; + warn "Cannot find file \"$modloc.*\" directly under podpath, " . + "cannot find suitable replacement: link remains unresolved.\n" + if $self->verbose; return ''; } elsif ($#matches == 0) { - warn "Cannot find \"$to\" in podpath: " . - "using $matches[0] as replacement path to $to\n" - unless $self->quiet; $path = $self->pages->{$matches[0]}; + my $matchloc = File::Spec->catfile(split(/::/, $path)); + warn "Cannot find file \"$modloc.*\" directly under podpath, but ". + "I did find \"$matchloc.*\", so I'll assume that is what you ". + "meant to link to.\n" + if $self->verbose; } else { - warn "Cannot find \"$to\" in podpath: " . - "more than one possible replacement path to $to, " . - "using $matches[-1]\n" unless $self->quiet; # Use [-1] so newer (higher numbered) perl PODs are used + # XXX currently, @matches isn't sorted so this is not true $path = $self->pages->{$matches[-1]}; + my $matchloc = File::Spec->catfile(split(/::/, $path)); + warn "Cannot find file \"$modloc.*\" directly under podpath, but ". + "I did find \"$matchloc.*\" (among others), so I'll use that " . + "to resolve the link.\n" if $self->verbose; } } else { $path = $self->pages->{$to}; diff --git a/ext/Pod-Html/t/feature2.t b/ext/Pod-Html/t/feature2.t index dfafbe9..ea335b0 100644 --- a/ext/Pod-Html/t/feature2.t +++ b/ext/Pod-Html/t/feature2.t @@ -26,8 +26,10 @@ convert_n_test("feature2", "misc pod-html features 2", like($warn, qr( - \Acaching\ directories\ for\ later\ use\n - Converting\ input\ file\ \S+[/\\\]]feature2\.pod\n\z + \Acaching\ directories\ for\ later\ use\n + Converting\ input\ file\ \S+[/\\\]]feature2\.pod\n + Cannot\ find\ file\ "crossref\.\*"\ directly\ under\ podpath,\ cannot\ find + \ suitable\ replacement:\ link\ remains\ unresolved\.\n\z )x, "misc pod-html --verbose warnings"); -- 1.8.3.1