If you are in the habit of setting Mojolicious environment variables in your shell, you should remember to unset them (at least MOJO_LOG_LEVEL) before upgrading your Mojolicious framework, otherwise it can fail its tests and fail to install.

unset MOJO_LOG_LEVEL
HARNESS_OPTIONS=j9 cpanm -l /srv/mojo Mojolicious Mojoliciuos::Plugin::Authentication
Advertisements

There are a handful of variables that can be handy when working with Mojolicious, so I decided to collect them together.

Installing CPAN modules

HARNESS_OPTIONS=j9 cpanm -l /srv/mojo Mojolicious

… specifies the degree of concurrency for the perl tests when building.

User agent

MOJO_USERAGENT_DEBUG=1 ./my_useragent.pl

… turns on debugging so it outputs request-response messages.

Daemon

MOJO_NO_IPV6=1 morbo -v -l 'http://*:8088' -w mod -w tmpl myapp

… turns off ipv6 support.

MOJO_NO_TLS=1 /srv/mojo/bin/hypnotoad myapp

… turns off TLS support.

MOJO_MODE=production …

… sets the run mode.

MOJO_LOG_LEVEL=debug …

… sets the debug level.

Commands

MOJO_NO_DETECT=1

… disables deployment environment detection.

You want to find all CPAN modules starting ‘Mojolicious::Plugin::‘ but search.cpan.org just shows the first 10 of 4,462.  No problem, it’s actually easier to work from the commandline.  The following lists the 130 results.

perl -MCPAN -e'print map +($_->{ID} .qq{\n}),
  CPAN::Shell->expand(q{Module},
    q{/^Mojolicious::Plugin::/})'

Whenever possible I try to stick to using the official debian-packaged distribution of a CPAN perl module, but occasionally that’s not possible, either because I need a fresher version or because nobody has packaged it for the official repos. There are three work-arounds I’m aware of…

I’ll put my favourite first: using debian.pkgs.cpan.org. Yes, by tweaking your /etc/apt/sources.list you have access to most of the CPAN modules you could want.

Second best (since it looks at dependencies too): using cpan2dist. However, the failures of trying to build CPANPLUS::Dist::Deb lead me to the first approach.

Third best (but a good start if you’re working on building a single properly-constructed debian package): using dh-make-perl.