common: silence warning in showlink about unused href
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 2 Jun 2022 21:53:27 +0000 (23:53 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 3 Jun 2022 22:53:43 +0000 (00:53 +0200)
common.inc.plp

index a1eb3e5e2a54ce24a0f7c9b110a6cdb5d5751b02..898e8bbcd5dd24774d6a32f166f14dae0def9fee 100644 (file)
@@ -233,10 +233,9 @@ BEGIN {
 
 sub showlink {
        my ($title, $href, $selected) = @_;
-       return sprintf(
-               !$href ? '%s' :
-               $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
-               EscapeHTML($title), EscapeHTML($href)
-       );
+       EscapeHTML($title);
+       return $title if not $href;
+       return "<strong>$title</strong>" if $selected;
+       return sprintf '<a href="%s">%s</a>', EscapeHTML($href), $title;
 }