« Commands Execution History | Main | Alternative usage of Twitter »

Template::Plugin::Shorten version 0.01 released

The initial version of Template::Plugin::Shorten is now on CPAN. It works as a Template::Toolkit plugin, which filters URLs to shorten or lengthen using URL shortening sites like TinyURL.com.

I made it so that I could neatly write a template for a Plagger plugin, P::P::Publish::Twitter, which now supports templatization using TT. I'm afraid that it may cause some problems in other contexts.

Here's a usage of this module:

# Load this plugin
[% USE Shorten %]

# Shortening URLs
[% FILTER shorten_url %]
  <a href="http://search.cpan.org/">search.cpan.org</a>
[% END %]

# or

[% text | shorten_url %]

# Lengthening URLs
[% FILTER lengthen_url %]
  <a href="http://tinyurl.com/37rwu">search.cpan.org</a>
[% END %]

# or

[% text | lengthen_url %]

About

This page contains a single entry from the blog posted on April 25, 2007 4:16 PM.

The previous post in this blog was Commands Execution History.

The next post in this blog is Alternative usage of Twitter.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34