Hi, Mod_perl 1.27 on linux OS.
I am trying to create a small app that sends the user a file. I am using Apache::File->tmpfile to create a temporary file which is formatted using a simple format. However I can't seem to get it to work correctly and I am either getting an empty file or a server error. I have created the following junk.pm to try and debug it better. In its current state it errors with "Can't send /tmp/16656aaaaaa: 0 " at the send_fh($fh) line. The is nothing returned for $! and the status 0 doesn't make life any easier. I have checked the permission on /tmp, I even went so far as to chown to the httpd id. The error log also shows "file exists, is 0" for the test on $tempfile, again not sure what to make of a zero bytes file that does exist, presumably nothing was written to it. I am pretty sure this is my ignorance on file handles, can anyone spot my error? Thanx. Dp. ================ JUNK.PM ========= package SPL::junk; use Apache::Constants qw(:common); use Apache::File; use strict; $| = 1; sub handler { my $r = Apache::Request->new(shift); my ($tempfile,$fh) = Apache::File->tmpfile; my ($h,$w) = qw(hello world); format CLOCK = @<<<<<<<<< @<<<<<<<<<<< $h,$w . open(CLOCK,">$tempfile") || die "Can't write to $tempfile: $! $?\n"; write(CLOCK) || 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"; } seek $fh,0,0; $r->send_http_header('text'); $r->send_fd($fh) || die "Can't send $tempfile: $! $?\n"; return OK; } 1; ~~ Dermot Paikkos * [EMAIL PROTECTED] Network Administrator @ Science Photo Library Phone: 0207 432 1100 * Fax: 0207 286 8668 -- 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