Questions tagged [plack]

Plack is a Perl module and toolkit that contains middleware, helpers and adapters to web servers. PSGI is an interface between Perl web applications and web servers.

Plack is a set of tools that contains middleware components, a reference server and utilities for Web application frameworks using the stack.

A little Plack Handbook is available to get started with Plack and PSGI. Also see the Plack Advent Calenda with 24 useful short posts explaining the concept of PSGI and tutorials.

Web site: http://plackperl.org/

102 questions
7
votes
2 answers

Multilingual PSGI-web deployment

I plan develop one web application with PSGI/Plack. (probaly with Dancer, but not decided yet). The applicatiion should be utf8, multilingual (with Locale::Maketext) and (ofc) will contain some statical pages in the given language. My idea is deploy…
clt60
  • 62,119
  • 17
  • 107
  • 194
6
votes
2 answers

Why is raising plackup (or starman) memory usage?

I have this simple PSGI application (app.psgi). use strict; use warnings; my $app = sub { my $mem = `ps -o rss= -p $$`; $mem =~ s/^\s*|\s*$//gs; return [ 200, [ 'Content-Type' => 'text/text' ], [ $mem ]]; }; I was requested the above…
kobame
  • 5,766
  • 3
  • 31
  • 62
6
votes
2 answers

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

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…
clt60
  • 62,119
  • 17
  • 107
  • 194
6
votes
1 answer

How do I run a Plack request handler in background?

I have a simple Plack app (something like Plack::App::GitHub::WebHook) that I run using plackup. I perform a lengthy operation in the request handler, which currently makes the app unresponsive to subsequent requests until the operation is finished.…
zoul
  • 102,279
  • 44
  • 260
  • 354
6
votes
2 answers

It is correct to switch the default perl's IO to utf-8 while using Plack and Middlewares?

Two starting points: In his answer to Why does modern Perl avoid UTF-8 by default? tchrist pointed out 52 things needed to ensure correct Unicode handling in Perl. The answer shows the boilerplate code with some use statements. A similiar question…
cajwine
  • 3,100
  • 1
  • 20
  • 41
5
votes
1 answer

Best init script for running an application as a separate user

I have an application that runs in a user account (Plack-based) and want an init script. It seems as easy as "sudo $user start_server ...". I just wrote an LSB script using start-stop-daemon and it is really clumsy and verbose. It doesn't feel like…
jshirley
  • 366
  • 1
  • 6
5
votes
2 answers

How do I stack Plack authentication handlers?

I would like to have my Plack app try several different means of authorizing the user. Specifically, check if the user is already authorized via a session cookie, then check for Digest authentication and then fall back to Basic. I figured I could…
Schwern
  • 153,029
  • 25
  • 195
  • 336
5
votes
1 answer

Dancer unique request ID

Is there any unique request ID in Dancer? Apache has mod_unique_id: http://httpd.apache.org/docs/current/mod/mod_unique_id.html PSGI/Plack has a middleware module:…
Sebastian
  • 2,472
  • 1
  • 18
  • 31
5
votes
1 answer

Best way to run a Plack PSGI Perl application outside of Apache using FastCGI?

I'm currently running Apache/mod_perl with a PSGI-application invoked by Plack::Handler::Apache2. The problem we have is each Apache process consumes a connection to the PostgreSQL database, which is expensive. To solve this, we plan to run the…
5
votes
2 answers

Snooping on http headers between different plack middlewares

If I understand right, the PSGI application works as next: got the request from a browser the request is "bubbles" thru some middlewares in the order as them is defined in the builder the request comes to my app my app produces some respond this…
cajwine
  • 3,100
  • 1
  • 20
  • 41
5
votes
1 answer

Do I need to convert mod_rewrite rules to Plack::Middleware::Rewrite rules if my web framework wants to support PSGI?

We've got a FastCGI-based web framework that we use internally for some mission critical apps. Thus moving to an existing PSGI-complaint framework is not very practical. We've successfully moved our framework over from plain old CGI.pm to Plack…
GeneQ
  • 7,485
  • 6
  • 37
  • 53
5
votes
2 answers

Handling authentication with Apache reverse proxy for plack/PSGI app

This is my scenario: So, Requests via encrypted HTTPS go to Apache like: https://server1/MyPerlApp If the user is not logged in, they get a redirect to some login page (in the server1), and Apache doesn't proxy the request to Server2 When the…
kobame
  • 5,766
  • 3
  • 31
  • 62
5
votes
1 answer

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

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…
5
votes
2 answers

Perl - Facebook Graph API

Time ago it was easy to make a distinction between desktop and web applications, but today while reading while the documentation I've noticed that this difference is less pronounced. I'm using the Facebook::Graph module to create a desktop…
5
votes
1 answer

Converting Modperl config to Plack - running different handlers by file extension

This I'm trying for transfer my current Apache/Modperl site to Starman, and need build app.psgi with different handlers for different file extensions. Somthing as in the Apache: SetHandler …
kobame
  • 5,766
  • 3
  • 31
  • 62