Skip to content

Consider allowing a PSGI arrayref as a run mode return value #7

@markstos

Description

@markstos

Currently there are are two documented value return values for a run mode, a scalar and scalarref.

I think we should consider adding a third: If the return value is an arrayref, it would be expected to be a complete PSGI response that's passed through directly (without adding a response code or headers as we usually would.

Use Case

CGI::Application::Plugin::Stream could be replaced with a native PSGI solution. To stream a file, you could end a run mode like this:

return Plack::App::File->new(file => '/my/private/file.csv');

Like the Stream plugin, this would handle detecting the MIME Type and setting a Content-Type and Last-Modified headers, and converting it to a file handle. The server-side of the PSGI spec takes things from there.

I think if we don't add this, we'll end up needlessly rewriting solutions for cases like this, when we could be taking advantage of a native PSGI solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions