problem getting file size in forked code 
Author Message
 problem getting file size in forked code

I am writing a server which is based on the example on p350-1 of the
blue camel book.  The code that is spawned loops around checking whether
a file has increased in size and if so outputs the extra bits.  The
relevant part is:

    $group = <STDIN>;
    chop $group;
    $nickname = <STDIN>;
    chop $nickname;
    $trans_file = "$transcript_file-$group";
    $trans_file =~ s/[\cM\s]//g;
        $nickname =~ s/\cM//g;
        logmsg "file ($trans_file)";
        LOOP: while (1) {
            $size = -s $trans_file;
            logmsg "size = $size/$sent";

where $transcript_file is a constant = "/var/httpd/cgi-bin/foo" and
$group is passed in via the dup'ed STDIN

For some reason $size is always set to be an empty string.  When I tried
replacing -s $trans_file with `wc $trans_file` I got the error file does
not exist from wc with an argument that was just the $transcript_file.

It looks as if $group is being removed from the end of $trans_file, but
that would seem to be impossible ...

Any advice would be very gratefully received

Steve Hedges



Sat, 15 May 1999 03:00:00 GMT  
 problem getting file size in forked code

I'm afraid that this newsgroup has acted as a cardboard superman re this
problem: as soon as it was posted I discovered my error.

For sdome reason the java method writeChars() (used by my client)
embeds  control characters between the characters of the group name.
These are not visible when the log file was more'd but became visible
when looked at with emacs

Steve Hedges



Sun, 16 May 1999 03:00:00 GMT  
 problem getting file size in forked code

Quote:

> I'm afraid that this newsgroup has acted as a cardboard superman re this
> problem: as soon as it was posted I discovered my error.

> For sdome reason the java method writeChars() (used by my client)
> embeds  control characters between the characters of the group name.
> These are not visible when the log file was more'd but became visible
> when looked at with emacs

nvi will help you with this, too.

--
76% of all CGI questions posted in comp.lang.perl.misc are answered by:
"CGI.pm.  LWP.  http://www.perl.com/CPAN/modules/01modules.index.html."
....

Proprietor, 5 Sigma Productions          P.O. Box 6250 Chandler AZ 85246
Perl instruction (http://www.5sigma.com/perl/), C++/C/Perl software,



Sun, 16 May 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CGI.pm Bug: file upload file size mismatch when file size is close to buffer size

2. Getting Remote File Size

3. HELP! Getting Remote File Size

4. Getting File Size

5. (Q) getting a file's size in Perl

6. getting remote file sizes

7. getting a file size

8. Differences in the file size reported by Net::FTP->size and ls -l

9. fork and PERL memory size..

10. File Size Memory Problem

11. Berkerly DB file size problem

12. CGI.pl and file upload size restraint problem

 

 
Powered by phpBB® Forum Software