Help me , about $r->bytes_sent

2001-06-27 Thread wac

Dear All,

I want to write a handler, function : log client request file size.

My code can't work:

Apache Config file


SetHandler perl-script
PerlLogHandler My::Test
Options ExecCGI



My::Test

package My::Test;
sub handler {
   my $r = shift;
   $r->send_http_header;
   open (FILE,">>log.txt");
   print FILE $r->filename ."\t". $r->bytes_sent . "\n";
   close FILE;
}

this handler can log file name for request , but $r->bytes_sent is 0 at
all time.

Your friend,
wac





Re: Help me! about $r->bytes_sent

2001-06-25 Thread Stas Bekman

On Tue, 26 Jun 2001, wac wrote:

> Dear all members:
>
> I have a question , I want to use mod_perl handler print file sent size.
>
> Apache Config file httpd.conf
> =
> Alias /test/ "D:/test/"
> 
> SetHandler perl-script
> PerlHandler My::Test
> Options ExecCGI
>  =
>
>
> Perl Module My::Test
> =
> package My::Test;
>
> sub hanlder {
>   my $r = shift;
>   open(FILE,$r->filename) || return 404;
>   $r->send_fd(FILE);
>   close(FILE);
>   print $r->bytes_sent;
> }
> 1;
> =
>
> this code print content of request file, but $r->bytes_sent print 0 at
> all times.

RTFM http://www.modperl.com/book/chapters/ch9.html#Server_Response_Methods


> Please tell me why and how to get this size.
> Thanks for your help!
>
> Your firend,
> wac
>



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Help me! about $r->bytes_sent

2001-06-25 Thread wac

Dear all members:

I have a question , I want to use mod_perl handler print file sent size.

Apache Config file httpd.conf
=
Alias /test/ "D:/test/"

SetHandler perl-script
PerlHandler My::Test
Options ExecCGI
 =


Perl Module My::Test
=
package My::Test;

sub hanlder {
my $r = shift;  
open(FILE,$r->filename) || return 404;
$r->send_fd(FILE);
close(FILE);
print $r->bytes_sent;
}
1;
=

this code print content of request file, but $r->bytes_sent print 0 at
all times.

Please tell me why and how to get this size.
Thanks for your help!

Your firend,
wac