/usr/local/bin/plackup

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 11 / 11 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/DBIx/Class/Sims/REST/SQLite.pm ↑ Summary
1 #!/usr/local/bin/perl
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Plack::Runner;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 my $runner = Plack::Runner->new;
6 1 $runner->parse_options(@ARGV);
7 1 $runner->run;
8  
9 __END__
10  
11 =head1 NAME
12  
13 plackup - Run PSGI application with Plack handlers
14  
15 =head1 SYNOPSIS
16  
17 # read your app from app.psgi file
18 plackup
19  
20 # choose .psgi file from ARGV[0] (or with -a option)
21 plackup hello.psgi
22  
23 # switch server implementation with --server (or -s)
24 plackup --server HTTP::Server::Simple --port 9090 --host 127.0.0.1 test.psgi
25  
26 # use UNIX socket to run FCGI daemon
27 plackup -s FCGI --listen /tmp/fcgi.sock myapp.psgi
28  
29 # launch FCGI external server on port 9090
30 plackup -s FCGI --port 9090
31  
32 =head1 DESCRIPTION
33  
34 plackup is a command line utility to run PSGI applications from the command
35 line.
36  
37 plackup automatically figures out the environment it is run in, and
38 runs your application in that environment. FastCGI, CGI, AnyEvent and
39 others can all be detected. See L<Plack::Loader> for the authoritative
40 list.
41  
42 C<plackup> assumes you have an C<app.psgi> script in your current directory.
43 The last statement of C<app.psgi> should be a code reference that is a PSGI
44 application:
45  
46 #!/usr/bin/perl
47 use MyApp;
48 my $application = MyApp->new;
49 my $app = sub { $application->run_psgi(@_) };
50  
51 =head1 ARGUMENTS
52  
53 =over 4
54  
55 =item .psgi
56  
57 plackup --host 127.0.0.1 --port 9090 /path/to/app.psgi
58  
59 The first non-option argument is used as a C<.psgi> file path. You can
60 also set this path with C<-a> or C<--app>. If omitted, the
61 default file path is C<app.psgi> in the current directory.
62  
63 =back
64  
65 =head1 OPTIONS
66  
67 =over 4
68  
69 =item -a, --app
70  
71 Specifies the full path to a C<.psgi> script. You may alternately provide this
72 path as the first argument to C<plackup>.
73  
74 =item -e
75  
76 Evaluates the given perl code as a PSGI app, much like perl's C<-e>
77 option:
78  
79 plackup -e 'sub { my $env = shift; return [ ... ] }'
80  
81 It is also handy when you want to run a custom application like Plack::App::*.
82  
83 plackup -MPlack::App::File -e 'Plack::App::File->new(...)->to_app'
84  
85 You can also specify C<-e> option with C<.psgi> file path to wrap the
86 application with middleware configuration from the command line. You
87 can also use L<Plack::Builder> DSL syntax inside C<-e> code. For example:
88  
89 plackup -e 'enable "Auth::Basic", authenticator => ...;' myapp.psgi
90  
91 is equivalent to the PSGI application:
92  
93 use Plack::Builder;
94 use Plack::Util;
95
96 builder {
97 enable "Auth::Basic", authenticator => ...;
98 Plack::Util::load_psgi("myapp.psgi");
99 };
100  
101 Note that when you use C<-e> option to enable middleware, plackup
102 doesn't assume the implicit C<app.psgi> path. You must either pass the
103 path to your C<.psgi> file in the command line arguments or load the
104 application inside C<-e> after the C<enable>.
105  
106 plackup # Runs app.psgi
107 plackup -e 'enable "Foo"' # Doesn't work!
108 plackup -e 'enable "Foo"' app.psgi # Works
109 plackup -e 'enable "Foo"; sub { ... }' # Works
110  
111 =item -o, --host
112  
113 Binds to a TCP interface. Defaults to undef, which lets most server backends
114 bind to the any (*) interface. This option is only valid for servers which support
115 TCP sockets.
116  
117 =item -p, --port
118  
119 Binds to a TCP port. Defaults to 5000. This option is only valid for servers
120 which support TCP sockets.
121  
122 Note: default port 5000 may conflict with AirPlay server on MacOS 12 (Monterey)
123 or later.
124  
125 =item -s, --server, the C<PLACK_SERVER> environment variable
126  
127 Selects a specific server implementation to run on. When provided, the C<-s> or
128 C<--server> flag will be preferred over the environment variable.
129  
130 If no option is given, plackup will try to detect the I<best> server
131 implementation based on the environment variables as well as modules loaded by
132 your application in C<%INC>. See L<Plack::Loader> for details.
133  
134 =item -S, --socket
135  
136 Listens on a UNIX domain socket path. Defaults to undef. This option is only
137 valid for servers which support UNIX sockets.
138  
139 =item -l, --listen
140  
141 Listens on one or more addresses, whether "HOST:PORT", ":PORT", or "PATH"
142 (without colons). You may use this option multiple times to listen on multiple
143 addresses, but the server will decide whether it supports multiple interfaces.
144  
145 =item -D, --daemonize
146  
147 Makes the process run in the background. It's up to the backend server/handler
148 implementation whether this option is respected or not.
149  
150 =item -I
151  
152 Specifies Perl library include paths, like C<perl>'s -I option. You may add
153 multiple paths by using this option multiple times.
154  
155 =item -M
156  
157 Loads the named modules before loading the app's code. You may load multiple
158 modules by using this option multiple times.
159  
160 In combination with C<-r> or C<-R> may not have the desired restart effect
161 when the loaded module is changed in the development directory. To avoid
162 this problem you need to load the module with the app code using C<-e>.
163  
164 =item -E, --env, the C<PLACK_ENV> environment variable.
165  
166 Specifies the environment option. Setting this value with C<-E> or C<--env>
167 also writes to the C<PLACK_ENV> environment variable. This allows applications
168 or frameworks to tell which environment setting the application is running on.
169  
170 # These two are the same
171 plackup -E deployment
172 env PLACK_ENV=deployment plackup
173  
174 Common values are C<development>, C<deployment>, and C<test>. The default value
175 is C<development>, which causes C<plackup> to load the middleware components:
176 I<AccessLog>, I<StackTrace>, and I<Lint> unless C<--no-default-middleware>
177 is set.
178  
179 =item --no-default-middleware
180  
181 This prevents loading the default middleware stack even when Plack
182 environment (i.e. C<-E> or C<PLACK_ENV>) is set to C<development>.
183  
184 =item -r, --reload
185  
186 Makes plackup restart the server whenever a file in your development directory
187 changes. This option by default watches the C<lib> directory and the base
188 directory where I<.psgi> file is located. Use C<-R> to watch other
189 directories.
190  
191 Reloading will delay the compilation of your application. Automatic server
192 detection (see C<-s> above) may not behave as you expect, if plackup needs to
193 scan your application for the modules it uses. Avoid problems by specifying
194 C<-s> explicitly when using C<-r> or C<-R>.
195  
196 To avoid problems with changes to preloaded modules see documentation for C<-M>.
197  
198 =item -R, --Reload
199  
200 Makes plackup restart the server whenever a file in any of the given
201 directories changes. C<-R> and C<--Reload> take a comma-separated list of
202 paths:
203  
204 plackup -R /path/to/project/lib,/path/to/project/templates
205  
206 To avoid problems with changes to preloaded modules see documentation for C<-M>.
207  
208 =item -L, --loader
209  
210 Specifies the server loading subclass that implements how to run the server.
211 Available options are I<Plack::Loader> (default), I<Restarter> (automatically
212 set when C<-r> or C<-R> is used), I<Delayed>, and I<Shotgun>.
213  
214 See L<Plack::Loader::Delayed> and L<Plack::Loader::Shotgun> for more details.
215  
216 =item --access-log
217  
218 Specifies the pathname of a file where the access log should be written. By
219 default, in the development environment access logs will go to STDERR.
220  
221 =item --path
222  
223 Specify the root path of your app (C<SCRIPT_NAME> in PSGI env) to
224 run. The following two commands are roughly the same.
225  
226 plackup --path /foo app.psgi
227 plackup -e 'mount "/foo" => Plack::Util::load_psgi("app.psgi")'
228  
229 =back
230  
231 Other options that starts with C<--> are passed through to the backend server.
232 See each Plack::Handler backend's documentation for more details on their
233 available options.
234  
235 =head1 SEE ALSO
236  
237 L<Plack::Runner> L<Plack::Loader>
238  
239 =cut
« blib/lib/DBIx/Class/Sims/REST/SQLite.pm ↑ Summary