[Bio] / Sprout / CustomAttributes.pm Repository:
ViewVC logotype

Diff of /Sprout/CustomAttributes.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13, Fri Dec 15 08:16:17 2006 UTC revision 1.14, Wed Dec 20 20:04:23 2006 UTC
# Line 1077  Line 1077 
1077  or an empty string is specified, all values in that section will match. A  or an empty string is specified, all values in that section will match. A
1078  generic match can be requested by placing a percent sign (C<%>) at the end.  generic match can be requested by placing a percent sign (C<%>) at the end.
1079  In that case, all values that match up to and not including the percent sign  In that case, all values that match up to and not including the percent sign
1080  will match.  will match. You may also specify a regular expression enclosed
1081    in slashes. All values that match the regular expression will be returned. For
1082    performance reasons, only values have this extra capability.
1083    
1084  =item RETURN  =item RETURN
1085    
# Line 1167  Line 1169 
1169          my $matching = 1;          my $matching = 1;
1170          for (my $i = 0; $i < $sectionCount && $matching; $i++) {          for (my $i = 0; $i < $sectionCount && $matching; $i++) {
1171              # We need to check to see if this section is generic.              # We need to check to see if this section is generic.
1172              if (substr($values[$i], -1, 1) eq '%') {              my $value = $values[$i];
1173                Trace("Current value pattern is \"$value\".") if T(4);
1174                if (substr($value, -1, 1) eq '%') {
1175                    Trace("Generic match used.") if T(4);
1176                    # Here we have a generic match.
1177                  my $matchLen = length($values[$i] - 1);                  my $matchLen = length($values[$i] - 1);
1178                  $matching = substr($sections[$i], 0, $matchLen) eq                  $matching = substr($sections[$i], 0, $matchLen) eq
1179                              substr($values[$i], 0, $matchLen);                              substr($values[$i], 0, $matchLen);
1180                } elsif ($value =~ m#^/(.+)/[a-z]*$#) {
1181                    Trace("Regular expression detected.") if T(4);
1182                    # Here we have a regular expression match.
1183                    my $section = $sections[$i];
1184                    $matching = eval("\$section =~ $value");
1185              } else {              } else {
1186                    # Here we have a strict match.
1187                    Trace("Strict match used.") if T(4);
1188                  $matching = ($sections[$i] eq $values[$i]);                  $matching = ($sections[$i] eq $values[$i]);
1189              }              }
1190          }          }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3