Portable web application

yuki-kimoto edited this page Feb 26, 2012 · 2 revisions

Portable web application

The way to create portable web application

You can create very portable web application using some perl modules.

PortableBBS(https://github.com/yuki-kimoto/Portablebbs) is web application example to learn how to create portable web application.

Mojolicious hypnotoad or daemon web server enable you to start web application easily.

Test::ModuleVersion and cpanm enable you to install specified version module.

mvt.pl and how to use Test::ModuleVersion

At first, see mvt.pl.

use strict;
use warnings;
use Test::ModuleVersion;
use FindBin;

# Create module test
my $tm = Test::ModuleVersion->new;
$tm->before(<<'EOS');
use 5.010001;

=pod

run mvt.pl to create this module version test(t/module.t).

  perl mvt.pl

=cut

EOS
$tm->lib(['../extlib/lib/perl5']);
$tm->modules([
  [DBI => '1.617'],
  ['DBD::SQLite' => '1.35'],
  ['Object::Simple' => '3.0625'],
  ['Validator::Custom' => '0.1426'],
  ['DBIx::Custom' => '0.2111'],
  [Mojolicious => '2.51'],
  ['DBIx::Connector' => '0.47']
]);
$tm->test_script(output => "$FindBin::Bin/t/module.t");

Test::ModuleVersion create module version test(t/module.t). You can specify module version by modules attribute.

test_script method output version test to t/module.t

lib attribute is module installed directory.

before attribute enable you to add some code before version test.

Run version test and list test failed modules

you can test moudle version.

perl t/module.t

You can list test failed modules by list command and --fail option.

perl t/module.t list --fail

You can install listed modules by cpanm. (It is good that Module::CoreList is latest version)

perl cpanm -l extlib Module::CoreList
perl t/module.t list --fail | perl -Iextlib/lib/perl5 cpanm -L extlib

Application management(Linux/Unix)

You can start web application hypnotoad command.

./hypnotoad

and stop

./hypnotoad --stop

Application management(Windows)

You can start web application winstart.pl script.

perl winstart.pl

You can stop web application winstart.pl script.

perl winstop.pl