Skip Menu |

This queue is for tickets about the Lingua-EN-Inflect CPAN distribution.

Report information
The Basics
Id: 62670
Status: open
Priority: 0/
Queue: Lingua-EN-Inflect

People
Owner: Nobody in particular
Requestors: xavier.cpan [...] soodonims.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.892
Fixed in: (no value)



Subject: WORDLIST omits content when scalar @list > 3
The following script: #!/usr/bin/perl use Lingua::EN::Inflect qw /WORDLIST/; my @list = ("a", "b", "c", "d", "e"); print WORDLIST(@list); will print: a, d, and e b and c are missing. Actually only items number 1, -2 and -1 are returned. All the other items are always omitted. This is because the return statement of sub WORDLIST is incorrect: return join($sep, @words[0,@words-2]) . "$final_sep$words[-1]"; should be: return join($sep, @words[0..@words-2]) . "$final_sep$words[-1]"; (Note the ".." instead of ",") I propose to add the following tests to wordlist.t, so that lists > 3 are tested: # Four words... @words = qw(apple banana carrot tomato); is WORDLIST(@words), "apple, banana, carrot, and tomato" => 'plain 4 words'; is WORDLIST(@words, {final_sep=>''}), "apple, banana, carrot and tomato" => '4 words, no final sep'; is WORDLIST(@words, {final_sep=>'...'}), "apple, banana, carrot... and tomato" => '4 words, different final sep'; is WORDLIST(@words, {final_sep=>'...', conj=>''}), "apple, banana, carrot... tomato" => '4 words, different final sep, no conjunction'; is WORDLIST(@words, {conj=>'or'}), "apple, banana, carrot, or tomato" => '4 words, different conjunction'; I tested it and it works fine.
Subject: Re: [rt.cpan.org #62670] WORDLIST omits content when scalar @list > 3
Date: Thu, 4 Nov 2010 05:59:57 +1100
To: bug-Lingua-EN-Inflect [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Many thanks for the important bug report. Patch applied! Damian