Skip Menu |

This queue is for tickets about the Every CPAN distribution.

Report information
The Basics
Id: 38305
Status: open
Priority: 0/
Queue: Every

People
Owner: Nobody in particular
Requestors: IKEGAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Improved return value to combine results
I foresee the following pitfall being common Given every(3)||every(4) pass expected actual ---- -------- ------ 1 F||F=F F||F=F 2 F||F=F F||F=F 3 T||F=T T =T 4 F||T=T F||F=F 5 F||F=F F||T=T 6 T||F=T T =T 7 F||F=F F||F=F 8 F||T=T F||F=F To get the expected value, one must use (every(3)?1:0)|(every(4)?1:0) I recommend that "every" returns specifically 1 and 0 instead of unspecified true and false values. Then, the above would simplify to every(3)|every(4) (In both cases, "|" can be replaced with "+". Use whichever you prefer in your documentation.)
On Thu Aug 07 17:14:46 2008, ikegami wrote: Show quoted text
> I foresee the following pitfall being common > > Given every(3)||every(4) > > pass expected actual > ---- -------- ------ > 1 F||F=F F||F=F > 2 F||F=F F||F=F > 3 T||F=T T =T > 4 F||T=T F||F=F > 5 F||F=F F||T=T > 6 T||F=T T =T > 7 F||F=F F||F=F > 8 F||T=T F||F=F > > To get the expected value, one must use > (every(3)?1:0)|(every(4)?1:0) > > I recommend that "every" returns specifically 1 and 0 instead of > unspecified true and false values. Then, the above would simplify to > every(3)|every(4) > > (In both cases, "|" can be replaced with "+". Use whichever you prefer > in your documentation.)
Apologies for missing this ticket. This seems pretty easy, are you OK with the following change? Index: lib/Every.pm =================================================================== --- lib/Every.pm (revision 4368) +++ lib/Every.pm (working copy) @@ -6,7 +6,7 @@ use strict; use warnings; -our $VERSION = '0.06'; +our $VERSION = '0.07'; $VERSION = eval $VERSION; use Exporter; @@ -68,7 +68,7 @@ } my $key = join('_', caller(), $div, $site, @id); # Hash key - return !(++$counters{$key} % $div); + return !(++$counters{$key} % $div) ? 1 : 0; } 1;