Quoting gregor herrmann (2017-04-12 23:30:08)
> Control: tag -1 + confirmed
> 
> On Mon, 10 Apr 2017 22:37:28 +1000, Ben Finney wrote:
> 
> > Given a Perl module::
> > 
> >     use Debian::Control::Stanza::Source;
> > 
> >     my $s = Debian::Control::Stanza::Source->new( {
> >         'Build-Depends' => "debhelper",
> >         'VCS-Git' => "https://example.org/";,
> >     } );
> > 
> > The above code causes the error message::
> > 
> >     Invalid field given (VCS_Git) at ./foo.pl line 6.
> > 
> > The spelling “VCS-Git” is not invalid. Debian Policy §5.1 specifies
> > that “Field names are not case-sensitive […]”.
> 
> Thank you, that's indeed an issue.
>  
> > The library should allow field names without regard to their
> > capitalisation. For example, the names “vcs-git”, “Vcs-Git”,
> > “VCS-Git”, “vcS-gIt” should all be interpreted as the same field name
> > by ‘libdebian-source-perl’.
> 
> Right. Unfortunately that's not so easy, as these field names are not
> just strings but they are also automatically generated accessors; the
> error message above is in fact the user-friendly version of the
> underlying problem:
> 
> 
> % perl -MDebian::Control::Stanza::Source -E '$s = 
> Debian::Control::Stanza::Source->new(); say $s->Vcs_Git; say $s->VCS_Git;'
> 
> Can't locate object method "VCS_Git" via package 
> "Debian::Control::Stanza::Source" at -e line 1.
> 
> 
> Maybe someone has an idea how we can simulate something like
> case-insensitive method names?

A dirty but (I guess) effective approach would be to compute all 
upper- and lowercase combinations, and create aliases for the accessors.

For Moo there is MooX::Aliases to help with the latter part - but seems 
Debian::Source does not use Moo.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

Attachment: signature.asc
Description: signature

Reply via email to