Subject: | Simple illistration of a easy mistake. (documentation) |
These can cause issues:
use Data::JavaScript {UNDEF => ''};
print jsdump('myvar',\%myvar,'');
var myvar = new Object;
myvar['6'] = new Object;
myvar['6'].myvalue = ;
BAD -^
A subtle but important difference:
use Data::JavaScript {UNDEF => '\'\''};
print jsdump('myvar',\%myvar,'\'\'');
var myvar = new Object;
myvar['6'] = new Object;
myvar['6'].myvalue = '';
OK -^
My approach to javascript is sometimes silly. I'm sure someone else will bonk their head on this one. I'm using the defaults now, as it's identical to undefined, and that's easy to check for.
Ciao! and thanks for a cool CPAN module.
Scott.