Subject: | Beautifier.pm, Packer1.pm |
Date: | Wed, 18 Apr 2018 22:25:57 +0200 |
To: | bug-JavaScript-Beautifier [...] rt.cpan.org |
From: | "eleonora45 [...] gmx.net" <eleonora45 [...] gmx.net> |
Hello,
There is a java script packer:
http://dean.edwards.name/packer/
That is used to obfuscate tables in web pages.
There was a javascript and python de-obfuscator, now I ported it to perl.
http://jsbeautifier.org/
The perl module is Packer1.pm, I added to this mail.
It has to be bound by two lines of code to Beautifier.pm:
use JavaScript::Packer1 qw/js_packer/;
and
$js_source_code = js_packer($js_source_code);
Packer1.pm must be located also in directory JavaScript.
The last test in 01-javascript-beauty.t handles the packer code.
I believe, the modification I suggested earlier, is no good.
( #$js_source_code =~ s/\\/\\\\/g; # prevent \\ -> \ tktk)
I commented it out.
Please read this:
https://stackoverflow.com/questions/16168763/preserving-backslashes-in-perl-strings
I now modified the usage description:
----------------------------------------------------------------------
=head1 FUNCTIONS
$js_source_code = <<EOF
a = 12;
{return '\\w+';}
EOF
=head2 js_beautify( $js_source_code, $opts );
beautify javascript.
-----------------------------------------------------------------------
With this I suggest the user to use the EOF mechanism to create the string.
Using the EOF mechanism or reading the javascript data from a file,
there is no need to
add backslashes to the string.
I found this out, because the packer part failed to work,
if we use additional backslashes.
Thank you in advance for adding packer to the perl javascript beautifier.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.