Scaffold::Engine - The Scaffold interface to Plack/psgi
use Scaffold::Server; use Scaffold::Render::TT; my $psgi_handler; my $server = Scaffold::Server->new( locations => [ { route => qr{^/$}, handler => 'App::HelloWorld', },{ route => qr{^/test$}, handler => 'App::Cached', },{ route => qr{^/robots.txt$}, handler => 'Scaffold::Handler::Robots', },{ route => qr{^/favicon.ico$}, handler => 'Scaffold::Handler::Favicon', },{ route => qr{^/static/(.*)$}, handler => 'Scaffold::Handler::Static', },{ route => qr{^/login/(.*)$}, handler => 'Scaffold::Uaf::Login', },{ route => qr{^/logout$}, handler => 'Scaffold::Uaf::Logout', } ], authorization => { authenticate => 'Scaffold::Uaf::Manager', authorize => 'Scaffold::Uaf::Authorize', }, render => Scaffold::Render::TT->new( include_path => 'html:html/resources/templates', ), ); $psgi_hander = $server->engine->psgi_handler();
... or
use Scaffold::Server; use Scaffold::Render::TT; my $server = Scaffold::Server->new( engine => { module => 'ServerSimple', args => { port => 8080, } }, locations => [ { route => qr{^/$}, handler => 'App::HelloWorld', },{ route => qr{^/test$}, handler => 'App::Cached', },{ route => qr{^/robots.txt$}, handler => 'Scaffold::Handler::Robots', },{ route => qr{^/favicon.ico$}, handler => 'Scaffold::Handler::Favicon', },{ route => qr{^/static/(.*)$}, handler => 'Scaffold::Handler::Static', },{ route => qr{^/login/(.*)$}, handler => 'Scaffold::Uaf::Login', },{ route => qr{^/logout$}, handler => 'Scaffold::Uaf::Logout', } ], authorization => { authenticate => 'Scaffold::Uaf::Manager', authorize => 'Scaffold::Uaf::Authorize', }, render => Scaffold::Render::TT->new( include_path => 'html:html/resources/templates', ), ); $server->engine->run();
This module is used internally by Scaffold::Server to initialize and return the code reference that is needed by the Plack/psgi runtime environment. The first example in the Synopsis can be ran with the following command:
# plackup -app app.psgi -port 8080
The second example can be ran with this command:
# perl app.pl
The first example is more versatile, as the code can be used in any environment that the Plack runtime supports.
Returns a code reference to the dispatch handler.
Runs Scaffold::Server as a standalone application.
PlackX::Engine Scaffold Scaffold::Base Scaffold::Cache Scaffold::Cache::FastMmap Scaffold::Cache::Manager Scaffold::Cache::Memcached Scaffold::Class Scaffold::Constants Scaffold::Engine Scaffold::Handler Scaffold::Handler::Default Scaffold::Handler::Favicon Scaffold::Handler::Robots Scaffold::Handler::Static Scaffold::Lockmgr Scaffold::Lockmgr::KeyedMutex Scaffold::Lockmgr::UnixMutex Scaffold::Plugins Scaffold::Render Scaffold::Render::Default Scaffold::Render::TT Scaffold::Routes Scaffold::Server Scaffold::Session::Manager Scaffold::Stash Scaffold::Stash::Controller Scaffold::Stash::Cookie Scaffold::Stash::View Scaffold::Uaf::Authenticate Scaffold::Uaf::AuthorizeFactory Scaffold::Uaf::Authorize Scaffold::Uaf::GrantAllRule Scaffold::Uaf::Login Scaffold::Uaf::Logout Scaffold::Uaf::Manager Scaffold::Uaf::Rule Scaffold::Uaf::User Scaffold::Utils
Kevin L. Esteb, <kevin@kesteb.us>
Coded adapted from PlackX::Engine by Takatoshi Kitano <kitano.tk@gmail.com>
Copyright (C) 2009 by Kevin L. Esteb
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available.
To install Scaffold, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Scaffold
CPAN shell
perl -MCPAN -e shell install Scaffold
For more information on module installation, please visit the detailed CPAN module installation guide.