JavaScript-Squish ================= This module provides methods to compact javascript source down to just what is needed. It can remove all comments, put everything on one line (semi-)safely, and remove extra whitespace. Any one of the various compacting techniques can be applied individually, or with in any group. It also provides a means by which to extract all text literals or comments in separate arrays in the order they appear. Since JavaScript eats up bandwidth, this can be very helpful, and you can then be free to properly comment your JavaScript without fear of burning up too much bandwidth. SYNOPSIS use JavaScript::Squish; my $compacted = JavaScript::Squish->squish( $javascript, remove_comments_exceptions => qr/copyright/i ) or die $JavaScript::Squish::err_msg; # OR, to just do a few steps # my $c = JavaScript::Squish->new(); $c->data( $javascript ); $c->remove_comments(exceptions => qr/copyright/i ); $c->replace_white_space(); $c->remove_blank_lines(); my $new = $c->data(); INSTALLATION To install this module type the following: perl Makefile.PL make make test make install BUGS There are a few bugs, which may rear their head in some minor situations. Statements not terminated by semi-colon. Javascript statement that are NOT terminated by a semi-colon (";") may break once compacted, as they will be put on the same line as the following statement. In many cases, this wonâbe a problem, but it could cause an issue. Ex. i = 5.4 j = 42 The above would become "i=5.4 j=42", and would generate an error along the lines of "expected â before statement". Ambiguous operator precidence Operator precidence may get screwed up in ambiguous statements. Eg. "x = y + ++b;" will be compacted into "x=y+++b;", which means something different. SEE ALSO Latest releases, bugzilla, cvs repository, etc: https://developer.berlios.de/projects/jscompactor/ AUTHOR Joshua I. Miller COPYRIGHT AND LICENSE Copyright (c) 2005 by CallTech Communications, Inc. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.