Hi,

I've inherited a large set of "old" mod_perl/Embperl websites from a crashed server.... Programming (mod_)perl is not yet my strongpoint at this moment, and the sites do not work when it needs to upload files. (It is a very old, selfmade CMS) I have do large experience in sysadmin and scripts in Perl4. :(

It is running on FreeBSD 5.4, Apache/1.3.33 (Unix) Embperl/1.3.6 mod_perl/1.29

And the snippet of code looks like this:
        # Get some fileproperties!
        $filename=$fdat{ImageName};
        $filename=~ m/.*\\(.*)/is;
        $shortname=$1;
        $contentinfo =$fdat{-ImageName} -> {'Content-Type'};

        $contentinfo =~ m/(.*?)\/(.*)/is;
        $contentsort=$1;
        $contenttype=$2;

print LOG "[$$]ABCD: Opening $tmppath$tmpname.$$\n" ;
open FILE, "> $tmppath$tmpname.$$" ||
print LOG "[$$]ABCD: Cannot open file $tmppath$tmpname.$$ for writing\n"; #store file in tmp dir.
binmode FILE;
$ok=1;
$oversize=0;
while ($ok==1)
{
$temp=0;
$temp = read($fdat{ImageName}, $buffer, 16384);
$size = $size + $temp;
print FILE $buffer;
print LOG "[$$]ABCD: Buffer: |$buffer|\n";
if ($temp ==0) {$ok=0} # exit, finished reading all data
if ($size > $maxfilesize) {$oversized=1;$ok=0;} # toooo big
}
close FILE;
---------------


The print LOG are my doing....
When this code gets executed it does open the file, filename and contentinfo are correctly extracted. Only the data in read is never there. The buffer is always empty. But I can not seem to graps why!?


It could be configuration, although I'm led to believe that read-overloading is default present with mod_perl/Embperl. I did get Sessions to work with Apache::SessionX.

I've also searched the archives but have only found some discussion from 2001 on this. And it either went away with upgrading mod_perl, or by completely overhauling the code. mod_perl is already very recent. And rewriting the code is something I try to prevent, since it'll might start to break even more.

Does anybody have suggestions as to where to look??
--WjW

Reply via email to