]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/openid.pm
Update IkiWiki::openiduser to work with Net::OpenID 2.x
[git.ikiwiki.info.git] / IkiWiki / Plugin / openid.pm
index 2c9ada23805f95b7cf145ce410b5f57feff0bd54..b4b52fe2f0e5e970c6bbb69d741eccf5352163c5 100644 (file)
@@ -204,8 +204,18 @@ sub openiduser ($) {
 
        if ($user =~ m!^https?://! &&
            eval q{use Net::OpenID::VerifiedIdentity; 1} && !$@) {
-               my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
-               my $display=$oid->display;
+               my $display;
+
+               if (Net::OpenID::VerifiedIdentity->can("DisplayOfURL")) {
+                       # this works in at least 2.x
+                       $display = Net::OpenID::VerifiedIdentity::DisplayOfURL($user);
+               }
+               else {
+                       # this only works in 1.x
+                       my $oid=Net::OpenID::VerifiedIdentity->new(identity => $user);
+                       $display=$oid->display;
+               }
+
                # Convert "user.somehost.com" to "user [somehost.com]"
                # (also "user.somehost.co.uk")
                if ($display !~ /\[/) {