Hello,
I've created a little patch in order to be able to test against
substrings of entries in $Data within dtl-templates. Now I can do things
like:
AND
Perhaps this could be useful for someone else, too.
Regards
MD
This was diffed against 2.0.3-01.
Index: Generic.pm
===================================================================
--- Generic.pm (Revision 4)
+++ Generic.pm (Arbeitskopie)
@@ -582,16 +582,25 @@
# do template if dynamic
# --
$Line =~ s{
-
+
}
{
my $Type = $1 || '';
my $TypeKey = $2 || '';
- my $Con = $3 || '';
- my $ConVal = defined $4 ? $4 : '';
- my $IsType = $5 || '';
- my $IsKey = $6 || '';
- my $IsValue = $7 || '';
+ my $KeyLength = $3 || '';
+ my $Con = $4 || '';
+ my $ConVal = defined $5 ? $5 : '';
+ my $IsType = $6 || '';
+ my $IsKey = $7 || '';
+ my $IsValue = $8 || '';
+
+ my $KeyStart = 0;
+ $KeyLength =~ s/[\[\]]//g;
+ if ($KeyLength =~ /(\d*),(\d*)/) {
+ $KeyLength = $2;
+ $KeyStart = $1;
+ }
+
# --
# do ne actions
# --
@@ -608,6 +617,7 @@
if (!defined($Tmp)) {
$Tmp = '';
}
+ if ($KeyLength ne '') { $Tmp = substr($Tmp,
$KeyStart, $KeyLength); }
if (eval '($Tmp '.$Con.' $ConVal)') {
$GlobalRef->{$IsType.'Ref'}->{$IsKey} = $IsValue;
# output replace with nothing!