<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Mojolicious::Plugin::LinkEmbedder - Convert a URL to embedded content

VERSION
    0.14

DESCRIPTION
    This module can transform a URL to an iframe, image or other embeddable
    content.

SYNOPSIS
      use Mojolicious::Lite;
      plugin LinkEmbedder =&gt; { route =&gt; '/embed' };

    Or if you want full control:

      plugin 'LinkEmbedder';
      get '/embed' =&gt; sub {
        my $self = shift-&gt;render_later;

        $self-&gt;embed_link($self-&gt;param('url'), sub {
          my($self, $link) = @_;

          $self-&gt;respond_to(
            json =&gt; {
              json =&gt; {
                media_id =&gt; $link-&gt;media_id,
                url =&gt; $link-&gt;url-&gt;to_string,
              },
            },
            any =&gt; { text =&gt; $link-&gt;to_embed },
          );
        });
      };

      app-&gt;start;

SUPPORTED LINKS
    *   Mojolicious::Plugin::LinkEmbedder::Link

    *   Mojolicious::Plugin::LinkEmbedder::Link::Game::_2play

    *   Mojolicious::Plugin::LinkEmbedder::Link::Image

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Dbtv

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Blip

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Collegehumor

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Dagbladet

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Ted

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Vimeo

    *   Mojolicious::Plugin::LinkEmbedder::Link::Video::Youtube

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text::HTML

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text::Github

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text::GistGithub

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text::Metacpan

    *   Mojolicious::Plugin::LinkEmbedder::Link::Text::Twitter

ATTRIBUTES
  cache_cb
    Holds a callback which will cache the results form the Link objects. An
    example of such an callback could be:

      my %CACHE;
      $self-&gt;cache_cb(
        sub {
          my $cb = pop;
          my ($self, $url, $link) = @_;

          if ($link) { # set
            $CACHE{$url} = Mojo::JSON::encode_json($link);
            $self-&gt;$cb;
          }
          else { # get
            $self-&gt;$cb(Mojo::JSON::decode_json($CACHE{$url} || '{}'));
          }
        }
      );

METHODS
  embed_link
    See "SYNOPSIS".

  register
      $app-&gt;plugin('LinkEmbedder' =&gt; \%config);

    Will register the "embed_link" helper which creates new objects from
    Mojolicious::Plugin::LinkEmbedder::Default. %config is optional but can
    contain:

    *   route =&gt; $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.

DISCLAIMER
    This module might embed javascript from 3rd party services.

    Any damage caused by either evil DNS takeover or malicious code inside
    the javascript is not taken into account by this module.

    If you are aware of any security risks, then please let us know.

COPYRIGHT AND LICENSE
    Copyright (C) 2014, Jan Henning Thorsen

    This program is free software, you can redistribute it and/or modify it
    under the terms of the Artistic License version 2.0.

AUTHOR
    Jan Henning Thorsen - "jhthorsen@cpan.org"

    Joel Berger, jberger@cpan.org

    Marcus Ramberg - "mramberg@cpan.org"

</pre></body></html>