NAME
Mojolicious::Plugin::XRD - Render XRD documents with Mojolicious
SYNOPSIS
# Mojolicious
$self->plugin('XRD');
# In controller
my $xrd = $c->new_xrd;
$xrd->link(profile => '/me.html');
# Render as XRD or JRD
$c->render_xrd($xrd);
DESCRIPTION
Mojolicious::Plugin::XRD is a plugin to support Extensible Resource Descriptor documents through XML::Loy::XRD.
Additionally it supports the rel parameter of the WebFinger specification.
METHODS
register
# Mojolicious
$app->plugin('XRD');
# Mojolicious::Lite
plugin 'XRD';
Called when registering the plugin.
HELPERS
render_xrd
# In Controllers
$self->render_xrd( $xrd );
$self->render_xrd( undef, 'acct:acron@sojolicio.us' );
The helper render_xrd renders an XRD object either in xml or in json notation, depending on the request. If an XRD object is empty, it renders a 404 error and accepts a second parameter as the subject of the error document.
new_xrd
# In Controller:
my $xrd = $self->new_xrd;
Returns a new XML::Loy::XRD object without extensions.
CAVEATS
There are different versions of XRD and JRD with different MIME types defined. In some cases you may have to change the MIME type manually.
DEPENDENCIES
Mojolicious, Mojolicious::Plugin::XML::Loy.
AVAILABILITY
https://github.com/Akron/Mojolicious-Plugin-XRD
COPYRIGHT AND LICENSE
Copyright (C) 2011-2013, Nils Diewald.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl.