Last active
February 12, 2019 11:53
-
-
Save dex4er/22d5195a64e3058bc8a0 to your computer and use it in GitHub Desktop.
Mojolicious + PAR::Packer without --addfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.10; | |
use strict; | |
use warnings; | |
use Mojolicious::Lite; | |
# Explicit use as a helper for PAR | |
use Mojolicious::Plugin::DefaultHelpers; | |
use Mojolicious::Plugin::EPLRenderer; | |
use Mojolicious::Plugin::EPRenderer; | |
use Mojolicious::Plugin::HeaderCondition; | |
use Mojolicious::Plugin::TagHelpers; | |
my $daemon = Mojo::Server::Daemon->new(app => app, listen => ['http://*:3000']); | |
$daemon->start; | |
Mojo::IOLoop->start unless Mojo::IOLoop->is_running; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cat mojo-app.pl > mojo-app.plc | |
echo __DATA__ >> mojo-app.plc | |
libdir=`perl -MMojolicious -e '$d=$INC{"Mojolicious.pm"};$d=~s{/Mojolicious.pm$}{};print$d'` | |
find $libdir/Mojolicious/templates $libdir/Mojolicious/public -type f | while read f; do | |
label=${f#$libdir/Mojolicious/} | |
label=${label#*/} | |
case "$f" in | |
*/development.html.ep) | |
echo "@@ not_found.development.html.ep" | |
sed 's/inline => app->renderer->_bundled//' $f | |
;; | |
*.ep) | |
echo "@@ $label" | |
sed 's/inline => app->renderer->_bundled//' $f | |
;; | |
*.ico|*.png) | |
echo "@@ $label (base64)" | |
base64 $f | |
;; | |
*) | |
echo "@@ $label" | |
cat $f | |
esac | |
done >> mojo-app.plc | |
pp -o mojo-app mojo-app.plc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment