Skip to content

Commit d399c96

Browse files
authored
change return-ifs to switch
1 parent 00d9833 commit d399c96

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/Pod/Htmlify.pm6

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ unit module Pod::Htmlify;
33
use URI::Escape;
44

55
#| Escape special characters in URLs if necessary
6-
sub url-munge($_) is export {
7-
return $_ if m{^ <[a..z]>+ '://'};
8-
return "/type/{uri_escape $_}" if m/^<[A..Z]>/;
9-
return "/routine/{uri_escape $_}" if m/^<[a..z]>|^<-alpha>*$/;
10-
# poor man's <identifier>
11-
if m/ ^ '&'( \w <[[\w'-]>* ) $/ {
12-
return "/routine/{uri_escape $0}";
6+
sub url-munge($url) is export {
7+
given $url {
8+
when m{^ <[a..z]>+ '://'} { $_ }
9+
when m/^<[A..Z]>/ { "/type/{uri_escape $_}" }
10+
when m/^<[a..z]>|^<-alpha>*$/ { "/routine/{uri_escape $_}" }
11+
when m/ ^ '&'( \w <[[\w'-]>* ) $/ { "/routine/{uri_escape $0}" } # poor man's <identifier>
12+
default { $_ }
1313
}
14-
return $_;
1514
}
1615

1716
constant badchars = qw[$ / \ . % ? & = # + " ' : ~ < > |];

0 commit comments

Comments
 (0)