tokuhirom's blog

urandom streaming on twiggy

use strict;
use warnings;
use autodie;

sub {
    open my $fh, '<', '/dev/urandom';
    sub {
        my $respond = shift;
        my $writer = $respond->([200, ['Content-Type' => 'application/octet-stream']]);
        while (1) {
            read $fh, my $buf, 1024;
            $writer->write($buf);
        }
    };
};
Created: 2010-11-22 03:17:54 UTC
Updated: 2010-11-22 03:17:54 UTC