Bug#860023: libdebian-source-perl: Rejects valid field names based on letter case
Jonas Smedegaard
jonas at jones.dk
Wed Apr 12 22:13:52 UTC 2017
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20170413/414dbba6/attachment.sig>
More information about the pkg-perl-maintainers
mailing list