> I am pretty sure this is my ignorance on file handles, can anyone
> spot my error?
yes :)
>
> my ($tempfile,$fh) = Apache::File->tmpfile;
in general, you should avoid using $tmpfile unless you absolutely need it.
in this case you don't :)
> open(CLOCK,">$tempfile") || die "Can't write to $tempfile: $!
scratch that.
> write(CLOCK) || die "Can't write to $fh: $! $?\n";
replace that with
my $ofh = select($fh); $~ = "CLOCK"; select($ofh);
write $fh || die "Can't write to $fh: $! $?\n";
>
> if (! -e $tempfile) {
> print STDERR "No tempfile created\n";
> }
> else {
> my ($size) = (stat("$tempfile"))[7];
> print STDERR "file exists, is $size\n";
> }
I don't think you'll get an accurate size count since the filehandle is
still open. but as I said, it's best to forget you have a file unless you
absolutely need it.
>
> seek $fh,0,0;
> $r->send_http_header('text');
> $r->send_fd($fh) || die "Can't send $tempfile: $! $?\n";
why the suggested changes everything works for me.
HTH
--Geoff
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html