]> sipb.mit.edu Git - ikiwiki.git/commitdiff
optimisation, only load openid module when signing in
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 20 Mar 2008 01:12:18 +0000 (21:12 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 20 Mar 2008 01:12:18 +0000 (21:12 -0400)
This makes the CGI about .2 seconds faster when editing pages etc.

IkiWiki/Plugin/openid.pm

index de31f38ee3fffb7d8e9910afd5fadcf46ad41983..10a8fa22f46aa8116f10e13a48ac01678b8ba997 100644 (file)
@@ -27,15 +27,15 @@ sub formbuilder_setup (@) { #{{{
        my $session=$params{session};
        my $cgi=$params{cgi};
        
-       # Give up if module is unavailable to avoid needing to depend on
-       # it.
-       eval q{use Net::OpenID::Consumer};
-       if ($@) {
-               debug("unable to load Net::OpenID::Consumer, not enabling OpenID login");
-               return;
-       }
-
        if ($form->title eq "signin") {
+               # Give up if module is unavailable to avoid
+               # needing to depend on it.
+               eval q{use Net::OpenID::Consumer};
+               if ($@) {
+                       debug("unable to load Net::OpenID::Consumer, not enabling OpenID login");
+                       return;
+               }
+
                # This avoids it displaying a redundant label for the
                # OpenID fieldset.
                $form->fieldsets("OpenID");