package LivroAberto::Template::Plugin::CutString;

use Template::Plugin::Filter;
use base qw( Template::Plugin::Filter );

my $SIZE = 80;

sub filter {
    my ($self, $text) = @_;
    if (length($text) > $SIZE) {
        my $tmp = $SIZE - 3;
        $text =~ s/^(.{$tmp}).*$/$1.../;
    }
    return $text;
}

1;
