Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 2619
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.09
Fixed in: (no value)



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 ) } }