Subject: | Template::Plugin::String lacks a substr method among others |
Template::Plugin::String lacks a substr method among others,
like index/rindex.
I see no reason why substr shouldn't be part of it.
Here goes
(btw, you should modify sub truncate to
use CORE::substr if you add this)
# 4 arg substr, works like perl5.005+ version of substr
# written like so due to the perl5.004 requirement
sub substr {
my ($self, $OFFSET, $LENGTH, $REPLACEMENT) = @_;
if(defined $REPLACEMENT) {
my $rep = CORE::substr( $self->{text}, $OFFSET, $LENGTH );
CORE::substr( $self->{text}, $OFFSET, $LENGTH ) = $REPLACEMENT;
return $rep;
} else {
CORE::substr( $self->{text}, $OFFSET, $LENGTH )
}
}