Skip Menu |

This queue is for tickets about the List-Categorize CPAN distribution.

Report information
The Basics
Id: 49910
Status: resolved
Priority: 0/
Queue: List-Categorize

People
Owner: bill [...] billodom.com
Requestors: lodin [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.01
Fixed in: (no value)



Hello Bill, I just found your module List::Categorize and it seems convenient. I noted however the line my $category = &$coderef; in the source. It is perhaps not technically a bug, but it could be quite confusing if one tries to use @_ in the block. A contrived example: categorize { pop; $_ } 1 .. 4 # (1 => [ 1 ], 2 => [ 2 ]) (See "What's the difference between calling a function as &foo and foo()?" in perlfaq7 for more.) This is easily fixed by just changing "&$coderef" to "&$coderef()" or "$coderef->()", or a comment in the documentation if this indeed is the intended behaviour. Regards, Johan Lodin
On Tue Sep 22 10:29:22 2009, LODIN wrote: Show quoted text
> > I just found your module List::Categorize and it seems convenient. I > noted however the line > > my $category = &$coderef; > > in the source. It is perhaps not technically a bug, but it could be > quite confusing if one tries to use @_ in the block. A contrived example: > > categorize { pop; $_ } 1 .. 4 # (1 => [ 1 ], 2 => [ 2 ]) > > (See "What's the difference between calling a function as &foo and > foo()?" in perlfaq7 for more.) > > This is easily fixed by just changing "&$coderef" to "&$coderef()" or > "$coderef->()", or a comment in the documentation if this indeed is the > intended behaviour. >
Argh. Good catch. That crept in when I was experimenting with passing arguments to the categorizer, and I didn't change it back. I'll take care of it in the next update (which should be pretty soon). Thanks, Bill
Okay, version 0.03 has been uploaded to the CPAN, with the fix in place!