File: Streaming.pm

package info (click to toggle)
libcatalyst-engine-apache-perl 1.12-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 700 kB
  • ctags: 498
  • sloc: perl: 6,003; makefile: 45
file content (30 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package TestApp::Controller::Action::Streaming;

use strict;
use base 'TestApp::Controller::Action';

sub streaming : Global {
    my ( $self, $c ) = @_;
    for my $line ( split "\n", <<'EOF' ) {
foo
bar
baz
EOF
        $c->res->write("$line\n");
    }
}

sub body : Local {
    my ( $self, $c ) = @_;
    
    my $file = "$FindBin::Bin/01use.t";
    my $fh = IO::File->new( $file, 'r' );
    if ( defined $fh ) {
        $c->res->body( $fh );
    }
    else {
        $c->res->body( "Unable to read $file" );
    }
}

1;