Name : perl-Web-Simple
| |
Version : 0.033
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.66
| Date : 2024-08-05 18:09:33
|
Group : Unspecified
| Source RPM : perl-Web-Simple-0.033-1.66.src.rpm
|
Size : 0.14 MB
| |
Packager : (none)
| |
Summary : Quick and easy way to build simple web applications
|
Description :
The philosophy of Web::Simple is to keep to an absolute bare minimum for everything. It is not designed to be used for large scale applications; the Catalyst web framework already works very nicely for that and is a far more mature, well supported piece of software.
However, if you have an application that only does a couple of things, and want to not have to think about complexities of deployment, then Web::Simple might be just the thing for you.
The only public interface the Web::Simple module itself provides is an \'import\' based one:
use Web::Simple \'NameOfApplication\';
This sets up your package (in this case \"NameOfApplication\" is your package) so that it inherits from Web::Simple::Application and imports strictures, as well as installs a \'PSGI_ENV\' constant for convenience, as well as some other subroutines.
Importing strictures will automatically make your code use the \'strict\' and \'warnings\' pragma, so you can skip the usual:
use strict; use warnings FATAL => \'all\';
provided you \'use Web::Simple\' at the top of the file. Note that we turn on *fatal* warnings so if you have any warnings at any point from the file that you did \'use Web::Simple\' in, then your application will die. This is, so far, considered a feature.
When we inherit from Web::Simple::Application we also use Moo, which is the the equivalent of:
{ package NameOfApplication; use Moo; extends \'Web::Simple::Application\'; }
So you can use Moo features in your application, such as creating attributes using the \'has\' subroutine, etc. Please see the documentation for Moo for more information.
It also exports the following subroutines for use in dispatchers:
response_filter { ... };
redispatch_to \'/somewhere\';
Finally, import sets
$INC{\"NameOfApplication.pm\"} = \'Set by \"use Web::Simple;\" invocation\';
so that perl will not attempt to load the application again even if
require NameOfApplication;
is encountered in other code.
One important thing to remember when using
NameOfApplication->run_if_script;
At the end of your app is that this call will create an instance of your app for you automatically, regardless of context. An easier way to think of this would be if the method were more verbosely named
NameOfApplication->run_request_if_script_else_turn_coderef_for_psgi;
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-W/openSUSE_Tumbleweed/noarch |