root/WWW-Blog-Metadata-OpenID/trunk/lib/WWW/Blog/Metadata/OpenID.pm

Revision 1612 (checked in by miyagawa, 15 years ago)

import

Line 
1 package WWW::Blog::Metadata::OpenID;
2
3 use strict;
4 use vars qw($VERSION);
5 $VERSION = '0.01';
6
7 use WWW::Blog::Metadata;
8 use URI;
9
10 WWW::Blog::Metadata->mk_accessors(qw( openid_server openid_delegate ));
11
12 sub on_got_tag {
13     my $class = shift;
14     my($meta, $tag, $attr, $base_uri) = @_;
15     if ($tag eq 'link' && $attr->{rel}) {
16         my %rel = map { $_ => 1 } split /\s+/, lc $attr->{rel};
17         for my $role (qw( server delegate )) {
18             if ($rel{"openid.$role"}) {
19                 my $meth = "openid_$role";
20                 $meta->$meth(URI->new_abs($attr->{href}, $base_uri)->as_string);
21             }
22         }
23     }
24 }
25
26 sub on_got_tag_order { 99 }
27
28 1;
29 __END__
30
31 =head1 NAME
32
33 WWW::Blog::Metadata::OpenID - Extract OpenID server from weblog
34
35 =head1 SYNOPSIS
36
37   use WWW::Blog::Metadata;
38   my $meta = WWW::Blog::Metadata->extract_from_uri($uri)
39       or die WWW::Blog::Metadata->errstr;
40   print $meta->openid_server;
41   print $meta->openid_delegate;
42
43 =head1 DESCRIPTION
44
45 WWW::Blog::Metadata::OpenID is a WWW::Blog::Metadata plugin to extract
46 OpenID server URL from weblog HTML.
47
48 =head1 AUTHOR
49
50 Tatsuhiko Miyagawa E<lt>miyagawa@cpan.orgE<gt>
51
52 This library is free software; you can redistribute it and/or modify
53 it under the same terms as Perl itself.
54
55 =head1 SEE ALSO
56
57 L<WWW::Blog::Metadata> L<Net::OpenID::Consumer> http://www.openid.net/
58
59 =cut
Note: See TracBrowser for help on using the browser.