NAME
Mojolicious::Plugin::LinkEmbedder - Convert a URL to embedded content
VERSION
0.02
DESCRIPTION
This module can transform a URL to an iframe, image or other embeddable content.
SYNOPSIS
use Mojolicious::Lite;
plugin LinkEmbedder => { route => '/embed' };
Or if you want full control:
plugin 'LinkEmbedder';
get '/embed' => sub {
my $self = shift->render_later;
$self->embed_link($self->param('url'), sub {
my($self, $link) = @_;
$self->respond_to(
json => {
json => {
media_id => $link->media_id,
url => $link->url->to_string,
},
},
any => { text => "$link" },
);
});
};
app->start;
SUPPORTED LINKS
METHODS
embed_link
See "SYNOPSIS".
register
$app->plugin('LinkEmbedder' => \%config);
Will register the "embed_link" helper which creates new objects from Mojolicious::Plugin::LinkEmbedder::Default. %config
is optional but can contain:
route => $str|$obj
Use this if you want to have the default handler to do link embedding. The default handler is shown in "SYNOPSIS".
$str
is just a path, while$obj
is a Mojolicious::Routes::Route object.
AUTHOR
Jan Henning Thorsen - jhthorsen@cpan.org
Marcus Ramberg - mramberg@cpan.org