Yes, that would close the filehandle before the file was sent, so no file would be sent

See Re^2: plack: close filehandle responsibility (everybody), while https://metacpan.org/pod/Plack::Response#body doesn't document that it closes $io the handle it accepts as argument, it does do it

Try it out, fireup this plack program, and start taskmanager, and watch the handles count not increase with each browser request you make

#!/usr/bin/perl -- use strict; use warnings; use Plack::Builder; use Path::Tiny qw/ path /; my $app = sub { return [ 200, [ 'Content-Type' => 'text/plain; charset=UTF-8', ], path( __FILE__ )->openr_raw, ]; }; my $finalapp = builder { enable 'StackTrace'; $app; }; if( $0 eq __FILE__ ){ require Plack::Runner; my $runner = Plack::Runner->new; $runner->parse_options( qw' --host 127.0.0.1 --port 5000 ' ); $runner->run( $finalapp ); ## perl this.psgi } else { $finalapp; ## plackup -l localhost:5000 this.psgi } ## lwp-request -Ed http://127.0.0.1:5000/

If I close the handle openr_raw returns before Plack reads it without slurping, there will probably be a plack error

update: I just tested it, no error, but no file is sent either as expected


In reply to Re^2: plack: close filehandle responsibility by Anonymous Monk
in thread [solved] plack: close filehandle responsibility by basiliscos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.