From 321b0f73a7a6d0b08b66e17a72899faac17f540d Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Thu, 27 Sep 2007 16:22:35 +0000 Subject: [PATCH] Enables variable names with multiple :: separators --- general/interpolate_conditional | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/general/interpolate_conditional b/general/interpolate_conditional index 255bb18..264695b 100644 --- a/general/interpolate_conditional +++ b/general/interpolate_conditional @@ -22,25 +22,25 @@ sub interpolate { my $template = shift; # defined - $template =~ s#\?\{(\$\w+(?:::)?\w*) (.*?)\}#"defined $1 ? \$2 : ''"#gee; + $template =~ s#\?\{(\$\w+(?:::\w+)*) (.*?)\}#"defined $1 ? \$2 : ''"#gee; # not defined - $template =~ s#\?\{!(\$\w+(?:::)?\w*) (.*?)\}#"!defined $1 ? \$2 : ''"#gee; + $template =~ s#\?\{!(\$\w+(?:::\w+)*) (.*?)\}#"!defined $1 ? \$2 : ''"#gee; # not equal to - $template =~ s#\?\{(\$\w+(?:::)?\w*)!=(.*?) (.*?)\}#"defined $1 and $1 ne '$2' ? \$3 : ''"#gee; + $template =~ s#\?\{(\$\w+(?:::\w+)*)!=(.*?) (.*?)\}#"defined $1 and $1 ne '$2' ? \$3 : ''"#gee; # equal to - $template =~ s#\?\{(\$\w+(?:::)?\w*)=(.*?) (.*?)\}#"defined $1 and $1 eq '$2' ? \$3 : ''"#gee; + $template =~ s#\?\{(\$\w+(?:::\w+)*)=(.*?) (.*?)\}#"defined $1 and $1 eq '$2' ? \$3 : ''"#gee; # greater than - $template =~ s#\?\{(\$\w+(?:::)?\w*)>(.*?) (.*?)\}#"defined $1 and $1 gt '$2' ? \$3 : ''"#gee; + $template =~ s#\?\{(\$\w+(?:::\w+)*)>(.*?) (.*?)\}#"defined $1 and $1 gt '$2' ? \$3 : ''"#gee; # less than - $template =~ s#\?\{(\$\w+(?:::)?\w*)<(.*?) (.*?)\}#"defined $1 and $1 lt '$2' ? \$3 : ''"#gee; + $template =~ s#\?\{(\$\w+(?:::\w+)*)<(.*?) (.*?)\}#"defined $1 and $1 lt '$2' ? \$3 : ''"#gee; # unconditional (and recursive) - while( $template =~ s/(\$[a-zA-Z]\w+(?:::)?\w*)/"defined $1 ? $1 : ''"/gee ) { } + while( $template =~ s/(\$[a-zA-Z]\w+(?:::\w+)*)/"defined $1 ? $1 : ''"/gee ) { } return $template; -- 2.30.2