/text-mapper

A web app to generate maps based on text files

Primary LanguagePerlOtherNOASSERTION

Text Mapper

This application takes a textual representation of a map and produces SVG output.

Example input:

0101 empty
0102 mountain
0103 hill "bone hills"
0104 forest

Try it.

The app comes with a tutorial built in. See the Help link.

Dependencies

Perl Modules (or Debian modules):

  • IO::Socket::SSL or libio-socket-ssl-perl
  • LWP::UserAgent or liblwp-useragent-perl
  • List::MoreUtils or liblist-moreutils-perl
  • Modern::Perl or libmodern-perl-perl
  • Mojolicious or libmojolicious-perl
  • Role::Tiny::With or librole-tiny-perl

The IO::Socket::SSL dependency means that you’ll need OpenSSL development libraries installed as well: openssl-devel or equivalent, depending on your package manager.

To install from the working directory (which will also install all the dependencies) use cpan or cpanm.

Example:

cpanm .

Installation

Use cpan or cpanm to install Game::TextMapper.

Using cpan:

cpan Game::TextMapper

Manual install:

perl Makefile.PL
make
make install

Configuration

In the directory you want to run it from, you may create a config file named text-mapper.conf like the following:

{
  # choose error, warn, info, or debug
  loglevel => 'debug',
  # use stderr, alternatively use a filename
  logfile => undef,
  # the URL where the contributions for include statements are
  # e.g. 'https://campaignwiki.org/contrib' (only HTTP and HTTPS
  # schema allowed), or a local directory
  contrib => '/home/alex/src/text-mapper/share',
}

Development

As a developer, morbo makes sure to restart the web app whenever a file changes:

morbo --mode development --listen "http://*:3010" script/text-mapper

Alternatively:

script/text-mapper daemon --mode development --listen "http://*:3010"

Docker

If you want to experiment with a clean Perl environment in order to check whether the dependencies are OK, make sure you have Docker installed, are part of the docker group, and get the latest-perl image:

sudo apt install docker.io
sudo adduser $(whoami) docker
# if groups doesn’t show docker, you need to log in again
su - $(whoami)
# this binds the working directory to /app inside the image
docker run -it --rm -v $(pwd):/app perl:latest /bin/bash
# now we’re root inside the image
cd /app
cpanm File::ShareDir::Install
cpanm .