line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::Plugin::Account::AutoDiscovery; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
28750
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
245
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Catalyst::Plugin::Account::AutoDiscovery - Catalyst Plugin for Account Auto-Discovery |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use Catalyst qw/Account::AutoDiscovery/; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# setting |
16
|
|
|
|
|
|
|
$c->config( |
17
|
|
|
|
|
|
|
account_autodiscovery => { |
18
|
|
|
|
|
|
|
name => 'typester', |
19
|
|
|
|
|
|
|
is_xml => 0, |
20
|
|
|
|
|
|
|
}, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# output |
24
|
|
|
|
|
|
|
$c->account_autodiscovery; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# in View::TT |
27
|
|
|
|
|
|
|
[% c.account_autodiscovery %] |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 DESCRIPTION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
This is a simple Catalyst plugin for Account Auto-Discovery. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 account_autodiscovery |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub account_autodiscovery { |
40
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
my $url = $c->config->{account_autodiscovery}->{base_url} || $c->config->{base_url} || $c->req->base; |
43
|
0
|
|
|
|
|
|
$url .= $c->req->path; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $name = $c->config->{account_autodiscovery}->{name}; |
46
|
0
|
|
0
|
|
|
|
my $service = $c->config->{account_autodiscovery}->{service} || 'http://www.hatena.ne.jp/'; |
47
|
0
|
0
|
|
|
|
|
my $is_xml = defined $c->config->{account_autodiscovery}->{is_xml} ? $c->config->{account_autodiscovery}->{is_xml} : 1; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $xml = <<""; |
50
|
|
|
|
|
|
|
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
51
|
|
|
|
|
|
|
xmlns:foaf="http://xmlns.com/foaf/0.1/"> |
52
|
|
|
|
|
|
|
<rdf:Description rdf:about="$url"> |
53
|
|
|
|
|
|
|
<foaf:maker rdf:parseType="Resource"> |
54
|
|
|
|
|
|
|
<foaf:holdsAccount> |
55
|
|
|
|
|
|
|
<foaf:OnlineAccount foaf:accountName="$name"> |
56
|
|
|
|
|
|
|
<foaf:accountServiceHomepage rdf:resource="$service" /> |
57
|
|
|
|
|
|
|
</foaf:OnlineAccount> |
58
|
|
|
|
|
|
|
</foaf:holdsAccount> |
59
|
|
|
|
|
|
|
</foaf:maker> |
60
|
|
|
|
|
|
|
</rdf:Description> |
61
|
|
|
|
|
|
|
</rdf:RDF> |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
$xml = "<!--\n".$xml."-->" if $is_xml; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$xml; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Catalyst>. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Hatena Bookmark http://b.hatena.ne.jp/help?mode=tipjar |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Daisuke Murase, E<lt>typester@cpan.orgE<gt> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
81
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |