]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki.pm
(no commit message)
[ikiwiki.git] / IkiWiki.pm
index 75b7a7b3e116e84e7708a73845cef01a02b02aa4..f57ef8c6c89d169cf8523d5f588b939f62d8d540 100644 (file)
@@ -2388,7 +2388,7 @@ sub glob2re ($) {
        my $re=quotemeta(shift);
        $re=~s/\\\*/.*/g;
        $re=~s/\\\?/./g;
-       return $re;
+       return qr/^$re$/i;
 }
 
 package IkiWiki::FailReason;
@@ -2493,12 +2493,11 @@ sub match_glob ($$;@) {
 
        # Instead of converting the glob to a regex every time,
        # cache the compiled regex to save time.
-       if (!exists $glob_cache{$glob}
-                       or !defined $glob_cache{$glob}) {
-               my $re = IkiWiki::glob2re($glob);
-               $glob_cache{$glob} = qr/^$re$/i;
+       my $re=$glob_cache{$glob};
+       unless (defined $re) {
+               $glob_cache{$glob} = $re = IkiWiki::glob2re($glob);
        }
-       if ($page=~ $glob_cache{$glob}) {
+       if ($page =~ $re) {
                if (! IkiWiki::isinternal($page) || $params{internal}) {
                        return IkiWiki::SuccessReason->new("$glob matches $page");
                }
@@ -2668,7 +2667,7 @@ sub match_user ($$;@) {
                return IkiWiki::ErrorReason->new("no user specified");
        }
 
-       if (defined $params{user} && $params{user}=~/^$regexp$/i) {
+       if (defined $params{user} && $params{user}=~$regexp) {
                return IkiWiki::SuccessReason->new("user is $user");
        }
        elsif (! defined $params{user}) {