Skip Menu |

This queue is for tickets about the Data-JavaScript-Anon CPAN distribution.

Report information
The Basics
Id: 20863
Status: new
Priority: 0/
Queue: Data-JavaScript-Anon

People
Owner: Nobody in particular
Requestors: $_
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.9
Fixed in: (no value)



anon_hash_key returns undef if the key is a null string ('') or '0'. This behaviour makes anon_dump({'' => 1, '0' => 2, '00' => 3}) return { : 1, : 2, 00: 3 } which, of course, is a syntax error. The problem is on line 180 (according to cat -n) of Data/JavaScript/Anon.pm: my $value = _STRING($_[0]) ? shift : return undef; '' and '0' are perfectly valid hash keys both in Perl and JavaScript. If I'm not mistaken, Perl hash keys are forced to be strings anyway, so is there any reason to validate $_[0] to make sure it is a string? Could you not simply change that line to: my $value = shift; ?