Commit | Line | Data |
fbcc39ad |
1 | package TestApp::Controller::Action::Streaming; |
2 | |
3 | use strict; |
4 | use base 'TestApp::Controller::Action'; |
5 | |
6 | sub streaming : Global { |
7 | my ( $self, $c ) = @_; |
8 | for my $line ( split "\n", <<'EOF' ) { |
9 | foo |
10 | bar |
11 | baz |
12 | EOF |
13 | $c->res->write("$line\n"); |
14 | } |
15 | } |
16 | |
3dc4d7e9 |
17 | sub body : Local { |
18 | my ( $self, $c ) = @_; |
19 | |
0e155123 |
20 | my $file = "$FindBin::Bin/../lib/TestApp/Controller/Action/Streaming.pm"; |
3dc4d7e9 |
21 | my $fh = IO::File->new( $file, 'r' ); |
22 | if ( defined $fh ) { |
23 | $c->res->body( $fh ); |
24 | } |
25 | else { |
26 | $c->res->body( "Unable to read $file" ); |
27 | } |
28 | } |
29 | |
fbcc39ad |
30 | 1; |