First steps with App::Mist

My last posting seems to have whet the appetite of a few people, or at least interested one or two enough to follow this project on GitHub. Today I'd like to delve deeper into how you can use App::Mist to deploy or distribute an application.

I will use App::Mist itself as example for this mini-tutorial on how to use it. App::Mist is self-hosting and has few dependencies on its own, but you have to make sure that Dist::Zilla and App::cpanminus are present on your build system, otherwise everything will fail miserably.

In an ideal world, every package you depend on lives on CPAN, correctly lists its dependencies and passes its many tests with flying colors. The real world definitively is no such place, especially when viewed from the trenches, but for this post and for the installation of App::Mist we can make this assumption. How to deal with the inevitable hiccups in the dependency chain will be a topic for another two (or ten) blog posts down the road.

Installing mist from

The App::Mist repository itself contains a mist environment and is self-hosting. The script to run mist as a mist package is included. For the rest of this post it is assumed that this script is available as mist in your path (e.g. ~/bin/mist) and you have adjusted the CHECKOUT variable according to your local conditions.

First clone App::Mist, e.g. via

  git clone git://
Rendered by emacs, blooper.el and htmlize.el

You will notice the unusual entries mpan-dist and mpan-install. The directory mpan-dist contains a stable copy of all distributions needed to run the application, and the script mpan-install is a fat-packed script directly derived from your (or mine in this case) cpanm that can install those distributions without any external dependencies. Go ahead, try it:

  cd mist
Rendered by emacs, blooper.el and htmlize.el

Run that command as normal user, because App::Mist will refuse to run with root privileges to protect you from accidentally modifying your system-wide perl installation.

This will install all dependencies from mpan-dist into the local lib (named perl5 by default as that seems to be the emerging naming convention) for this project. If you created a mist script as mentioned above, your copy of App::Mist is now ready to run. Hopefully at least, this is still alpha quality software.

You can check if everything is configured correctly with running

Rendered by emacs, blooper.el and htmlize.el

without any parameters and be wow'ed by my skills at writing useful help messages!

Using mist to rebuild the distribution package

I promised that App::Mist is self hosting, so now its time to show you how to use your freshly installed mist to create its own distribution package.

First of all, delete mpan-dist and mpan-install, they are not needed at run-time. Leave perl5 untouched for now, or your mist script won't run anymore because of missing libraries:

  rm -Rf mpan-dist
  rm mpan-install
Rendered by emacs, blooper.el and htmlize.el

To recreate the distribution run the following commands:

  mist init    # scan dist.ini and pick up all deps from
  mist index   # reindex the local mpan directory
  mist compile # build the ./mpan-install script
Rendered by emacs, blooper.el and htmlize.el

If everything works as expected, you should have created your first full-fledged mist environment! And if you ignore my long-winded ramblings, it was surprisingly fast and straight-forward, wasn't it ;)

To verify the distribution you can now throw away your local lib and created it anew:

  rm -Rf perl5
  # 'mist' is unlikely to work between those two steps
Rendered by emacs, blooper.el and htmlize.el

Good luck, and please submit a bug report in the github issue tracker if anything went amiss.


Hi there-

I'm researching a project to provide "A Private CPAN in a box". So I recently started this thread on the perl-qa list:

Then a colleague suggested I look at App::Mist. It appears there is a lot of overlap in our goals.

At the moment, I'm working through your tutorial on App::Mist. Meanwhile, I'd love to hear your thoughts on how App::Mist could fit into the problem we are discussing over on the perl-qa list.



One suggestion: In your shebang lines, let the user decide which perl to use. Like this:

#!/usr/bin/env perl

Leave a comment

About Sebastian Willert

user-pic Programming Perl 5 in Emacs for over a decade, blogging since a few minutes. Expect tidbits about both technologies here (if at all, I'm not too sure I can develop a blogging habit).