Skip Menu |

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

Report information
The Basics
Id: 15788
Status: resolved
Priority: 0/
Queue: Data-JavaScript

People
Owner: jpierce [...] cpan.org
Requestors: kevinj [...] activestate.com
Cc:
AdminCc:

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



Subject: 1.10 has a regression where javascript reserved words can no longer be used as keys in perl hashes.
For some reason, perl hashes are printed using as variable.key in Data-Javascript 1.10 rather than variable['key'], like they were in 1.08. This is a regression because now dumping a hash like { array => [], class => "monkey" } will give javascript errors.
--- /Users/kevinj/Data-JavaScript-1.10/JavaScript.pm 2005-11-13 00:50:00.000000000 -0800 +++ JavaScript.pm 2005-11-14 11:09:10.000000000 -0800 @@ -111,8 +111,7 @@ my ($k, $old_k, $v); foreach $k (keys %$elem) { $k = __quotemeta($old_k=$k); - my $newsym = (($k =~ /^[a-z_]\w+$/i) ? "$sym.$k" : - "$sym\['$k']"); + my $newsym = "$sym\['$k']"; push(@list, __jsdump($newsym, $elem->{$old_k}, $dict, $undef)); } return @list;
To: bug-Data-JavaScript [...] rt.cpan.org
Subject: Re: [cpan #15788] 1.10 has a regression where javascript reserved words can no longer be used as keys in perl hashes.
Date: Mon, 14 Nov 2005 14:39:07 -0500
From: Jerrad Pierce <belg4mit [...] MIT.EDU>
RT-Send-Cc:
Could you please be a little more clear in your description? Actual examples would help. -- H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8 Opr8bBBidccAAAA= -- MOTD on Pungenday, the 26th of The Aftermath, in the YOLD 3171: "I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living, its a way of looking at life through the wrong end of a telescope. Which is what I do, and that enables you to laugh at life's realities." -Dr. Seuss
I see now, it didn't help that a) you used "regression" in an odd way and b) that RT chopped off half of your subject when sending the email
What version are you using? I'm looking at 1.07 and 1.08 and getting the same output as 1.10 (with -Mblib and no D::JS installed). Show quoted text
PS> "regression" is not a meaningful noun outside of math for most people
I imagine it's some derivative of regression test, but that's not particularly clear.
It looks like the previous behavior was a "feature". if (UNIVERSAL::isa($elem, 'HASH')) { ... $k = __quotemeta($old_k=$k); my $newsym = (($k =~ /^[a-z_]\w+$/i) ? "$sym.$k" : Somehow the quotemeta rewrite has affected the operation of the trinary statement for "keywords", despite the fact that they were always [a-z_]\w+
To: bug-Data-JavaScript [...] rt.cpan.org
Subject: Re: [cpan #15788] 1.10 has a regression where javascript reserved words can no longer be used as keys in perl hashes.
Date: Mon, 14 Nov 2005 18:30:21 -0500
From: Jerrad Pierce <belg4mit [...] MIT.EDU>
RT-Send-Cc:
Or was the patch to simply emit ['key'] syntax for everything? If so then there's need to submit anything, if it's keyword sensitive than I'd appreciate whatever you have... e.g; list of keywords I could go with [''] for everything, except it adds bloat and is ugly OTOH it's consistent, and futureproof against new keywords. -- H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8 Opr8bBBidccAAAA= -- MOTD on Pungenday, the 26th of The Aftermath, in the YOLD 3171: "I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living, its a way of looking at life through the wrong end of a telescope. Which is what I do, and that enables you to laugh at life's realities." -Dr. Seuss