RUD server for JSON objects and plain files.
# 2010 by Tom Kirchner
#
# routes:
# POST /create = erzeugt neues JSON-Dokument, liefert UUId zurueck
# GET /read/<uuid> = liefert JSON-Dokument oder
Fehler zurueck
# POST /update/<uuid> = aendert JSON-Dokument (erzeugt neue Revision)
# GET /delete/<uuid> = loescht JSON-Dokument
# GET /file/<filename> = gibt Datei innerhalb Document-Root z
document root.
# 2010 by Tom Kirchner
use 5.010000;
use strict;
use warnings;
use IO::File;
use JSON;
use Path::Trim;
use HTTP::AppServer::Plugin;
use base qw(HTTP::AppServer::Plugin);
our $VERSION
package HTTP::AppServer::Plugin::JsonCrud;
# Plugin for HTTP::AppServer that provides CRUD methods for
# storing JSON documents in a DBI (relational) database.
# 2010 by Tom Kirchner
################
se DBI;
use JSON;
use HTTP::AppServer::Plugin;
use base qw(HTTP::AppServer::Plugin);
our $VERSION = '0.01';
# database connection settings
my $DBEngine = 'mysql';
my $DBName = 'jsondb';
my $DB
ot';
my $DBPassword = '';
my $DBHost = 'localhost';
# database settings
my $DBTablePrefix = 'jsondb_';
# UUID generator instance
my $UUIDGenerator = Data::UUID->new();
# called by the server wh