WebService::EmbedlyPerl interface to the Embedly API | |
Download |
WebService::Embedly Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Jason Wieland
- Publisher web site:
- http://search.cpan.org/~jwieland/
WebService::Embedly Tags
WebService::Embedly Description
WebService::Embedly is a Perl module implementing for querying the Embed.ly web service. Prior to using this module you should go to http://embed.ly and sign up for an api_key.You can quickly try out the API by executing: ./sample/usage.pl --apikey you_api_key_from_embed.lyWebService::Embedly exposes three methods: oembed, preview, objectify. Each method has additional bits of metadata about the request URL. oembed method follows the oembed standard documented here http://oembed.com/Refer to http://embed.ly to learn more about the data that is returned for preview http://embed.ly/docs/endpoints/1/preview and objectify http://embed.ly/docs/endpoints/2/objectifyException handling is used to expose failures. The Ouch module (:traditional) is used to handle try/catch blocks. See the Exception block below for all the possible catches. Example: my $e = try { $oembed_ref = $embedly->oembed('http://youtu.be/I8CSt7a7gWY'); }; if ( catch 500, $e) { #Server is down return; } if ( catch 401, $e) { #Your API key has used all its credits return; } elsif ( catch_all, $e) { #I hate the individual exception catching, lets get this over with it. return; }WebService::Embedly uses Mouse (lighter version of Moose) to handle its object management.SYNOPSIS use WebService::Embedly; use Ouch qw(:traditional); my $embedly = WebService::Embedly->new({ api_key => 'get_your_key_at_embed.ly'}); my $oembed_ref; my $e = try { $oembed_ref = $embedly->oembed('http://youtu.be/I8CSt7a7gWY'); }; if ( catch_all, $e) { warn("embedly api failed: ".$e); return; } #made it here, everything good. my $embed_html = $oembed_ref->{html}Product's homepage
WebService::Embedly Related Software