On Tue, 12 Jun 2012, P. J. McDermott wrote:
> And the subroutines in Dpkg::Control::Fields that get values from
> %FIELDS can call the following new subroutine to do so:
> 
>     sub field_get($) {
>         my ($field) = @_;
>         foreach my $key (keys %FIELDS) {
>             return $FIELDS{$key} if $field =~ m/^$key$/;
>         }
>         return undef;
>     }
> 
> This should be fairly unintrusive.  I'll test this further and check to
> see if I've overlooked any complications before adding this to Wookey's
> patch.  Does this solution look obviously wrong in any way?

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)

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Get the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to