On 2012-06-13 02:01, Raphael Hertzog wrote:
> It's sub-optimal. If we go that way, I would like:
>
> 1/ that you try direct access first, and fallback to use pattern matching
> only if the direct access failed
> 2/ use pattern matching only on fields that actually are patterns (i.e.
> you should tag them with a supplementary attribute, or you should put them
> in a separate hash)
Fair enough. I think a separate hash could address both of these points:
sub field_get($) {
my ($field) = @_;
return $FIELDS{$field} if exists $FIELDS{$field};
foreach my $key (keys %FIELDS_RE) {
return $FIELDS_RE{$key} if $field =~ m/^$key$/;
}
return undef;
}
Would this be acceptable?
Do you have a preference between the supplementary attribute and the
separate hash?
Thanks,
--
P. J. McDermott (_/@\_) ,--.
http://www.pehjota.net/ o < o o > / oo \
http://www.pehjota.net/contact.html o \ `-/ | <> |.
o o o "~v /_\--/_/
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]