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 %]