plack

how to pass arguments from an plack app to an mojolicious app enabled in builder?

和自甴很熟 提交于 2019-12-05 08:50:21
given the example plack app using lots of middleware components and an mojolicious app enabled in builder (see below), how can i pass parameters from the app.psgi to Mojolicious without using the ugly %ENV hack shown? of cause passing an config is just an example, this could be any scalar/object. app.psgi use Plack::Builder; $ENV{CONFIG} = {...}; builder { ... Mojolicious::Commands->start_app('MyApp'); }; MyApp.pm package MyApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; my $r = $self->routes; $self->config( $ENV{CONFIG} ); $r->route('/')->to('home#'); } This is an

How to setup Apache-like name-based virtual hosts with Starman

佐手、 提交于 2019-12-05 01:18:36
问题 In my previous question I asked about a multi-domain solution, but the question was too complex. Now in short: Is it possible to somehow setup name-based virtual hosts with Starman (or with any other pure perl PSGI server) like with Apache's <VirtualHost ...> directive? Or do I need to use Apache to get this kind of functionality? Any idea? 回答1: The middleware is already done in Plack::Builder with Plack::App::URLMap. The pod saying: Mapping URL with host names is also possible, and in that

nginx and Perl: FastCGI vs reverse proxy (PSGI/Starman)

隐身守侯 提交于 2019-12-03 03:47:39
问题 A very popular choice for running Perl web applications these days seems to be behind a nginx webserver proxying requests to either a FastCGI daemon or a PSGI enabled webserver (e.g. Starman). There have been lots of question as to why one would do this in general (e.g. Why use nginx with Catalyst/Plack/Starman?) and the answers seem to apply in both cases (e.g. allow nginx to serve static content, easy restart of application server, load balancing, etc.) However, I am specifically interested

nginx and Perl: FastCGI vs reverse proxy (PSGI/Starman)

南笙酒味 提交于 2019-12-02 17:14:23
A very popular choice for running Perl web applications these days seems to be behind a nginx webserver proxying requests to either a FastCGI daemon or a PSGI enabled webserver (e.g. Starman). There have been lots of question as to why one would do this in general (e.g. Why use nginx with Catalyst/Plack/Starman? ) and the answers seem to apply in both cases (e.g. allow nginx to serve static content, easy restart of application server, load balancing, etc.) However, I am specifically interested in the pros/cons of using FastCGI vs a reverse-proxy approach. It seems that Starman is widely

Handling multiple file uploads with Plack

我的梦境 提交于 2019-12-01 16:42:47
Trying handling multiple file uploads with Plack. My form: <form id="file_upload" action="savefile" method="POST" enctype="multipart/form-data"> <input type="file" name="file[]" multiple> <button>upload</button> </form> Selected two files, called: x1 and x2 . The Data::Dumper result of the: my $u = $req->uploads; is $VAR1 = bless( { 'file[]' => bless( { 'headers' => bless( { 'content-disposition' => 'form-data; name="file[]"; filename="x2"', 'content-type' => 'application/octet-stream', '::std_case' => { 'content-disposition' => 'Content-Disposition' } }, 'HTTP::Headers' ), 'filename' => 'x2',

How to make Mason2 UTF-8 clean?

人走茶凉 提交于 2019-11-30 06:53:03
问题 Reformulating the question, because @optional asked me it wasn't clear and linked one HTML::Mason based solution Four easy steps to make Mason UTF-8 Unicode clean with Apache, mod_perl, and DBI , what caused confusions the original is 4 years old and meantime (in 2012) the "poet" is created Comment: This question already earned the "popular question badge", so probably i'm not the only hopeless person. :) Unfortunately, demonstrating the full problem stack leads to an very long question and

An explanation of the nginx/starman/dancer web stack

你说的曾经没有我的故事 提交于 2019-11-29 19:44:55
I've been doing web-programming for a while now and am quite familiar with the LAMP stack. I've decided to try playing around with the nginx/starman/dancer stack and I'm a bit confused about how to understand, from a high-level, how all the pieces relate to each other. Setting up the stack doesn't seem as straight forward as setting up the LAMP stack, but that's probably because I don't really understand how the pieces relate. I understand the role nginx is playing - a lightweight webserver/proxy - but I'm confused about how starman relates to pgsi, plack and dancer. I would appreciate a high

How to make Mason2 UTF-8 clean?

南笙酒味 提交于 2019-11-28 23:01:43
Reformulating the question, because @optional asked me it wasn't clear and linked one HTML::Mason based solution Four easy steps to make Mason UTF-8 Unicode clean with Apache, mod_perl, and DBI , what caused confusions the original is 4 years old and meantime (in 2012) the "poet" is created Comment: This question already earned the "popular question badge", so probably i'm not the only hopeless person. :) Unfortunately, demonstrating the full problem stack leads to an very long question and it is very Mason specific. First, the opinions-only part :) I'm using HTML::Mason over ages, and now

Why use nginx with Catalyst/Plack/Starman?

匆匆过客 提交于 2019-11-28 04:59:57
I am trying to deploy my little Catalyst web app using Plack/Starman. All the documentation seems to suggest I want to use this in combination with nginx. What are the benefits of this? Why not use Starman straight up on port 80? It doesn't have to be nginx in particular, but you want some kind of frontend server proxying to your application server for a few reasons: So that you can run the Catalyst server on a high port, as an ordinary user, while running the frontend server on port 80. To serve static files (ordinary resources like images, JS, and CSS, as well as any sort of downloads you

Why use nginx with Catalyst/Plack/Starman?

点点圈 提交于 2019-11-27 00:44:51
问题 I am trying to deploy my little Catalyst web app using Plack/Starman. All the documentation seems to suggest I want to use this in combination with nginx. What are the benefits of this? Why not use Starman straight up on port 80? 回答1: It doesn't have to be nginx in particular, but you want some kind of frontend server proxying to your application server for a few reasons: So that you can run the Catalyst server on a high port, as an ordinary user, while running the frontend server on port 80.