NAME
Lavoco::Web::Editor - Experimental framework with two constraints: FastCGI and Template::Toolkit to edit flat files.
VERSION
Version 0.02
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.
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 # config, see below
editor.pid # generated, to control the process
editor.sock # generated, to accept incoming FastCGI connections
logs/
The config file is read for each and every request, this makes adding new pages easy, without the need to restart the application - you can edit its own config file.
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 %].
Two fields which drive the editor are folders and files, each of which is an array of paths, all relative to $editor->base.
When a folder is found, all files within it are editable, but not the sub directories. You are also able to create new files in this folder.
If the field for password exists in the config, then this will be requested before a user can access the index page (listing all files that can be edited).
When using a password, a slat is also required, just create a random string that gets concatenated to the password before SHA-hashing and setting as a cookie.
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.