Skip to content

Instantly share code, notes, and snippets.

@aklaswad
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aklaswad/3658ccce8f7a3f8bd1aa to your computer and use it in GitHub Desktop.
Save aklaswad/3658ccce8f7a3f8bd1aa to your computer and use it in GitHub Desktop.
Perl-JS compatible webserver
#!/usr/bin/env perl
1 // <<HACK;
/*
HACK
use strict;
use warnings;
use Plack::Runner;
my $js = do { local $/; <DATA> };
my $html = <<'HTML';
<html>
<script>/*__JS__</script>
<body id="body"></body>
</html>
HTML
$html =~ s/__JS__/$js/;
my $runner = Plack::Runner->new;
$runner->parse_options(@ARGV);
$runner->run( sub { return [ 200, [], [$html] ]; } );
__DATA__
*/
console.log('hello javascript');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment