App-MFILE-WWW
view release on metacpan or search on metacpan
bin/mfile-www view on Meta::CPAN
#!/usr/bin/perl
# *************************************************************************
# Copyright (c) 2014, SUSE LLC
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of SUSE LLC nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# *************************************************************************
#
# App::MFILE::WWW server startup script
#
# -------------------------------------------------------------------------
use 5.014;
use strict;
use warnings;
#use App::CELL::Test::LogToFile; # uncomment this line to debug initialization
use App::CELL qw( $meta $site );
use App::CELL::Util qw( is_directory_viable );
use App::MFILE::WWW qw( $VERSION );
use Getopt::Long;
use File::Path qw( make_path remove_tree );
use File::ShareDir;
use File::Spec;
use Module::Load;
use Module::Runtime qw( is_module_name require_module );
use Plack::Builder;
use Plack::Runner;
use Plack::Session::Store::File;
use Try::Tiny;
use Web::Machine;
=head1 NAME
mfile-www - App::MFILE::WWW server startup script
=head1 SYNOPSIS
Standalone mode (runs demo "app" on http://localhost:5001):
$ mfile-www
Derived distribution mode with derived distro 'App::Dochazka::WWW':
First, create necessary directories and symlinks by running as root with --init:
$ sudo mfile-www --ddist=App-Dochazka-WWW --init
Then, start the HTTP server
$ mfile-www --ddist=App-Dochazka-WWW
Or, if you need site configuration:
$ mfile-www --dist=App-Dochazka-WWW --sitedir=/foo/bar/baz
NOTE: Be careful with the C<--ddist> option - especially when running as
root - because the script will treat the argument to this option as a
"derived" Perl distribution, and attempt to create new directories and
symlinks in that distribution's "sharedir" (shared directory).
=head1 DESCRIPTION
Run this script from the bash prompt to start the server that will provide the
HTTP server (e.g. Starman) that will serve the JavaScript source files that
make up your application's frontend.
=head2 Standalone operation (demo)
=over
=item * by default (in the absence of the C<--ddist> option), C<$ddist> is
set to the empty string
=item * C<$ddist_dir> is not set
=item * the script calls the C<App::MFILE::WWW::init> routine, which loads
the configuration parameters stored in C<config/WWW_Config.pm> of the
core distro (L<App::MFILE::WWW>) sharedir
=item * since no C<sitedir> option was specified on the command line, no
other configuration files are loaded
( run in 1.832 second using v1.01-cache-2.11-cpan-5a3173703d6 )