Skip to content

Instantly share code, notes, and snippets.

@dex4er
Last active February 12, 2019 11:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dex4er/22d5195a64e3058bc8a0 to your computer and use it in GitHub Desktop.
Save dex4er/22d5195a64e3058bc8a0 to your computer and use it in GitHub Desktop.
Mojolicious + PAR::Packer without --addfile
#!/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;
#!/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