I remember you posting a link to that months and months ago
if ($in->param('source')) {
open my $fh, "<", $0;
print <<HTML;
Content-type: text/html
<html><head><title>jagerman.com main page and image source</title></head>
<body>
<pre>
HTML
local $/;
print $in->escapeHTML(scalar <$fh>);
}
.....hm interesting. Why do you do it that way?
My attempt (its pretty quick reading into a string that way...more so than read()...which I thought was impressive ):
open FH, $0;
my $source = do { local $/; <FH> };
close FH;
do{}:
1 wallclock secs ( 0.19 usr + 0.21 sys = 0.40 CPU) @ 12500.00/s (n=5000)
read() is almost twice that.
if ($in->param('source')) {
open my $fh, "<", $0;
print <<HTML;
Content-type: text/html
<html><head><title>jagerman.com main page and image source</title></head>
<body>
<pre>
HTML
local $/;
print $in->escapeHTML(scalar <$fh>);
}
.....hm interesting. Why do you do it that way?
My attempt (its pretty quick reading into a string that way...more so than read()...which I thought was impressive ):
open FH, $0;
my $source = do { local $/; <FH> };
close FH;
do{}:
1 wallclock secs ( 0.19 usr + 0.21 sys = 0.40 CPU) @ 12500.00/s (n=5000)
read() is almost twice that.