in reply to Perl vs. PHP in streaming a file
I was going to try different things, but a file being printed by the code you provided downloaded at 280KBs!!! (That's 1MB in 3.6 seconds!) I don't want to get into trouble with my employer or my web host, so I'm not going to do further testing.
Things I was going to try:
Actual code used:
#!/usr/bin/perl use strict; use warnings; print("Content-Type: application/x-octect-stream\n"); print("\n"); use IO::File (); my $data = IO::File->new('< file') or die("Can't open data file: $!$/"); binmode($data); my $block = ''; while ($data->read($block, 1024)) { print $block; }
|
|---|