| Catalyst-Plugin-Account-AutoDiscovery documentation | Contained in the Catalyst-Plugin-Account-AutoDiscovery distribution. |
Catalyst::Plugin::Account::AutoDiscovery - Catalyst Plugin for Account Auto-Discovery
use Catalyst qw/Account::AutoDiscovery/;
# setting
$c->config(
account_autodiscovery => {
name => 'typester',
is_xml => 0,
},
);
# output
$c->account_autodiscovery;
# in View::TT
[% c.account_autodiscovery %]
This is a simple Catalyst plugin for Account Auto-Discovery.
Hatena Bookmark http://b.hatena.ne.jp/help?mode=tipjar
Daisuke Murase, <typester@cpan.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Plugin-Account-AutoDiscovery documentation | Contained in the Catalyst-Plugin-Account-AutoDiscovery distribution. |
package Catalyst::Plugin::Account::AutoDiscovery; use strict; our $VERSION = '0.01';
sub account_autodiscovery { my $c = shift; my $url = $c->config->{account_autodiscovery}->{base_url} || $c->config->{base_url} || $c->req->base; $url .= $c->req->path; my $name = $c->config->{account_autodiscovery}->{name}; my $service = $c->config->{account_autodiscovery}->{service} || 'http://www.hatena.ne.jp/'; my $is_xml = defined $c->config->{account_autodiscovery}->{is_xml} ? $c->config->{account_autodiscovery}->{is_xml} : 1; my $xml = <<""; <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/"> <rdf:Description rdf:about="$url"> <foaf:maker rdf:parseType="Resource"> <foaf:holdsAccount> <foaf:OnlineAccount foaf:accountName="$name"> <foaf:accountServiceHomepage rdf:resource="$service" /> </foaf:OnlineAccount> </foaf:holdsAccount> </foaf:maker> </rdf:Description> </rdf:RDF> $xml = "<!--\n".$xml."-->" if $is_xml; $xml; }
1;