File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# !/usr/bin/perl -w
2+ use LWP::UserAgent;
3+ use URI::Escape;
24
35# Please enter in the domain, without the protocol [http(s)] and without the trailing slash below
46my $hostedDomain = " sharenice.org" ;
4648
4749close (JSTEMPLATE);
4850
49- open (OUTPUT, " > ../code.js" ) || die " sorry cant write to output file : ../code.js\n " ;
51+ # Get shortended output
52+ my $google = ' http://closure-compiler.appspot.com/compile' ;
53+ my $ua = LWP::UserAgent-> new;
5054
51- print OUTPUT $output ;
55+ my $lame = uri_escape($output );
56+
57+ my $googleres = $ua -> post($google ,
58+ [ ' js_code' => $output ,
59+ ' compilation_level' => ' WHITESPACE_ONLY' ,
60+ ' output_format' => ' text' ,
61+ ' output_info' => ' compiled_code' ]
62+ ) ;
63+ die " $google error: " , $googleres -> status_line
64+ unless $googleres -> is_success;
5265
66+ $output = $googleres -> content;
67+
68+ open (OUTPUT, " > ../code.js" ) || die " sorry cant write to output file : ../code.js\n " ;
69+ print OUTPUT $output ;
5370close (OUTPUT);
5471
5572print STDERR " Finished generating new code.js file\n " ;
You can’t perform that action at this time.
0 commit comments