NAME

Lavoco::Web::Editor - Experimental framework with two constraints: FastCGI and Template::Toolkit to edit flat files.

VERSION

Version 0.01

SYNOPSIS

Framework to run small web app to edit flat files, running as a FastCGI application.

use Lavoco::Web::Editor;

my $editor = Lavoco::Web::Editor->new( name => 'Example editor' );

my $action = lc( $ARGV[0] );   # (start|stop|restart)

$editor->$action;

METHODS

Class Methods

new

Creates a new instance of the web-app editor object.

Attributes

name

The identifier for the web-app, used as the FastCGI-process title.

base

The base directory of the application, detected using FindBin.

processes

Number of FastCGI process to spawn, 5 by default.

templates

The directory containing the TT templates, by default it's $app->base . '/editor-templates'.

filename

Filename for the config file, default is app.json and only JSON is currently supported.

config

The config as a hash-reference.

Instance Methods

start

Starts the FastCGI daemon. Performs basic checks of your environment and dies if there's a problem.

stop

Stops the FastCGI daemon.

restart

Restarts the FastCGI daemon, with a 1 second delay between stopping and starting.

CONFIGURATION

The editor app should be a simple Perl script in a folder with the following structure:

editor.pl      # see the synopsis
editor.json    # see below
editor.pid     # generated, to control the process
editor.sock    # generated, to accept incoming FastCGI connections
logs/
editor-templates/
    404.tt

The config file is read for each and every request, this makes adding new pages easy, without the need to restart the application - you could even edit it's own files.

The config file should be placed in the base directory of your editor application.

See the examples directory for a sample JSON config file, something like the following...

{
  
   ...
}

The entire config hash is available in all templates via [% app.config %], there are only a couple of mandatory/reserved attributes.

TODO

AUTHOR

Rob Brown, <rob at intelcompute.com>

LICENSE AND COPYRIGHT

Copyright 2014 Rob Brown.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.