Skip Menu |
 

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

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

People
Owner: Nobody in particular
Requestors: lachnlone [...] iinet.net.au
Cc:
AdminCc:

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



Subject: newlines in string data creates incorrect javascript
Download (untitled) / with headers
text/plain 596b
Data-JavaScript-Anon-0.4 Linux 2.4.18-27.8.0 (Red Hat Linux release 8.0 (Psyche)) This is perl, v5.8.0 built for i386-linux-thread-multi Its a great module... thanks! Here is my problem: the problem: demo script: use Data::JavaScript::Anon; my $data = "foo\nbar"; print Data::JavaScript::Anon->anon_dump( $data ); outputs: "foo bar" wrapped in html and loaded in a browser (firefox, ie6(win)): <html><head><script> var data = "foo bar"; </script></head></html> Error: "Unterminated string literal" The fix: in anon_scalar change the escaper regex to $value =~ s/(\\|\"|\r|\n)/\\$1/g;
From: lachnlone [...] iinet.net.au
Download (untitled) / with headers
text/plain 757b
On second thoughts, that fix might not do the trick...Sorry :P [guest - Wed Apr 13 22:33:15 2005]: Show quoted text
> Data-JavaScript-Anon-0.4 > Linux 2.4.18-27.8.0 (Red Hat Linux release 8.0 (Psyche)) > This is perl, v5.8.0 built for i386-linux-thread-multi > > Its a great module... thanks! > Here is my problem: > > the problem: > demo script: > > use Data::JavaScript::Anon; > my $data = "foo\nbar"; > print Data::JavaScript::Anon->anon_dump( $data ); > > outputs: > "foo > bar" > > wrapped in html and loaded in a browser (firefox, ie6(win)): > <html><head><script> > var data = "foo > bar"; > </script></head></html> > > Error: "Unterminated string literal" > > The fix: > in anon_scalar change the escaper regex to > $value =~ s/(\\|\"|\r|\n)/\\$1/g;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.