roman has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
there are couple of middleware modules passing some application data via $env.
They may set logger ($env->{'psgix.logger'}), parsed content ($env->{'parsecontent.data'}), information whether page is fetched by robot ( $env->{robot_content} ), they may pass router or route match ($env->{'ox.router'}), ...
Is there any general convention for naming of such keys? Prefix them with the application ($env->{'myapp.router'}) and keep them flat? Keep them in one nested structure ($env->{myapp})? This way resemble stash (Catalyst or other) to me.
Do you think it is a good practice?
There is even a middleware (Plack::Middleware::FormatOutput) which use a kind of application data in body. Plack::Middleware::FormatOutput formats data returned by the wrapped application in body (third argument of psgi triplet).
While the idea of formatter implementation via middleware seems tempting, is it still middleware (the body part of triplet is neither arrayref, nor filehandle)? What do you think about such idea?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Passing application data in PSGI env
by Anonymous Monk on Apr 28, 2015 at 10:22 UTC |